More components, broadcasts #98
9 changed files with 43 additions and 88 deletions
|
@ -11,8 +11,6 @@
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="library" name="Maven: com.github.TBMCPlugins.ButtonCore:ButtonCore:master-SNAPSHOT" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.github.TBMCPlugins.ButtonCore:ButtonCore:master-SNAPSHOT" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.spigotmc:spigot-api:1.12.2-R0.1-SNAPSHOT" level="project" />
|
<orderEntry type="library" name="Maven: org.spigotmc:spigot-api:1.12.2-R0.1-SNAPSHOT" level="project" />
|
||||||
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.6" level="project" />
|
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.6" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
|
<orderEntry type="library" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
|
||||||
|
@ -28,36 +26,6 @@
|
||||||
<orderEntry type="library" name="Maven: com.google.code.findbugs:annotations:2.0.1" level="project" />
|
<orderEntry type="library" name="Maven: com.google.code.findbugs:annotations:2.0.1" level="project" />
|
||||||
<orderEntry type="library" name="Maven: net.ess3:Essentials:2.13.1" level="project" />
|
<orderEntry type="library" name="Maven: net.ess3:Essentials:2.13.1" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.github.TBMCPlugins.ButtonCore:Towny:8d3b6b6" level="project" />
|
<orderEntry type="library" name="Maven: com.github.TBMCPlugins.ButtonCore:Towny:8d3b6b6" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.vexsoftware:nuvotifier-universal:2.3.4" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.milkbowl:VaultAPI:master-68f14eca20-1" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.bukkit:bukkit:1.13.1-R0.1-SNAPSHOT" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.16.16" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot:1.12.2-R0.1-SNAPSHOT" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.github.webbukkit:Dynmap-Towny:master-0.60-g924051d-7" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.github.webbukkit:Dynmap:v2.5" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.nijikokun.bukkit:Permissions:3.1.6" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: ru.tehkode:PermissionsEx:1.19.1" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: de.bananaco:bPermissions:2.9.1" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.platymuus.bukkit.permissions:PermissionsBukkit:1.6" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.anjocaido:EssentialsGroupManager:2.10.1" level="project" />
|
|
||||||
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
|
|
||||||
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.spigotmc:spigot-api:1.12.2-R0.1-SNAPSHOT" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.6" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.google.guava:guava:21.0" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.0" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.19" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: net.md-5:bungeecord-chat:1.12-SNAPSHOT" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.github.TBMCPlugins.ButtonCore:ButtonCore:master-SNAPSHOT" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: net.sourceforge.htmlcleaner:htmlcleaner:2.16" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.jdom:jdom2:2.0.5" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.reflections:reflections:0.9.10" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.javassist:javassist:3.19.0-GA" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.google.code.findbugs:annotations:2.0.1" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: net.ess3:Essentials:2.13.1" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.github.TBMCPlugins.ButtonCore:Towny:8d3b6b6" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.vexsoftware:nuvotifier-universal:2.3.4" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.milkbowl:VaultAPI:master-68f14eca20-1" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.milkbowl:VaultAPI:master-68f14eca20-1" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.bukkit:bukkit:1.13.1-R0.1-SNAPSHOT" level="project" />
|
<orderEntry type="library" name="Maven: org.bukkit:bukkit:1.13.1-R0.1-SNAPSHOT" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.16.16" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.16.16" level="project" />
|
||||||
|
|
9
pom.xml
9
pom.xml
|
@ -155,10 +155,6 @@
|
||||||
<id>Essentials</id>
|
<id>Essentials</id>
|
||||||
<url>http://repo.ess3.net/content/repositories/essrel/</url>
|
<url>http://repo.ess3.net/content/repositories/essrel/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
|
||||||
<id>Votifier</id>
|
|
||||||
<url>https://dl.bintray.com/nuvotifier/maven/</url>
|
|
||||||
</repository>
|
|
||||||
<repository>
|
<repository>
|
||||||
<id>Minigames</id>
|
<id>Minigames</id>
|
||||||
<url>http://maven.addstar.com.au/artifactory/release</url>
|
<url>http://maven.addstar.com.au/artifactory/release</url>
|
||||||
|
@ -207,11 +203,6 @@
|
||||||
<artifactId>Towny</artifactId>
|
<artifactId>Towny</artifactId>
|
||||||
<version>8d3b6b6</version>
|
<version>8d3b6b6</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.vexsoftware</groupId>
|
|
||||||
<artifactId>nuvotifier-universal</artifactId>
|
|
||||||
<version>2.3.4</version>
|
|
||||||
</dependency>
|
|
||||||
<!-- <dependency> <groupId>au.com.mineauz</groupId> <artifactId>Minigames</artifactId>
|
<!-- <dependency> <groupId>au.com.mineauz</groupId> <artifactId>Minigames</artifactId>
|
||||||
<version>1.8.0</version> </dependency> -->
|
<version>1.8.0</version> </dependency> -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package buttondevteam.chat;
|
package buttondevteam.chat;
|
||||||
|
|
||||||
|
import buttondevteam.chat.commands.ucmds.admin.DebugCommand;
|
||||||
import buttondevteam.chat.components.chatonly.ChatOnlyComponent;
|
import buttondevteam.chat.components.chatonly.ChatOnlyComponent;
|
||||||
import buttondevteam.chat.components.fun.FunComponent;
|
import buttondevteam.chat.components.fun.FunComponent;
|
||||||
import buttondevteam.chat.components.fun.UnlolCommand;
|
import buttondevteam.chat.components.towny.TownyComponent;
|
||||||
import buttondevteam.chat.commands.ucmds.admin.DebugCommand;
|
|
||||||
import buttondevteam.chat.formatting.ChatFormatter;
|
import buttondevteam.chat.formatting.ChatFormatter;
|
||||||
import buttondevteam.chat.formatting.TellrawEvent;
|
import buttondevteam.chat.formatting.TellrawEvent;
|
||||||
import buttondevteam.chat.formatting.TellrawPart;
|
import buttondevteam.chat.formatting.TellrawPart;
|
||||||
|
@ -181,13 +181,8 @@ public class ChatProcessing {
|
||||||
PluginMain.Instance.getServer().dispatchCommand(PluginMain.Console,
|
PluginMain.Instance.getServer().dispatchCommand(PluginMain.Console,
|
||||||
String.format("tellraw @a[score_%s=%d,score_%s_min=%d] %s", channel.ID, score, channel.ID,
|
String.format("tellraw @a[score_%s=%d,score_%s_min=%d] %s", channel.ID, score, channel.ID,
|
||||||
score, jsonstr));
|
score, jsonstr));
|
||||||
if (e.getChannel().ID.equals(PluginMain.TownChat.ID)
|
val tc = ComponentManager.getIfEnabled(TownyComponent.class);
|
||||||
|| e.getChannel().ID.equals(PluginMain.NationChat.ID)) {
|
if (tc != null) tc.handleSpies(channel, json, ChatProcessing::toJson);
|
||||||
((List<TellrawPart>) json.getExtra()).add(0, new TellrawPart("[SPY]"));
|
|
||||||
jsonstr = toJson(json);
|
|
||||||
Bukkit.getServer().dispatchCommand(PluginMain.Console, String.format(
|
|
||||||
"tellraw @a[score_%s=1000,score_%s_min=1000] %s", channel.ID, channel.ID, jsonstr));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
PluginMain.Instance.getServer().dispatchCommand(PluginMain.Console,
|
PluginMain.Instance.getServer().dispatchCommand(PluginMain.Console,
|
||||||
|
|
|
@ -5,7 +5,6 @@ import buttondevteam.chat.components.announce.AnnouncerComponent;
|
||||||
import buttondevteam.chat.components.flair.FlairComponent;
|
import buttondevteam.chat.components.flair.FlairComponent;
|
||||||
import buttondevteam.chat.components.fun.FunComponent;
|
import buttondevteam.chat.components.fun.FunComponent;
|
||||||
import buttondevteam.chat.components.towncolors.TownColorComponent;
|
import buttondevteam.chat.components.towncolors.TownColorComponent;
|
||||||
import buttondevteam.chat.components.towncolors.TownyListener;
|
|
||||||
import buttondevteam.chat.components.towny.TownyComponent;
|
import buttondevteam.chat.components.towny.TownyComponent;
|
||||||
import buttondevteam.chat.listener.PlayerJoinLeaveListener;
|
import buttondevteam.chat.listener.PlayerJoinLeaveListener;
|
||||||
import buttondevteam.chat.listener.PlayerListener;
|
import buttondevteam.chat.listener.PlayerListener;
|
||||||
|
@ -33,9 +32,6 @@ public class PluginMain extends ButtonPlugin { // Translated to Java: 2015.07.15
|
||||||
|
|
||||||
public static Scoreboard SB;
|
public static Scoreboard SB;
|
||||||
|
|
||||||
public static Channel TownChat;
|
|
||||||
public static Channel NationChat;
|
|
||||||
|
|
||||||
public ConfigData<String> notificationSound() {
|
public ConfigData<String> notificationSound() {
|
||||||
return getIConfig().getData("notificationSound", "");
|
return getIConfig().getData("notificationSound", "");
|
||||||
}
|
}
|
||||||
|
@ -52,12 +48,12 @@ public class PluginMain extends ButtonPlugin { // Translated to Java: 2015.07.15
|
||||||
|
|
||||||
TBMCCoreAPI.RegisterEventsForExceptions(new PlayerListener(), this);
|
TBMCCoreAPI.RegisterEventsForExceptions(new PlayerListener(), this);
|
||||||
TBMCCoreAPI.RegisterEventsForExceptions(new PlayerJoinLeaveListener(), this);
|
TBMCCoreAPI.RegisterEventsForExceptions(new PlayerJoinLeaveListener(), this);
|
||||||
TBMCCoreAPI.RegisterEventsForExceptions(new TownyListener(), this);
|
|
||||||
TBMCChatAPI.AddCommands(this, YeehawCommand.class);
|
TBMCChatAPI.AddCommands(this, YeehawCommand.class);
|
||||||
Console = this.getServer().getConsoleSender();
|
Console = this.getServer().getConsoleSender();
|
||||||
|
|
||||||
SB = getServer().getScoreboardManager().getMainScoreboard(); // Main can be detected with @a[score_...]
|
SB = getServer().getScoreboardManager().getMainScoreboard(); // Main can be detected with @a[score_...]
|
||||||
|
|
||||||
|
if (Bukkit.getPluginManager().isPluginEnabled("Towny"))
|
||||||
Component.registerComponent(this, new TownyComponent());
|
Component.registerComponent(this, new TownyComponent());
|
||||||
|
|
||||||
TBMCChatAPI.RegisterChatChannel(new Channel("§7RP§f", Color.Gray, "rp", null)); //Since it's null, it's recognised as global
|
TBMCChatAPI.RegisterChatChannel(new Channel("§7RP§f", Color.Gray, "rp", null)); //Since it's null, it's recognised as global
|
||||||
|
@ -65,6 +61,7 @@ public class PluginMain extends ButtonPlugin { // Translated to Java: 2015.07.15
|
||||||
if (!setupEconomy() || !setupPermissions())
|
if (!setupEconomy() || !setupPermissions())
|
||||||
TBMCCoreAPI.SendException("We're in trouble", new Exception("Failed to set up economy or permissions!"));
|
TBMCCoreAPI.SendException("We're in trouble", new Exception("Failed to set up economy or permissions!"));
|
||||||
|
|
||||||
|
if (Bukkit.getPluginManager().isPluginEnabled("Towny"))
|
||||||
Component.registerComponent(this, new TownColorComponent());
|
Component.registerComponent(this, new TownColorComponent());
|
||||||
Component.registerComponent(this, new FlairComponent()); //The original purpose of this plugin
|
Component.registerComponent(this, new FlairComponent()); //The original purpose of this plugin
|
||||||
Component.registerComponent(this, new AnnouncerComponent());
|
Component.registerComponent(this, new AnnouncerComponent());
|
||||||
|
|
|
@ -97,6 +97,7 @@ public class TownColorComponent extends Component {
|
||||||
registerCommand(new buttondevteam.chat.components.towncolors.admin.TownColorCommand());
|
registerCommand(new buttondevteam.chat.components.towncolors.admin.TownColorCommand());
|
||||||
registerCommand(new buttondevteam.chat.components.towncolors.admin.NationColorCommand());
|
registerCommand(new buttondevteam.chat.components.towncolors.admin.NationColorCommand());
|
||||||
registerCommand(new TCCount());
|
registerCommand(new TCCount());
|
||||||
|
registerListener(new TownyListener());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package buttondevteam.chat.components.towny;
|
package buttondevteam.chat.components.towny;
|
||||||
|
|
||||||
import buttondevteam.chat.ChatProcessing;
|
import buttondevteam.chat.ChatProcessing;
|
||||||
import buttondevteam.chat.PluginMain;
|
|
||||||
import buttondevteam.core.component.channel.Channel;
|
import buttondevteam.core.component.channel.Channel;
|
||||||
import buttondevteam.lib.TBMCSystemChatEvent;
|
import buttondevteam.lib.TBMCSystemChatEvent;
|
||||||
import buttondevteam.lib.chat.TBMCChatAPI;
|
import buttondevteam.lib.chat.TBMCChatAPI;
|
||||||
|
@ -23,12 +22,14 @@ public class TownyAnnouncer {
|
||||||
String groupID = m.group(2); //The group ID is correctly cased
|
String groupID = m.group(2); //The group ID is correctly cased
|
||||||
switch (String.valueOf(m.group(1))) { //valueOf: Handles null
|
switch (String.valueOf(m.group(1))) { //valueOf: Handles null
|
||||||
case "Town":
|
case "Town":
|
||||||
TBMCChatAPI.SendSystemMessage(PluginMain.TownChat,
|
if (townChannel == null) return;
|
||||||
|
TBMCChatAPI.SendSystemMessage(townChannel,
|
||||||
new Channel.RecipientTestResult(TownyComponent.getTownNationIndex(groupID, false), groupID),
|
new Channel.RecipientTestResult(TownyComponent.getTownNationIndex(groupID, false), groupID),
|
||||||
logRecord.getMessage(), target, ChatProcessing.MCORIGIN);
|
logRecord.getMessage(), target, ChatProcessing.MCORIGIN);
|
||||||
break;
|
break;
|
||||||
case "Nation":
|
case "Nation":
|
||||||
TBMCChatAPI.SendSystemMessage(PluginMain.NationChat,
|
if (nationChannel == null) return;
|
||||||
|
TBMCChatAPI.SendSystemMessage(nationChannel,
|
||||||
new Channel.RecipientTestResult(TownyComponent.getTownNationIndex(groupID, true), groupID),
|
new Channel.RecipientTestResult(TownyComponent.getTownNationIndex(groupID, true), groupID),
|
||||||
logRecord.getMessage(), target, ChatProcessing.MCORIGIN);
|
logRecord.getMessage(), target, ChatProcessing.MCORIGIN);
|
||||||
break;
|
break;
|
||||||
|
@ -52,15 +53,21 @@ public class TownyAnnouncer {
|
||||||
};
|
};
|
||||||
|
|
||||||
private static TBMCSystemChatEvent.BroadcastTarget target;
|
private static TBMCSystemChatEvent.BroadcastTarget target;
|
||||||
|
private static Channel townChannel;
|
||||||
|
private static Channel nationChannel;
|
||||||
|
|
||||||
public static void setup() {
|
public static void setup(Channel townChannel, Channel nationChannel) {
|
||||||
target = TBMCSystemChatEvent.BroadcastTarget.add("towny");
|
target = TBMCSystemChatEvent.BroadcastTarget.add("towny");
|
||||||
|
TownyAnnouncer.townChannel = townChannel;
|
||||||
|
TownyAnnouncer.nationChannel = nationChannel;
|
||||||
TownyLogger.log.addHandler(HANDLER);
|
TownyLogger.log.addHandler(HANDLER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setdown() {
|
public static void setdown() {
|
||||||
TBMCSystemChatEvent.BroadcastTarget.remove(target);
|
TBMCSystemChatEvent.BroadcastTarget.remove(target);
|
||||||
target = null;
|
target = null;
|
||||||
|
TownyAnnouncer.townChannel = null;
|
||||||
|
TownyAnnouncer.nationChannel = null;
|
||||||
TownyLogger.log.removeHandler(HANDLER);
|
TownyLogger.log.removeHandler(HANDLER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package buttondevteam.chat.components.towny;
|
package buttondevteam.chat.components.towny;
|
||||||
|
|
||||||
import buttondevteam.chat.PluginMain;
|
import buttondevteam.chat.PluginMain;
|
||||||
|
import buttondevteam.chat.formatting.TellrawPart;
|
||||||
import buttondevteam.core.component.channel.Channel;
|
import buttondevteam.core.component.channel.Channel;
|
||||||
import buttondevteam.lib.architecture.Component;
|
import buttondevteam.lib.architecture.Component;
|
||||||
import buttondevteam.lib.chat.Color;
|
import buttondevteam.lib.chat.Color;
|
||||||
|
@ -17,6 +18,8 @@ import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class TownyComponent extends Component {
|
public class TownyComponent extends Component {
|
||||||
|
@ -24,16 +27,19 @@ public class TownyComponent extends Component {
|
||||||
private static ArrayList<String> Towns;
|
private static ArrayList<String> Towns;
|
||||||
private static ArrayList<String> Nations;
|
private static ArrayList<String> Nations;
|
||||||
|
|
||||||
|
private Channel TownChat;
|
||||||
|
private Channel NationChat;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void enable() {
|
protected void enable() {
|
||||||
TU = ((Towny) Bukkit.getPluginManager().getPlugin("Towny")).getTownyUniverse();
|
TU = ((Towny) Bukkit.getPluginManager().getPlugin("Towny")).getTownyUniverse();
|
||||||
Towns = TU.getTownsMap().values().stream().map(Town::getName).collect(Collectors.toCollection(ArrayList::new)); // Creates a snapshot of towns, new towns will be added when needed
|
Towns = TU.getTownsMap().values().stream().map(Town::getName).collect(Collectors.toCollection(ArrayList::new)); // Creates a snapshot of towns, new towns will be added when needed
|
||||||
Nations = TU.getNationsMap().values().stream().map(Nation::getName).collect(Collectors.toCollection(ArrayList::new)); // Same here but with nations
|
Nations = TU.getNationsMap().values().stream().map(Nation::getName).collect(Collectors.toCollection(ArrayList::new)); // Same here but with nations
|
||||||
TBMCChatAPI.RegisterChatChannel(
|
TBMCChatAPI.RegisterChatChannel(
|
||||||
PluginMain.TownChat = new Channel("§3TC§f", Color.DarkAqua, "tc", s -> checkTownNationChat(s, false)));
|
TownChat = new Channel("§3TC§f", Color.DarkAqua, "tc", s -> checkTownNationChat(s, false)));
|
||||||
TBMCChatAPI.RegisterChatChannel(
|
TBMCChatAPI.RegisterChatChannel(
|
||||||
PluginMain.NationChat = new Channel("§6NC§f", Color.Gold, "nc", s -> checkTownNationChat(s, true)));
|
NationChat = new Channel("§6NC§f", Color.Gold, "nc", s -> checkTownNationChat(s, true)));
|
||||||
TownyAnnouncer.setup();
|
TownyAnnouncer.setup(TownChat, NationChat);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -41,6 +47,14 @@ public class TownyComponent extends Component {
|
||||||
TownyAnnouncer.setdown();
|
TownyAnnouncer.setdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void handleSpies(Channel channel, TellrawPart json, Function<TellrawPart, String> toJson) {
|
||||||
|
if (channel.ID.equals(TownChat.ID) || channel.ID.equals(NationChat.ID)) {
|
||||||
|
((List<TellrawPart>) json.getExtra()).add(0, new TellrawPart("[SPY]"));
|
||||||
|
String jsonstr = toJson.apply(json);
|
||||||
|
Bukkit.getServer().dispatchCommand(PluginMain.Console, String.format(
|
||||||
|
"tellraw @a[score_%s=1000,score_%s_min=1000] %s", channel.ID, channel.ID, jsonstr));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the error message for the message sender if they can't send it and the score
|
* Return the error message for the message sender if they can't send it and the score
|
||||||
|
@ -49,13 +63,13 @@ public class TownyComponent extends Component {
|
||||||
if (!(sender instanceof Player))
|
if (!(sender instanceof Player))
|
||||||
return new Channel.RecipientTestResult("§cYou are not a player!");
|
return new Channel.RecipientTestResult("§cYou are not a player!");
|
||||||
Resident resident = TU.getResidentMap().get(sender.getName().toLowerCase());
|
Resident resident = TU.getResidentMap().get(sender.getName().toLowerCase());
|
||||||
Channel.RecipientTestResult result = checkTownNationChatInternal(sender, nationchat, resident);
|
Channel.RecipientTestResult result = checkTownNationChatInternal(nationchat, resident);
|
||||||
if (result.errormessage != null && resident != null && resident.getModes().contains("spy")) // Only use spy if they wouldn't see it
|
if (result.errormessage != null && resident != null && resident.getModes().contains("spy")) // Only use spy if they wouldn't see it
|
||||||
result = new Channel.RecipientTestResult(1000, "allspies"); // There won't be more than a thousand towns/nations probably
|
result = new Channel.RecipientTestResult(1000, "allspies"); // There won't be more than a thousand towns/nations probably
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Channel.RecipientTestResult checkTownNationChatInternal(CommandSender sender, boolean nationchat,
|
private static Channel.RecipientTestResult checkTownNationChatInternal(boolean nationchat,
|
||||||
Resident resident) {
|
Resident resident) {
|
||||||
try {
|
try {
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -22,8 +22,6 @@ import buttondevteam.lib.player.TBMCPlayer;
|
||||||
import buttondevteam.lib.player.TBMCPlayerGetInfoEvent;
|
import buttondevteam.lib.player.TBMCPlayerGetInfoEvent;
|
||||||
import com.google.common.collect.BiMap;
|
import com.google.common.collect.BiMap;
|
||||||
import com.google.common.collect.HashBiMap;
|
import com.google.common.collect.HashBiMap;
|
||||||
import com.vexsoftware.votifier.model.Vote;
|
|
||||||
import com.vexsoftware.votifier.model.VotifierEvent;
|
|
||||||
import lombok.val;
|
import lombok.val;
|
||||||
import net.ess3.api.events.NickChangeEvent;
|
import net.ess3.api.events.NickChangeEvent;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
@ -139,21 +137,6 @@ public class PlayerListener implements Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public void onVotifierEvent(VotifierEvent event) { //TODO: Move to teh Core eh
|
|
||||||
Vote vote = event.getVote();
|
|
||||||
PluginMain.Instance.getLogger().info("Vote: " + vote);
|
|
||||||
org.bukkit.OfflinePlayer op = Bukkit.getOfflinePlayer(vote.getUsername());
|
|
||||||
Player p = Bukkit.getPlayer(vote.getUsername());
|
|
||||||
if (op != null) {
|
|
||||||
PluginMain.economy.depositPlayer(op, 50.0);
|
|
||||||
}
|
|
||||||
if (p != null) {
|
|
||||||
p.sendMessage("§bThanks for voting! $50 was added to your account.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onConsoleCommand(ServerCommandEvent event) {
|
public void onConsoleCommand(ServerCommandEvent event) {
|
||||||
if (onCommandPreprocess(event.getSender(), event.getCommand()))
|
if (onCommandPreprocess(event.getSender(), event.getCommand()))
|
||||||
|
|
|
@ -33,13 +33,12 @@ commands:
|
||||||
author: NorbiPeti
|
author: NorbiPeti
|
||||||
depend:
|
depend:
|
||||||
- Essentials
|
- Essentials
|
||||||
- Towny
|
|
||||||
- Votifier
|
|
||||||
- Vault
|
- Vault
|
||||||
- ThorpeCore
|
- ThorpeCore
|
||||||
soft-depend:
|
soft-depend:
|
||||||
- Minigames
|
- Minigames
|
||||||
- Dynmap-Towny
|
- Dynmap-Towny
|
||||||
|
- Towny
|
||||||
permissions:
|
permissions:
|
||||||
tbmc.admin:
|
tbmc.admin:
|
||||||
description: Gives access to /un- commands and /u admin commands
|
description: Gives access to /un- commands and /u admin commands
|
||||||
|
|
Loading…
Reference in a new issue