Merge pull request #66 from TBMCPlugins/dev
Less error messages, channel and command changes applied
This commit is contained in:
commit
d4c016b495
33 changed files with 178 additions and 513 deletions
|
@ -2,10 +2,11 @@ package buttondevteam.chat;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
public class AnnouncerThread {
|
public class AnnouncerThread implements Runnable {
|
||||||
private static int AnnounceMessageIndex = 0;
|
private static int AnnounceMessageIndex = 0;
|
||||||
|
|
||||||
public static void Run() {
|
@Override
|
||||||
|
public void run() {
|
||||||
while (!PluginMain.Instance.stop) {
|
while (!PluginMain.Instance.stop) {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(PluginMain.AnnounceTime);
|
Thread.sleep(PluginMain.AnnounceTime);
|
||||||
|
|
|
@ -13,14 +13,10 @@ import org.bukkit.scoreboard.Objective;
|
||||||
import com.earth2me.essentials.Essentials;
|
import com.earth2me.essentials.Essentials;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
|
|
||||||
import com.palmergames.bukkit.towny.object.Nation;
|
|
||||||
import com.palmergames.bukkit.towny.object.Resident;
|
|
||||||
import com.palmergames.bukkit.towny.object.Town;
|
|
||||||
|
|
||||||
import buttondevteam.chat.commands.UnlolCommand;
|
import buttondevteam.chat.commands.UnlolCommand;
|
||||||
import buttondevteam.chat.commands.ucmds.admin.DebugCommand;
|
import buttondevteam.chat.commands.ucmds.admin.DebugCommand;
|
||||||
import buttondevteam.chat.formatting.*;
|
import buttondevteam.chat.formatting.*;
|
||||||
|
import buttondevteam.lib.TBMCChatEvent;
|
||||||
import buttondevteam.lib.TBMCCoreAPI;
|
import buttondevteam.lib.TBMCCoreAPI;
|
||||||
import buttondevteam.lib.chat.Channel;
|
import buttondevteam.lib.chat.Channel;
|
||||||
import buttondevteam.lib.chat.TellrawSerializableEnum;
|
import buttondevteam.lib.chat.TellrawSerializableEnum;
|
||||||
|
@ -82,8 +78,10 @@ public class ChatProcessing {
|
||||||
.registerTypeAdapter(boolean.class, new TellrawSerializer.TwBool()).disableHtmlEscaping().create();
|
.registerTypeAdapter(boolean.class, new TellrawSerializer.TwBool()).disableHtmlEscaping().create();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns e.setCancelled for custom event
|
public static boolean ProcessChat(TBMCChatEvent e) {
|
||||||
public static boolean ProcessChat(Channel channel, CommandSender sender, String message) {
|
Channel channel = e.getChannel();
|
||||||
|
CommandSender sender = e.getSender();
|
||||||
|
String message = e.getMessage();
|
||||||
long processstart = System.nanoTime();
|
long processstart = System.nanoTime();
|
||||||
if (PluginMain.essentials == null)
|
if (PluginMain.essentials == null)
|
||||||
PluginMain.essentials = (Essentials) (Bukkit.getPluginManager().getPlugin("Essentials"));
|
PluginMain.essentials = (Essentials) (Bukkit.getPluginManager().getPlugin("Essentials"));
|
||||||
|
@ -122,127 +120,22 @@ public class ChatProcessing {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
DebugCommand.SendDebugMessage(jsonstr);
|
DebugCommand.SendDebugMessage(jsonstr);
|
||||||
if (channel.equals(Channel.TownChat) || channel.equals(Channel.NationChat)) {
|
|
||||||
if (player == null) {
|
try {
|
||||||
sender.sendMessage("§cYou are not a player!");
|
if (channel.filteranderrormsg != null) {
|
||||||
return true;
|
Objective obj = PluginMain.SB.getObjective(channel.ID);
|
||||||
}
|
int score = -1;
|
||||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||||
try {
|
obj.getScore(p.getUniqueId().toString()).setScore(score = e.getMCScore(p));
|
||||||
Resident resident = PluginMain.Instance.TU.getResidentMap().get(p.getName().toLowerCase());
|
|
||||||
if (resident != null && !resident.getName().equals(player.getName())
|
|
||||||
&& resident.getModes().contains("spy"))
|
|
||||||
Bukkit.getPlayer(resident.getName()).sendMessage(String.format("[SPY-%s] - %s: %s",
|
|
||||||
channel.DisplayName, player.getDisplayName(), message));
|
|
||||||
} catch (Exception e) {
|
|
||||||
}
|
}
|
||||||
}
|
PluginMain.Instance.getServer().dispatchCommand(PluginMain.Console, String.format(
|
||||||
}
|
"tellraw @a[score_%s=%d,score_%s_min=%d] %s", channel.ID, score, channel.ID, score, jsonstr));
|
||||||
try {
|
|
||||||
if (channel.equals(Channel.TownChat)) {
|
|
||||||
Town town = null;
|
|
||||||
try {
|
|
||||||
final Resident resident = PluginMain.Instance.TU.getResidentMap()
|
|
||||||
.get(player.getName().toLowerCase());
|
|
||||||
if (resident != null && resident.hasTown())
|
|
||||||
town = resident.getTown();
|
|
||||||
} catch (NotRegisteredException e) {
|
|
||||||
}
|
|
||||||
if (town == null) {
|
|
||||||
player.sendMessage("§cYou aren't in a town or an error occured.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
int index = PluginMain.Instance.Towns.indexOf(town);
|
|
||||||
if (index < 0) {
|
|
||||||
PluginMain.Instance.Towns.add(town);
|
|
||||||
index = PluginMain.Instance.Towns.size() - 1;
|
|
||||||
}
|
|
||||||
Objective obj = PluginMain.SB.getObjective("town");
|
|
||||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
|
||||||
try {
|
|
||||||
if (town.getResidents().stream().anyMatch(r -> r.getName().equalsIgnoreCase(p.getName())))
|
|
||||||
obj.getScore(p.getName()).setScore(index);
|
|
||||||
else
|
|
||||||
obj.getScore(p.getName()).setScore(-1);
|
|
||||||
} catch (Exception e) {
|
|
||||||
obj.getScore(p.getName()).setScore(-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
PluginMain.Instance.getServer().dispatchCommand(PluginMain.Console,
|
|
||||||
String.format("tellraw @a[score_town=%d,score_town_min=%d] %s", index, index, jsonstr));
|
|
||||||
} else if (channel.equals(Channel.NationChat)) {
|
|
||||||
Town town = null;
|
|
||||||
try {
|
|
||||||
final Resident resident = PluginMain.Instance.TU.getResidentMap()
|
|
||||||
.get(player.getName().toLowerCase());
|
|
||||||
if (resident != null && resident.hasTown())
|
|
||||||
town = resident.getTown();
|
|
||||||
} catch (NotRegisteredException e) {
|
|
||||||
}
|
|
||||||
if (town == null) {
|
|
||||||
player.sendMessage("§cYou aren't in a town or an error occured.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
Nation nation = null;
|
|
||||||
try {
|
|
||||||
nation = town.getNation();
|
|
||||||
} catch (NotRegisteredException e) {
|
|
||||||
}
|
|
||||||
if (nation == null) {
|
|
||||||
player.sendMessage("§cYour town isn't in a nation or an error occured.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
int index = PluginMain.Instance.Nations.indexOf(nation);
|
|
||||||
if (index < 0) {
|
|
||||||
PluginMain.Instance.Nations.add(nation);
|
|
||||||
index = PluginMain.Instance.Nations.size() - 1;
|
|
||||||
}
|
|
||||||
Objective obj = PluginMain.SB.getObjective("nation");
|
|
||||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
|
||||||
try {
|
|
||||||
if (nation.getResidents().stream().anyMatch(r -> r.getName().equalsIgnoreCase(p.getName())))
|
|
||||||
obj.getScore(p.getName()).setScore(index);
|
|
||||||
else
|
|
||||||
obj.getScore(p.getName()).setScore(-1);
|
|
||||||
} catch (Exception e) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
PluginMain.Instance.getServer().dispatchCommand(PluginMain.Console,
|
|
||||||
String.format("tellraw @a[score_nation=%d,score_nation_min=%d] %s", index, index, jsonstr));
|
|
||||||
} else if (channel.equals(Channel.AdminChat)) {
|
|
||||||
if (player != null && !player.isOp()) {
|
|
||||||
player.sendMessage("§cYou need to be an OP to use this channel.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
Objective obj = PluginMain.SB.getObjective("admin");
|
|
||||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
|
||||||
if (p.isOp())
|
|
||||||
obj.getScore(p.getName()).setScore(1);
|
|
||||||
else
|
|
||||||
obj.getScore(p.getName()).setScore(0);
|
|
||||||
}
|
|
||||||
PluginMain.Instance.getServer().dispatchCommand(PluginMain.Console,
|
|
||||||
String.format("tellraw @a[score_admin=%d,score_admin_min=%d] %s", 1, 1, jsonstr));
|
|
||||||
} else if (channel.equals(Channel.ModChat)) {
|
|
||||||
if (player != null && !PluginMain.permission.playerInGroup(player, "mod")) {
|
|
||||||
player.sendMessage("§cYou need to be a mod to use this channel.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
Objective obj = PluginMain.SB.getObjective("mod");
|
|
||||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
|
||||||
if (PluginMain.permission.playerInGroup(p, "mod"))
|
|
||||||
obj.getScore(p.getName()).setScore(1);
|
|
||||||
else
|
|
||||||
obj.getScore(p.getName()).setScore(0);
|
|
||||||
}
|
|
||||||
PluginMain.Instance.getServer().dispatchCommand(PluginMain.Console,
|
|
||||||
String.format("tellraw @a[score_mod=%d,score_mod_min=%d] %s", 1, 1, jsonstr));
|
|
||||||
} else
|
} else
|
||||||
PluginMain.Instance.getServer().dispatchCommand(PluginMain.Console,
|
PluginMain.Instance.getServer().dispatchCommand(PluginMain.Console,
|
||||||
String.format("tellraw @a %s", jsonstr));
|
String.format("tellraw @a %s", jsonstr));
|
||||||
} catch (Exception e) {
|
} catch (Exception ex) {
|
||||||
TBMCCoreAPI.SendException("An error occured while sending a chat message!", e);
|
TBMCCoreAPI.SendException("An error occured while sending a chat message!", ex);
|
||||||
player.sendMessage("§cAn error occured while sending the message.");
|
sender.sendMessage("§cAn error occured while sending the message.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
PluginMain.Instance.getServer().getConsoleSender().sendMessage(String.format("%s <%s> %s", channelidentifier,
|
PluginMain.Instance.getServer().getConsoleSender().sendMessage(String.format("%s <%s> %s", channelidentifier,
|
||||||
|
|
|
@ -5,6 +5,7 @@ import net.milkbowl.vault.economy.Economy;
|
||||||
import net.milkbowl.vault.permission.Permission;
|
import net.milkbowl.vault.permission.Permission;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.ConsoleCommandSender;
|
import org.bukkit.command.ConsoleCommandSender;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -17,7 +18,10 @@ import org.htmlcleaner.TagNode;
|
||||||
import buttondevteam.chat.commands.YeehawCommand;
|
import buttondevteam.chat.commands.YeehawCommand;
|
||||||
import buttondevteam.chat.listener.PlayerListener;
|
import buttondevteam.chat.listener.PlayerListener;
|
||||||
import buttondevteam.lib.TBMCCoreAPI;
|
import buttondevteam.lib.TBMCCoreAPI;
|
||||||
|
import buttondevteam.lib.chat.Channel;
|
||||||
|
import buttondevteam.lib.chat.Color;
|
||||||
import buttondevteam.lib.chat.TBMCChatAPI;
|
import buttondevteam.lib.chat.TBMCChatAPI;
|
||||||
|
import buttondevteam.lib.chat.Channel.RecipientTestResult;
|
||||||
import buttondevteam.lib.player.TBMCPlayerBase;
|
import buttondevteam.lib.player.TBMCPlayerBase;
|
||||||
|
|
||||||
import com.earth2me.essentials.Essentials;
|
import com.earth2me.essentials.Essentials;
|
||||||
|
@ -25,7 +29,9 @@ import com.google.gson.JsonArray;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.JsonParser;
|
import com.google.gson.JsonParser;
|
||||||
import com.palmergames.bukkit.towny.Towny;
|
import com.palmergames.bukkit.towny.Towny;
|
||||||
|
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
|
||||||
import com.palmergames.bukkit.towny.object.Nation;
|
import com.palmergames.bukkit.towny.object.Nation;
|
||||||
|
import com.palmergames.bukkit.towny.object.Resident;
|
||||||
import com.palmergames.bukkit.towny.object.Town;
|
import com.palmergames.bukkit.towny.object.Town;
|
||||||
import com.palmergames.bukkit.towny.object.TownyUniverse;
|
import com.palmergames.bukkit.towny.object.TownyUniverse;
|
||||||
|
|
||||||
|
@ -34,6 +40,7 @@ import java.lang.String;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLConnection;
|
import java.net.URLConnection;
|
||||||
|
import java.net.UnknownHostException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
@ -47,11 +54,16 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
|
||||||
// https://www.reddit.com/r/thebutton/comments/31c32v/i_pressed_the_button_without_really_thinking/
|
// https://www.reddit.com/r/thebutton/comments/31c32v/i_pressed_the_button_without_really_thinking/
|
||||||
public static PluginMain Instance;
|
public static PluginMain Instance;
|
||||||
public static ConsoleCommandSender Console;
|
public static ConsoleCommandSender Console;
|
||||||
public static Scoreboard SB;
|
|
||||||
public final static String FlairThreadURL = "https://www.reddit.com/r/Chromagamers/comments/51ys94/flair_thread_for_the_mc_server/";
|
public final static String FlairThreadURL = "https://www.reddit.com/r/Chromagamers/comments/51ys94/flair_thread_for_the_mc_server/";
|
||||||
public TownyUniverse TU;
|
|
||||||
public ArrayList<Town> Towns;
|
public static Scoreboard SB;
|
||||||
public ArrayList<Nation> Nations;
|
public static TownyUniverse TU;
|
||||||
|
public static ArrayList<Town> Towns;
|
||||||
|
public static ArrayList<Nation> Nations;
|
||||||
|
|
||||||
|
public static Channel TownChat;
|
||||||
|
public static Channel NationChat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* This variable is used as a cache for flair state checking when reading the flair thread.
|
* This variable is used as a cache for flair state checking when reading the flair thread.
|
||||||
|
@ -72,37 +84,22 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
|
||||||
Console = this.getServer().getConsoleSender();
|
Console = this.getServer().getConsoleSender();
|
||||||
LoadFiles();
|
LoadFiles();
|
||||||
|
|
||||||
SB = PluginMain.Instance.getServer().getScoreboardManager().getMainScoreboard(); // Main can be detected with @a[score_...]
|
SB = getServer().getScoreboardManager().getMainScoreboard(); // Main can be detected with @a[score_...]
|
||||||
if (SB.getObjective("town") == null)
|
|
||||||
SB.registerNewObjective("town", "dummy");
|
|
||||||
if (SB.getObjective("nation") == null)
|
|
||||||
SB.registerNewObjective("nation", "dummy");
|
|
||||||
if (SB.getObjective("admin") == null)
|
|
||||||
SB.registerNewObjective("admin", "dummy");
|
|
||||||
if (SB.getObjective("mod") == null)
|
|
||||||
SB.registerNewObjective("mod", "dummy");
|
|
||||||
TU = ((Towny) Bukkit.getPluginManager().getPlugin("Towny")).getTownyUniverse();
|
TU = ((Towny) Bukkit.getPluginManager().getPlugin("Towny")).getTownyUniverse();
|
||||||
Towns = new ArrayList<Town>(TU.getTownsMap().values());
|
Towns = new ArrayList<Town>(TU.getTownsMap().values()); // Creates a snapshot of towns, new towns will be added when needed
|
||||||
Nations = new ArrayList<Nation>(TU.getNationsMap().values());
|
Nations = new ArrayList<Nation>(TU.getNationsMap().values()); // Same here but with nations
|
||||||
|
|
||||||
|
TBMCChatAPI.RegisterChatChannel(
|
||||||
|
TownChat = new Channel("§3TC§f", Color.DarkAqua, "tc", s -> checkTownNationChat(s, false)));
|
||||||
|
TBMCChatAPI.RegisterChatChannel(
|
||||||
|
NationChat = new Channel("§6NC§f", Color.Gold, "nc", s -> checkTownNationChat(s, true)));
|
||||||
|
|
||||||
setupChat();
|
setupChat();
|
||||||
setupEconomy();
|
setupEconomy();
|
||||||
setupPermissions();
|
setupPermissions();
|
||||||
|
|
||||||
Runnable r = new Runnable() {
|
new Thread(() -> FlairGetterThreadMethod()).start();
|
||||||
public void run() {
|
new Thread(new AnnouncerThread()).start();
|
||||||
FlairGetterThreadMethod();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Thread t = new Thread(r);
|
|
||||||
t.start();
|
|
||||||
r = new Runnable() {
|
|
||||||
public void run() {
|
|
||||||
AnnouncerThread.Run();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
t = new Thread(r);
|
|
||||||
t.start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean stop = false;
|
public Boolean stop = false;
|
||||||
|
@ -153,10 +150,14 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
|
||||||
}
|
}
|
||||||
PlayersWithFlairs.add(ign); // Don't redownload even if flair isn't accepted
|
PlayersWithFlairs.add(ign); // Don't redownload even if flair isn't accepted
|
||||||
}
|
}
|
||||||
try {
|
}
|
||||||
Thread.sleep(10);
|
} catch (Exception e) {
|
||||||
} catch (InterruptedException ex) {
|
errorcount++;
|
||||||
Thread.currentThread().interrupt();
|
if (errorcount >= 10) {
|
||||||
|
errorcount = 0;
|
||||||
|
if (!e.getMessage().contains("Server returned HTTP response code")
|
||||||
|
&& !(e instanceof UnknownHostException))
|
||||||
|
TBMCCoreAPI.SendException("Error while getting flairs from Reddit!", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@ -164,13 +165,6 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
|
||||||
} catch (InterruptedException ex) {
|
} catch (InterruptedException ex) {
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
|
||||||
errorcount++;
|
|
||||||
if (errorcount >= 10) {
|
|
||||||
errorcount = 0;
|
|
||||||
TBMCCoreAPI.SendException("Error while getting flairs from Reddit!", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,4 +317,47 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
|
||||||
|
|
||||||
return (economy != null);
|
return (economy != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the error message for the message sender if they can't send it and the score
|
||||||
|
*/
|
||||||
|
private static RecipientTestResult checkTownNationChat(CommandSender sender, boolean nationchat) {
|
||||||
|
if (!(sender instanceof Player))
|
||||||
|
return new RecipientTestResult("§cYou are not a player!");
|
||||||
|
try {
|
||||||
|
Resident resident = PluginMain.TU.getResidentMap().get(sender.getName().toLowerCase());
|
||||||
|
if (resident != null && resident.getModes().contains("spy"))
|
||||||
|
return null;
|
||||||
|
/*
|
||||||
|
* p.sendMessage(String.format("[SPY-%s] - %s: %s", channel.DisplayName, ((Player) sender).getDisplayName(), message));
|
||||||
|
*/
|
||||||
|
Town town = null;
|
||||||
|
if (resident != null && resident.hasTown())
|
||||||
|
town = resident.getTown();
|
||||||
|
if (town == null)
|
||||||
|
return new RecipientTestResult("You aren't in a town.");
|
||||||
|
Nation nation = null;
|
||||||
|
int index = -1;
|
||||||
|
if (nationchat) {
|
||||||
|
if (town.hasNation())
|
||||||
|
nation = town.getNation();
|
||||||
|
if (nation == null)
|
||||||
|
return new RecipientTestResult("Your town isn't in a nation.");
|
||||||
|
index = PluginMain.Nations.indexOf(nation);
|
||||||
|
if (index < 0) {
|
||||||
|
PluginMain.Nations.add(nation);
|
||||||
|
index = PluginMain.Nations.size() - 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
index = PluginMain.Towns.indexOf(town);
|
||||||
|
if (index < 0) {
|
||||||
|
PluginMain.Towns.add(town);
|
||||||
|
index = PluginMain.Towns.size() - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new RecipientTestResult(index);
|
||||||
|
} catch (NotRegisteredException e) {
|
||||||
|
return new RecipientTestResult("You (probably) aren't knwon by Towny! (Not in a town)");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
package buttondevteam.chat.commands;
|
package buttondevteam.chat.commands;
|
||||||
|
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import buttondevteam.chat.ChatPlayer;
|
import buttondevteam.chat.ChatPlayer;
|
||||||
import buttondevteam.lib.chat.TBMCCommandBase;
|
import buttondevteam.lib.chat.CommandClass;
|
||||||
|
import buttondevteam.lib.chat.PlayerCommandBase;
|
||||||
import buttondevteam.lib.player.TBMCPlayer;
|
import buttondevteam.lib.player.TBMCPlayer;
|
||||||
|
|
||||||
public final class ChatonlyCommand extends TBMCCommandBase {
|
@CommandClass(modOnly = false)
|
||||||
|
public final class ChatonlyCommand extends PlayerCommandBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] GetHelpText(String alias) {
|
public String[] GetHelpText(String alias) {
|
||||||
|
@ -20,8 +21,7 @@ public final class ChatonlyCommand extends TBMCCommandBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
public boolean OnCommand(Player player, String alias, String[] args) {
|
||||||
Player player = (Player) sender;
|
|
||||||
ChatPlayer p = TBMCPlayer.getPlayer(player.getUniqueId(), ChatPlayer.class);
|
ChatPlayer p = TBMCPlayer.getPlayer(player.getUniqueId(), ChatPlayer.class);
|
||||||
p.ChatOnly = true;
|
p.ChatOnly = true;
|
||||||
player.setGameMode(GameMode.SPECTATOR);
|
player.setGameMode(GameMode.SPECTATOR);
|
||||||
|
@ -29,19 +29,4 @@ public final class ChatonlyCommand extends TBMCCommandBase {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String GetCommandPath() {
|
|
||||||
return "chatonly";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean GetPlayerOnly() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean GetModOnly() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,10 @@ import java.net.URLEncoder;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import buttondevteam.lib.chat.CommandClass;
|
||||||
import buttondevteam.lib.chat.TBMCCommandBase;
|
import buttondevteam.lib.chat.TBMCCommandBase;
|
||||||
|
|
||||||
|
@CommandClass(modOnly = false)
|
||||||
public class MWikiCommand extends TBMCCommandBase {
|
public class MWikiCommand extends TBMCCommandBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -37,19 +39,4 @@ public class MWikiCommand extends TBMCCommandBase {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String GetCommandPath() {
|
|
||||||
return "mwiki";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean GetPlayerOnly() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean GetModOnly() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
package buttondevteam.chat.commands;
|
package buttondevteam.chat.commands;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import buttondevteam.chat.ChatPlayer;
|
import buttondevteam.chat.ChatPlayer;
|
||||||
import buttondevteam.lib.chat.TBMCCommandBase;
|
import buttondevteam.lib.chat.CommandClass;
|
||||||
|
import buttondevteam.lib.chat.PlayerCommandBase;
|
||||||
import buttondevteam.lib.player.TBMCPlayer;
|
import buttondevteam.lib.player.TBMCPlayer;
|
||||||
|
|
||||||
public final class OOCCommand extends TBMCCommandBase {
|
@CommandClass(modOnly = false)
|
||||||
|
public final class OOCCommand extends PlayerCommandBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] GetHelpText(String alias) {
|
public String[] GetHelpText(String alias) {
|
||||||
|
@ -17,8 +18,7 @@ public final class OOCCommand extends TBMCCommandBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
public boolean OnCommand(Player player, String alias, String[] args) {
|
||||||
Player player = (Player) sender;
|
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
@ -33,19 +33,4 @@ public final class OOCCommand extends TBMCCommandBase {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String GetCommandPath() {
|
|
||||||
return "ooc";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean GetPlayerOnly() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean GetModOnly() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,10 @@ import org.bukkit.entity.Player;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
import buttondevteam.lib.chat.CommandClass;
|
||||||
import buttondevteam.lib.chat.TBMCCommandBase;
|
import buttondevteam.lib.chat.TBMCCommandBase;
|
||||||
|
|
||||||
|
@CommandClass(modOnly = false)
|
||||||
public final class UnlolCommand extends TBMCCommandBase {
|
public final class UnlolCommand extends TBMCCommandBase {
|
||||||
|
|
||||||
public static CommandSender Lastlol = null;
|
public static CommandSender Lastlol = null;
|
||||||
|
@ -26,7 +28,7 @@ public final class UnlolCommand extends TBMCCommandBase {
|
||||||
if (Lastlol != null) {
|
if (Lastlol != null) {
|
||||||
if (Lastlol instanceof Player)
|
if (Lastlol instanceof Player)
|
||||||
((Player) Lastlol)
|
((Player) Lastlol)
|
||||||
.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 10 * 20, 5, false, false));
|
.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 2 * 20, 5, false, false));
|
||||||
String msg = (sender instanceof Player ? ((Player) sender).getDisplayName() : sender.getName())
|
String msg = (sender instanceof Player ? ((Player) sender).getDisplayName() : sender.getName())
|
||||||
+ (Lastlolornot ? " unlolled " : " unlaughed ")
|
+ (Lastlolornot ? " unlolled " : " unlaughed ")
|
||||||
+ (Lastlol instanceof Player ? ((Player) Lastlol).getDisplayName() : Lastlol.getName());
|
+ (Lastlol instanceof Player ? ((Player) Lastlol).getDisplayName() : Lastlol.getName());
|
||||||
|
@ -35,19 +37,4 @@ public final class UnlolCommand extends TBMCCommandBase {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String GetCommandPath() {
|
|
||||||
return "unlol";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean GetPlayerOnly() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean GetModOnly() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,20 +4,26 @@ import java.util.Arrays;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.command.ConsoleCommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import buttondevteam.chat.ChatPlayer;
|
import buttondevteam.chat.ChatPlayer;
|
||||||
|
import buttondevteam.chat.listener.PlayerListener;
|
||||||
import buttondevteam.lib.chat.Channel;
|
import buttondevteam.lib.chat.Channel;
|
||||||
|
import buttondevteam.lib.chat.CommandClass;
|
||||||
import buttondevteam.lib.chat.TBMCChatAPI;
|
import buttondevteam.lib.chat.TBMCChatAPI;
|
||||||
import buttondevteam.lib.chat.TBMCCommandBase;
|
import buttondevteam.lib.chat.TBMCCommandBase;
|
||||||
import buttondevteam.lib.player.TBMCPlayer;
|
import buttondevteam.lib.player.TBMCPlayer;
|
||||||
|
|
||||||
|
@CommandClass(modOnly = false)
|
||||||
public class WaitWhatCommand extends TBMCCommandBase {
|
public class WaitWhatCommand extends TBMCCommandBase {
|
||||||
@Override
|
@Override
|
||||||
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
||||||
Channel channel;
|
Channel channel;
|
||||||
if (sender instanceof Player && ((Player) sender).isOnline())
|
if (sender instanceof Player && ((Player) sender).isOnline())
|
||||||
channel = TBMCPlayer.getPlayer(((Player) sender).getUniqueId(), ChatPlayer.class).CurrentChannel;
|
channel = TBMCPlayer.getPlayer(((Player) sender).getUniqueId(), ChatPlayer.class).CurrentChannel;
|
||||||
|
else if (sender instanceof ConsoleCommandSender)
|
||||||
|
channel = PlayerListener.ConsoleChannel;
|
||||||
else
|
else
|
||||||
channel = Channel.GlobalChat;
|
channel = Channel.GlobalChat;
|
||||||
final String message;
|
final String message;
|
||||||
|
@ -36,14 +42,4 @@ public class WaitWhatCommand extends TBMCCommandBase {
|
||||||
"Wait what" //
|
"Wait what" //
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean GetPlayerOnly() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean GetModOnly() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,11 @@ import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import buttondevteam.lib.chat.CommandClass;
|
||||||
import buttondevteam.lib.chat.TBMCCommandBase;
|
import buttondevteam.lib.chat.TBMCCommandBase;
|
||||||
import buttondevteam.lib.player.TBMCYEEHAWEvent;
|
import buttondevteam.lib.player.TBMCYEEHAWEvent;
|
||||||
|
|
||||||
|
@CommandClass(modOnly = false)
|
||||||
public class YeehawCommand extends TBMCCommandBase {
|
public class YeehawCommand extends TBMCCommandBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -26,19 +28,4 @@ public class YeehawCommand extends TBMCCommandBase {
|
||||||
Bukkit.getPluginManager().callEvent(new TBMCYEEHAWEvent(sender));
|
Bukkit.getPluginManager().callEvent(new TBMCYEEHAWEvent(sender));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String GetCommandPath() {
|
|
||||||
return "yeehaw";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean GetPlayerOnly() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean GetModOnly() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,10 +6,12 @@ import org.bukkit.entity.Player;
|
||||||
import buttondevteam.chat.ChatPlayer;
|
import buttondevteam.chat.ChatPlayer;
|
||||||
import buttondevteam.chat.listener.PlayerListener;
|
import buttondevteam.chat.listener.PlayerListener;
|
||||||
import buttondevteam.lib.chat.Channel;
|
import buttondevteam.lib.chat.Channel;
|
||||||
|
import buttondevteam.lib.chat.CommandClass;
|
||||||
import buttondevteam.lib.chat.TBMCChatAPI;
|
import buttondevteam.lib.chat.TBMCChatAPI;
|
||||||
import buttondevteam.lib.chat.TBMCCommandBase;
|
import buttondevteam.lib.chat.TBMCCommandBase;
|
||||||
import buttondevteam.lib.player.TBMCPlayer;
|
import buttondevteam.lib.player.TBMCPlayer;
|
||||||
|
|
||||||
|
@CommandClass(modOnly = false, excludeFromPath = true)
|
||||||
public abstract class AppendTextCommandBase extends TBMCCommandBase {
|
public abstract class AppendTextCommandBase extends TBMCCommandBase {
|
||||||
|
|
||||||
public abstract String[] GetHelpText(String alias);
|
public abstract String[] GetHelpText(String alias);
|
||||||
|
@ -31,14 +33,4 @@ public abstract class AppendTextCommandBase extends TBMCCommandBase {
|
||||||
TBMCChatAPI.SendChatMessage(Channel.GlobalChat, sender, msg);
|
TBMCChatAPI.SendChatMessage(Channel.GlobalChat, sender, msg);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean GetPlayerOnly() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean GetModOnly() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,10 @@ public final class ShrugCommand extends AppendTextCommandBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] GetHelpText(String alias) {
|
public String[] GetHelpText(String alias) {
|
||||||
return new String[] { "§6---- Shrug ----",
|
return new String[] { "§6---- Shrug ----", //
|
||||||
"This command appends a shrug after your message",
|
"This command appends a shrug after your message", //
|
||||||
"Or just makes you shrug",
|
"Or just makes you shrug", //
|
||||||
"Use either /" + alias + " <message> or just /" + alias };
|
"Use either /" + alias + " <message> or just /" + alias }; //
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -15,9 +15,4 @@ public final class ShrugCommand extends AppendTextCommandBase {
|
||||||
return "¯\\\\\\_(ツ)\\_/¯";
|
return "¯\\\\\\_(ツ)\\_/¯";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String GetCommandPath() {
|
|
||||||
return "shrug";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@ public final class TableflipCommand extends AppendTextCommandBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] GetHelpText(String alias) {
|
public String[] GetHelpText(String alias) {
|
||||||
return new String[] { "§6---- Tableflip ----",
|
return new String[] { "§6---- Tableflip ----", //
|
||||||
"This command appends a tableflip after your message",
|
"This command appends a tableflip after your message", //
|
||||||
"Or just makes you tableflip",
|
"Or just makes you tableflip", //
|
||||||
"Use either /" + alias + " <message> or just /" + alias };
|
"Use either /" + alias + " <message> or just /" + alias };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,9 +14,4 @@ public final class TableflipCommand extends AppendTextCommandBase {
|
||||||
public String GetAppendedText() {
|
public String GetAppendedText() {
|
||||||
return "(╯°□°)╯︵ ┻━┻";
|
return "(╯°□°)╯︵ ┻━┻";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String GetCommandPath() {
|
|
||||||
return "tableflip";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@ public final class UnflipCommand extends AppendTextCommandBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] GetHelpText(String alias) {
|
public String[] GetHelpText(String alias) {
|
||||||
return new String[] { "§6---- Unflip ----",
|
return new String[] { "§6---- Unflip ----", //
|
||||||
"This command appends an unflip after your message",
|
"This command appends an unflip after your message", //
|
||||||
"Or just unflips as you",
|
"Or just unflips as you", //
|
||||||
"Use either /" + alias + " <message> or just /" + alias };
|
"Use either /" + alias + " <message> or just /" + alias };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,9 +15,4 @@ public final class UnflipCommand extends AppendTextCommandBase {
|
||||||
return "┬─┬ ノ( ゜-゜ノ)";
|
return "┬─┬ ノ( ゜-゜ノ)";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String GetCommandPath() {
|
|
||||||
return "unflip";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,12 @@ import buttondevteam.chat.FlairStates;
|
||||||
import buttondevteam.chat.PlayerJoinTimerTask;
|
import buttondevteam.chat.PlayerJoinTimerTask;
|
||||||
import buttondevteam.chat.PluginMain;
|
import buttondevteam.chat.PluginMain;
|
||||||
import buttondevteam.lib.TBMCCoreAPI;
|
import buttondevteam.lib.TBMCCoreAPI;
|
||||||
|
import buttondevteam.lib.chat.CommandClass;
|
||||||
|
import buttondevteam.lib.chat.OptionallyPlayerCommandClass;
|
||||||
import buttondevteam.lib.player.TBMCPlayer;
|
import buttondevteam.lib.player.TBMCPlayer;
|
||||||
|
|
||||||
|
@CommandClass(modOnly = false)
|
||||||
|
@OptionallyPlayerCommandClass(playerOnly = true)
|
||||||
public class AcceptCommand extends UCommandBase {
|
public class AcceptCommand extends UCommandBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -92,9 +96,4 @@ public class AcceptCommand extends UCommandBase {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String GetUCommandPath() {
|
|
||||||
return "accept";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,8 @@ import buttondevteam.chat.PluginMain;
|
||||||
import buttondevteam.lib.chat.*;
|
import buttondevteam.lib.chat.*;
|
||||||
import buttondevteam.lib.player.TBMCPlayer;
|
import buttondevteam.lib.player.TBMCPlayer;
|
||||||
|
|
||||||
|
@CommandClass(modOnly = false)
|
||||||
|
@OptionallyPlayerCommandClass(playerOnly = true)
|
||||||
public class CCommand extends UCommandBase {
|
public class CCommand extends UCommandBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -54,9 +56,4 @@ public class CCommand extends UCommandBase {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String GetUCommandPath() {
|
|
||||||
return "c";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,11 @@ import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import buttondevteam.chat.PluginMain;
|
import buttondevteam.chat.PluginMain;
|
||||||
|
import buttondevteam.lib.chat.CommandClass;
|
||||||
import buttondevteam.lib.chat.TBMCChatAPI;
|
import buttondevteam.lib.chat.TBMCChatAPI;
|
||||||
import buttondevteam.lib.chat.TBMCCommandBase;
|
import buttondevteam.lib.chat.TBMCCommandBase;
|
||||||
|
|
||||||
|
@CommandClass(modOnly = false)
|
||||||
public final class HelpCommand extends UCommandBase {
|
public final class HelpCommand extends UCommandBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -35,8 +37,8 @@ public final class HelpCommand extends UCommandBase {
|
||||||
ArrayList<String> text = new ArrayList<String>();
|
ArrayList<String> text = new ArrayList<String>();
|
||||||
text.add("§6---- Command list ----");
|
text.add("§6---- Command list ----");
|
||||||
for (TBMCCommandBase cmd : TBMCChatAPI.GetCommands().values())
|
for (TBMCCommandBase cmd : TBMCChatAPI.GetCommands().values())
|
||||||
if (!cmd.GetModOnly() || PluginMain.permission.has(sender, "tbmc.admin"))
|
if (!cmd.getClass().getAnnotation(CommandClass.class).modOnly() || PluginMain.permission.has(sender, "tbmc.admin"))
|
||||||
if (!cmd.GetPlayerOnly() || sender instanceof Player)
|
if (!cmd.isPlayerOnly() || sender instanceof Player)
|
||||||
if (!cmd.GetCommandPath().contains(" "))
|
if (!cmd.GetCommandPath().contains(" "))
|
||||||
text.add("/" + cmd.GetCommandPath());
|
text.add("/" + cmd.GetCommandPath());
|
||||||
else {
|
else {
|
||||||
|
@ -79,14 +81,4 @@ public final class HelpCommand extends UCommandBase {
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String GetUCommandPath() {
|
|
||||||
return "help";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean GetPlayerOnly() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,12 @@ import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import buttondevteam.chat.ChatPlayer;
|
import buttondevteam.chat.ChatPlayer;
|
||||||
import buttondevteam.chat.FlairStates;
|
import buttondevteam.chat.FlairStates;
|
||||||
|
import buttondevteam.lib.chat.CommandClass;
|
||||||
|
import buttondevteam.lib.chat.OptionallyPlayerCommandClass;
|
||||||
import buttondevteam.lib.player.TBMCPlayer;
|
import buttondevteam.lib.player.TBMCPlayer;
|
||||||
|
|
||||||
|
@CommandClass(modOnly = false)
|
||||||
|
@OptionallyPlayerCommandClass(playerOnly = true)
|
||||||
public final class IgnoreCommand extends UCommandBase {
|
public final class IgnoreCommand extends UCommandBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -38,9 +42,4 @@ public final class IgnoreCommand extends UCommandBase {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String GetUCommandPath() {
|
|
||||||
return "ignore";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,10 +3,12 @@ package buttondevteam.chat.commands.ucmds;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import buttondevteam.lib.TBMCCoreAPI;
|
import buttondevteam.lib.TBMCCoreAPI;
|
||||||
|
import buttondevteam.lib.chat.CommandClass;
|
||||||
import buttondevteam.lib.player.TBMCPlayer;
|
import buttondevteam.lib.player.TBMCPlayer;
|
||||||
import buttondevteam.lib.player.ChromaGamerBase.InfoTarget;
|
import buttondevteam.lib.player.ChromaGamerBase.InfoTarget;
|
||||||
import buttondevteam.lib.player.TBMCPlayerBase;
|
import buttondevteam.lib.player.TBMCPlayerBase;
|
||||||
|
|
||||||
|
@CommandClass(modOnly = false)
|
||||||
public class InfoCommand extends UCommandBase {
|
public class InfoCommand extends UCommandBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -18,11 +20,6 @@ public class InfoCommand extends UCommandBase {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String GetUCommandPath() {
|
|
||||||
return "info";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
||||||
if (args.length == 0)
|
if (args.length == 0)
|
||||||
|
@ -44,9 +41,4 @@ public class InfoCommand extends UCommandBase {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean GetPlayerOnly() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,9 @@ package buttondevteam.chat.commands.ucmds;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import buttondevteam.lib.chat.CommandClass;
|
||||||
|
|
||||||
|
@CommandClass(modOnly = false)
|
||||||
public class OpmeCommand extends UCommandBase {
|
public class OpmeCommand extends UCommandBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -15,9 +18,4 @@ public class OpmeCommand extends UCommandBase {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String GetUCommandPath() {
|
|
||||||
return "opme";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +1,13 @@
|
||||||
package buttondevteam.chat.commands.ucmds;
|
package buttondevteam.chat.commands.ucmds;
|
||||||
|
|
||||||
import buttondevteam.lib.chat.TBMCCommandBase;
|
import buttondevteam.lib.chat.CommandClass;
|
||||||
|
import buttondevteam.lib.chat.OptionallyPlayerCommandBase;
|
||||||
|
import buttondevteam.lib.chat.OptionallyPlayerCommandClass;
|
||||||
|
|
||||||
public abstract class UCommandBase extends TBMCCommandBase {
|
@CommandClass(modOnly = false, path = "u")
|
||||||
|
@OptionallyPlayerCommandClass(playerOnly = false)
|
||||||
|
public abstract class UCommandBase extends OptionallyPlayerCommandBase {
|
||||||
|
|
||||||
public abstract String[] GetHelpText(String alias);
|
public abstract String[] GetHelpText(String alias);
|
||||||
|
|
||||||
@Override
|
|
||||||
public String GetCommandPath() {
|
|
||||||
return "u " + GetUCommandPath();
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract String GetUCommandPath();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean GetPlayerOnly() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean GetModOnly() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +1,11 @@
|
||||||
package buttondevteam.chat.commands.ucmds.admin;
|
package buttondevteam.chat.commands.ucmds.admin;
|
||||||
|
|
||||||
import buttondevteam.chat.commands.ucmds.UCommandBase;
|
import buttondevteam.chat.commands.ucmds.UCommandBase;
|
||||||
|
import buttondevteam.lib.chat.CommandClass;
|
||||||
|
|
||||||
|
@CommandClass(modOnly = true)
|
||||||
public abstract class AdminCommandBase extends UCommandBase {
|
public abstract class AdminCommandBase extends UCommandBase {
|
||||||
|
|
||||||
public abstract String[] GetHelpText(String alias);
|
public abstract String[] GetHelpText(String alias);
|
||||||
|
|
||||||
@Override
|
|
||||||
public String GetUCommandPath() {
|
|
||||||
return "admin " + GetAdminCommandPath();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean GetPlayerOnly() {
|
|
||||||
return false; // Allow admin commands in console
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract String GetAdminCommandPath();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean GetModOnly() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,11 +13,6 @@ public class DebugCommand extends AdminCommandBase {
|
||||||
"Toggles debug mode, which prints debug messages to the console." };
|
"Toggles debug mode, which prints debug messages to the console." };
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String GetAdminCommandPath() {
|
|
||||||
return "debug";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
||||||
sender.sendMessage("§eDebug mode " + ((DebugMode = !DebugMode) ? "§aenabled." : "§cdisabled."));
|
sender.sendMessage("§eDebug mode " + ((DebugMode = !DebugMode) ? "§aenabled." : "§cdisabled."));
|
||||||
|
|
|
@ -40,9 +40,4 @@ public class PlayerInfoCommand extends AdminCommandBase {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String GetAdminCommandPath() {
|
|
||||||
return "playerinfo";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,9 +20,4 @@ public class SaveCommand extends AdminCommandBase {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String GetAdminCommandPath() {
|
|
||||||
return "save";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,9 +68,4 @@ public class SetFlairCommand extends AdminCommandBase {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String GetAdminCommandPath() {
|
|
||||||
return "setflair";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,9 +39,4 @@ public class UpdatePlugin extends AdminCommandBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String GetAdminCommandPath() {
|
|
||||||
return "updateplugin";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,9 +34,4 @@ public class AddCommand extends AnnounceCommandBase {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String GetAnnounceCommandPath() {
|
|
||||||
return "add";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +1,13 @@
|
||||||
package buttondevteam.chat.commands.ucmds.announce;
|
package buttondevteam.chat.commands.ucmds.announce;
|
||||||
|
|
||||||
import buttondevteam.chat.commands.ucmds.UCommandBase;
|
import buttondevteam.chat.commands.ucmds.UCommandBase;
|
||||||
|
import buttondevteam.lib.chat.CommandClass;
|
||||||
|
import buttondevteam.lib.chat.OptionallyPlayerCommandClass;
|
||||||
|
|
||||||
|
@CommandClass(modOnly = true)
|
||||||
|
@OptionallyPlayerCommandClass(playerOnly = false)
|
||||||
public abstract class AnnounceCommandBase extends UCommandBase {
|
public abstract class AnnounceCommandBase extends UCommandBase {
|
||||||
|
|
||||||
public abstract String[] GetHelpText(String alias);
|
public abstract String[] GetHelpText(String alias);
|
||||||
|
|
||||||
@Override
|
|
||||||
public String GetUCommandPath() {
|
|
||||||
return "announce " + GetAnnounceCommandPath();
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract String GetAnnounceCommandPath();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean GetPlayerOnly() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean GetModOnly() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,9 +42,4 @@ public class EditCommand extends AnnounceCommandBase {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String GetAnnounceCommandPath() {
|
|
||||||
return "edit";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,9 +25,4 @@ public class ListCommand extends AnnounceCommandBase {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String GetAnnounceCommandPath() {
|
|
||||||
return "list";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,9 +27,4 @@ public class RemoveCommand extends AnnounceCommandBase {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String GetAnnounceCommandPath() {
|
|
||||||
return "remove";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,9 +30,4 @@ public class SetTimeCommand extends AnnounceCommandBase {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String GetAnnounceCommandPath() {
|
|
||||||
return "settime";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,37 +1,23 @@
|
||||||
package buttondevteam.chat.listener;
|
package buttondevteam.chat.listener;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Random;
|
|
||||||
import java.util.Timer;
|
|
||||||
import java.util.TimerTask;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import com.palmergames.bukkit.towny.Towny;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.*;
|
||||||
import org.bukkit.event.EventPriority;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
import org.bukkit.event.player.*;
|
||||||
import org.bukkit.event.player.PlayerChatTabCompleteEvent;
|
|
||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
|
||||||
import org.bukkit.event.server.ServerCommandEvent;
|
import org.bukkit.event.server.ServerCommandEvent;
|
||||||
import org.bukkit.help.HelpTopic;
|
import org.bukkit.help.HelpTopic;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
import buttondevteam.chat.ChatPlayer;
|
import buttondevteam.chat.*;
|
||||||
import buttondevteam.chat.ChatProcessing;
|
|
||||||
import buttondevteam.chat.PluginMain;
|
|
||||||
import buttondevteam.lib.TBMCChatEvent;
|
import buttondevteam.lib.TBMCChatEvent;
|
||||||
import buttondevteam.lib.TBMCCoreAPI;
|
import buttondevteam.lib.TBMCCoreAPI;
|
||||||
import buttondevteam.lib.chat.Channel;
|
import buttondevteam.lib.chat.Channel;
|
||||||
|
import buttondevteam.lib.chat.ChatChannelRegisterEvent;
|
||||||
import buttondevteam.lib.chat.TBMCChatAPI;
|
import buttondevteam.lib.chat.TBMCChatAPI;
|
||||||
import buttondevteam.lib.player.TBMCPlayer;
|
import buttondevteam.lib.player.TBMCPlayer;
|
||||||
import buttondevteam.lib.player.TBMCPlayerGetInfoEvent;
|
import buttondevteam.lib.player.TBMCPlayerGetInfoEvent;
|
||||||
|
@ -39,13 +25,6 @@ import buttondevteam.lib.player.ChromaGamerBase.InfoTarget;
|
||||||
|
|
||||||
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.palmergames.bukkit.towny.exceptions.NotRegisteredException;
|
|
||||||
import com.palmergames.bukkit.towny.object.Resident;
|
|
||||||
import com.palmergames.bukkit.towny.object.Town;
|
|
||||||
import com.palmergames.bukkit.towny.object.TownBlock;
|
|
||||||
import com.palmergames.bukkit.towny.object.TownyUniverse;
|
|
||||||
import com.palmergames.bukkit.towny.war.eventwar.War;
|
|
||||||
import com.palmergames.bukkit.towny.object.WorldCoord;
|
|
||||||
import com.vexsoftware.votifier.model.Vote;
|
import com.vexsoftware.votifier.model.Vote;
|
||||||
import com.vexsoftware.votifier.model.VotifierEvent;
|
import com.vexsoftware.votifier.model.VotifierEvent;
|
||||||
|
|
||||||
|
@ -86,7 +65,7 @@ public class PlayerListener implements Listener {
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
cmd = event.getMessage().substring(1);
|
cmd = event.getMessage().substring(1);
|
||||||
for (Channel channel : Channel.getChannels()) {
|
for (Channel channel : Channel.getChannels()) {
|
||||||
if (cmd.equalsIgnoreCase(channel.Command)) {
|
if (cmd.equalsIgnoreCase(channel.ID)) {
|
||||||
if (mp.CurrentChannel.equals(channel))
|
if (mp.CurrentChannel.equals(channel))
|
||||||
mp.CurrentChannel = Channel.GlobalChat;
|
mp.CurrentChannel = Channel.GlobalChat;
|
||||||
else
|
else
|
||||||
|
@ -99,7 +78,7 @@ public class PlayerListener implements Listener {
|
||||||
} else {
|
} else {
|
||||||
cmd = event.getMessage().substring(1, index);
|
cmd = event.getMessage().substring(1, index);
|
||||||
for (Channel channel : Channel.getChannels()) {
|
for (Channel channel : Channel.getChannels()) {
|
||||||
if (cmd.equalsIgnoreCase(channel.Command)) {
|
if (cmd.equalsIgnoreCase(channel.ID)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
Channel c = mp.CurrentChannel;
|
Channel c = mp.CurrentChannel;
|
||||||
mp.CurrentChannel = channel;
|
mp.CurrentChannel = channel;
|
||||||
|
@ -119,42 +98,7 @@ public class PlayerListener implements Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cmd.equalsIgnoreCase("sethome")) { // TODO: Move out?
|
if (cmd.toLowerCase().startsWith("un")) {
|
||||||
TownyUniverse tu = PluginMain.Instance.TU;
|
|
||||||
try {
|
|
||||||
TownBlock tb = WorldCoord.parseWorldCoord(event.getPlayer()).getTownBlock();
|
|
||||||
if (tb.hasTown()) {
|
|
||||||
Town town = tb.getTown();
|
|
||||||
if (town.hasNation()) {
|
|
||||||
Resident res = tu.getResidentMap().get(event.getPlayer().getName());
|
|
||||||
if (res != null && res.hasTown()) {
|
|
||||||
Town town2 = res.getTown();
|
|
||||||
if (town2.hasNation()) {
|
|
||||||
if (town.getNation().getEnemies().contains(town2.getNation())) {
|
|
||||||
event.getPlayer().sendMessage("§cYou cannot set homes in enemy territory.");
|
|
||||||
event.setCancelled(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (NotRegisteredException e) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else if (cmd.equalsIgnoreCase("home") || cmd.equalsIgnoreCase("tpa") || cmd.equalsIgnoreCase("tp")) {
|
|
||||||
String currentWorld = event.getPlayer().getLocation().getWorld().getName();
|
|
||||||
Location currentLocation = event.getPlayer().getLocation();
|
|
||||||
TownyUniverse universe = Towny.getPlugin(Towny.class).getTownyUniverse();
|
|
||||||
if (TownyUniverse.isWarTime()) {
|
|
||||||
War war = universe.getWarEvent();
|
|
||||||
if (war.isWarZone(
|
|
||||||
new WorldCoord(currentWorld, currentLocation.getBlockX(), currentLocation.getBlockZ()))) {
|
|
||||||
event.getPlayer().sendMessage("§cError: You can't teleport out of a war zone!");
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (cmd.toLowerCase().startsWith("un")) {
|
|
||||||
for (HelpTopic ht : PluginMain.Instance.getServer().getHelpMap().getHelpTopics()) {
|
for (HelpTopic ht : PluginMain.Instance.getServer().getHelpMap().getHelpTopics()) {
|
||||||
if (ht.getName().equalsIgnoreCase("/" + cmd))
|
if (ht.getName().equalsIgnoreCase("/" + cmd))
|
||||||
return;
|
return;
|
||||||
|
@ -175,15 +119,6 @@ public class PlayerListener implements Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cmd.equalsIgnoreCase("f")) {
|
|
||||||
String[] args = event.getMessage().substring(index + 1).split(" ");
|
|
||||||
if (args.length > 1) {
|
|
||||||
if (args[0].toLowerCase().equals("enemy") && args[1].equalsIgnoreCase("newhaven")) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
event.getPlayer().sendMessage("§cYou are not allowed to set New Haven as your enemy faction.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -274,7 +209,7 @@ public class PlayerListener implements Listener {
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
cmd = event.getCommand();
|
cmd = event.getCommand();
|
||||||
for (Channel channel : Channel.getChannels()) {
|
for (Channel channel : Channel.getChannels()) {
|
||||||
if (cmd.equalsIgnoreCase(channel.Command)) {
|
if (cmd.equalsIgnoreCase(channel.ID)) {
|
||||||
if (ConsoleChannel.equals(channel))
|
if (ConsoleChannel.equals(channel))
|
||||||
ConsoleChannel = Channel.GlobalChat;
|
ConsoleChannel = Channel.GlobalChat;
|
||||||
else
|
else
|
||||||
|
@ -287,7 +222,7 @@ public class PlayerListener implements Listener {
|
||||||
} else {
|
} else {
|
||||||
cmd = event.getCommand().substring(0, index);
|
cmd = event.getCommand().substring(0, index);
|
||||||
for (Channel channel : Channel.getChannels()) {
|
for (Channel channel : Channel.getChannels()) {
|
||||||
if (cmd.equalsIgnoreCase(channel.Command)) {
|
if (cmd.equalsIgnoreCase(channel.ID)) {
|
||||||
Channel c = ConsoleChannel;
|
Channel c = ConsoleChannel;
|
||||||
ConsoleChannel = channel;
|
ConsoleChannel = channel;
|
||||||
TBMCChatAPI.SendChatMessage(PlayerListener.ConsoleChannel, Bukkit.getConsoleSender(),
|
TBMCChatAPI.SendChatMessage(PlayerListener.ConsoleChannel, Bukkit.getConsoleSender(),
|
||||||
|
@ -339,7 +274,7 @@ public class PlayerListener implements Listener {
|
||||||
try {
|
try {
|
||||||
if (e.isCancelled())
|
if (e.isCancelled())
|
||||||
return;
|
return;
|
||||||
e.setCancelled(ChatProcessing.ProcessChat(e.getChannel(), e.getSender(), e.getMessage()));
|
e.setCancelled(ChatProcessing.ProcessChat(e));
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
for (Player p : Bukkit.getOnlinePlayers())
|
for (Player p : Bukkit.getOnlinePlayers())
|
||||||
p.sendMessage("§c!§r["
|
p.sendMessage("§c!§r["
|
||||||
|
@ -349,4 +284,10 @@ public class PlayerListener implements Listener {
|
||||||
TBMCCoreAPI.SendException("An error occured while processing a chat message!", ex);
|
TBMCCoreAPI.SendException("An error occured while processing a chat message!", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onChannelRegistered(ChatChannelRegisterEvent e) {
|
||||||
|
if (e.getChannel().filteranderrormsg != null && PluginMain.SB.getObjective(e.getChannel().ID) == null) // Not global chat and doesn't exist yet
|
||||||
|
PluginMain.SB.registerNewObjective(e.getChannel().ID, "dummy");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue