From fb869c766227275840de9766354934c9817d24e1 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Fri, 1 Jul 2016 16:54:21 +0200 Subject: [PATCH] Added API with documentation, renamed player class --- .../github/norbipeti/thebuttonmcchat/API.java | 52 +++++++++++++++++ .../thebuttonmcchat/PlayerJoinTimerTask.java | 2 +- .../norbipeti/thebuttonmcchat/PluginMain.java | 30 +++++----- ...aybeOfflinePlayer.java => TBMCPlayer.java} | 18 +++--- .../commands/ChatonlyCommand.java | 4 +- .../commands/CommandCaller.java | 56 +++++++++---------- .../thebuttonmcchat/commands/OOCCommand.java | 6 +- .../commands/ucmds/AcceptCommand.java | 4 +- .../commands/ucmds/CCommand.java | 4 +- .../commands/ucmds/IgnoreCommand.java | 6 +- .../commands/ucmds/NameCommand.java | 4 +- .../commands/ucmds/admin/ConfirmCommand.java | 4 +- .../ucmds/admin/PlayerInfoCommand.java | 4 +- .../commands/ucmds/admin/SetFlairCommand.java | 10 ++-- 14 files changed, 127 insertions(+), 77 deletions(-) create mode 100644 src/io/github/norbipeti/thebuttonmcchat/API.java rename src/io/github/norbipeti/thebuttonmcchat/{MaybeOfflinePlayer.java => TBMCPlayer.java} (86%) diff --git a/src/io/github/norbipeti/thebuttonmcchat/API.java b/src/io/github/norbipeti/thebuttonmcchat/API.java new file mode 100644 index 0000000..7d0d02b --- /dev/null +++ b/src/io/github/norbipeti/thebuttonmcchat/API.java @@ -0,0 +1,52 @@ +package io.github.norbipeti.thebuttonmcchat; + +import io.github.norbipeti.thebuttonmcchat.commands.CommandCaller; +import io.github.norbipeti.thebuttonmcchat.commands.TBMCCommandBase; +import io.github.norbipeti.thebuttonmcchat.commands.ucmds.admin.PlayerInfoCommand; + +public class API { + + /** + *

+ * This method adds a command, adding it to help for example. + *

+ *

+ * The command must be registered in the caller plugin's plugin.yml. + * Otherwise the plugin will output a messsage to console. + *

+ * + * @param plugin + * The caller plugin + * @param cmd + * The command to add + */ + public void AddCommand(Plugin plugin, TBMCCommandBase cmd) { + CommandCaller.AddCommand(plugin, cmd); + } + + /** + *

+ * Add player information for {@link PlayerInfoCommand}. Only mods can see + * the given information. + *

+ * + * @param player + * @param infoline + */ + public void AddPlayerInfoForMods(TBMCPlayer player, String infoline) { + // TODO + } + + /** + *

+ * Add player information for hover text at {@link ChatProcessing}. Every + * online player can see the given information. + *

+ * + * @param player + * @param infoline + */ + public void AddPlayerInfoForHover(TBMCPlayer player, String infoline) { + // TODO + } +} diff --git a/src/io/github/norbipeti/thebuttonmcchat/PlayerJoinTimerTask.java b/src/io/github/norbipeti/thebuttonmcchat/PlayerJoinTimerTask.java index 89f621a..099c41c 100644 --- a/src/io/github/norbipeti/thebuttonmcchat/PlayerJoinTimerTask.java +++ b/src/io/github/norbipeti/thebuttonmcchat/PlayerJoinTimerTask.java @@ -7,6 +7,6 @@ public abstract class PlayerJoinTimerTask extends TimerTask { @Override public abstract void run(); - public MaybeOfflinePlayer mp; + public TBMCPlayer mp; } diff --git a/src/io/github/norbipeti/thebuttonmcchat/PluginMain.java b/src/io/github/norbipeti/thebuttonmcchat/PluginMain.java index 183b4af..af050c4 100644 --- a/src/io/github/norbipeti/thebuttonmcchat/PluginMain.java +++ b/src/io/github/norbipeti/thebuttonmcchat/PluginMain.java @@ -156,7 +156,7 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15. else ign = ign.substring(start, end); ign = ign.trim(); - MaybeOfflinePlayer mp = MaybeOfflinePlayer.GetFromName(ign); + TBMCPlayer mp = TBMCPlayer.GetFromName(ign); if (mp == null) continue; if (!JoinedBefore(mp, 2015, 6, 5)) @@ -185,7 +185,7 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15. } } - public void DownloadFlair(MaybeOfflinePlayer mp) + public void DownloadFlair(TBMCPlayer mp) throws MalformedURLException, IOException { String[] flairdata = DownloadString( "http://karmadecay.com/thebutton-data.php?users=" + mp.UserName) @@ -218,7 +218,7 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15. return body; } - private void SetFlair(MaybeOfflinePlayer p, String text, String flairclass, + private void SetFlair(TBMCPlayer p, String text, String flairclass, String username) { p.UserName = username; p.FlairState = FlairStates.Recognised; @@ -233,26 +233,26 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15. { try { if (CheckForJoinDate(p)) { - p.SetFlair(MaybeOfflinePlayer.FlairTimeNonPresser); + p.SetFlair(TBMCPlayer.FlairTimeNonPresser); } else { - p.SetFlair(MaybeOfflinePlayer.FlairTimeCantPress); + p.SetFlair(TBMCPlayer.FlairTimeCantPress); } } catch (Exception e) { p.FlairState = FlairStates.Commented; // Flair unknown - p.SetFlair(MaybeOfflinePlayer.FlairTimeNone); + p.SetFlair(TBMCPlayer.FlairTimeNone); e.printStackTrace(); } } else { try { if (CheckForJoinDate(p)) { p.FlairState = FlairStates.Commented; // Flair unknown - p.SetFlair(MaybeOfflinePlayer.FlairTimeNone); + p.SetFlair(TBMCPlayer.FlairTimeNone); } else { - p.SetFlair(MaybeOfflinePlayer.FlairTimeCantPress); + p.SetFlair(TBMCPlayer.FlairTimeCantPress); } } catch (Exception e) { p.FlairState = FlairStates.Commented; // Flair unknown - p.SetFlair(MaybeOfflinePlayer.FlairTimeNone); + p.SetFlair(TBMCPlayer.FlairTimeNone); e.printStackTrace(); } } @@ -263,12 +263,12 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15. p.SetFlair(Short.parseShort(text)); } - public static boolean CheckForJoinDate(MaybeOfflinePlayer mp) + public static boolean CheckForJoinDate(TBMCPlayer mp) throws Exception { return JoinedBefore(mp, 2015, 4, 1); } - public static boolean JoinedBefore(MaybeOfflinePlayer mp, int year, + public static boolean JoinedBefore(TBMCPlayer mp, int year, int month, int day) throws Exception { URL url = new URL("https://www.reddit.com/u/" + mp.UserName); URLConnection con = url.openConnection(); @@ -288,7 +288,7 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15. .setDate(year, month, day).build().getTime()); } - public static void ConfirmUserMessage(MaybeOfflinePlayer mp) { + public static void ConfirmUserMessage(TBMCPlayer mp) { Player p = Bukkit.getPlayer(mp.UUID); if (mp.FlairState.equals(FlairStates.Commented) && p != null) if (mp.UserNames.size() > 1) @@ -307,7 +307,7 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15. public static void LoadFiles(boolean reload) { if (reload) { System.out.println("TBMC chat plugin cleanup for reloading..."); - MaybeOfflinePlayer.AllPlayers.clear(); + TBMCPlayer.AllPlayers.clear(); AnnounceMessages.clear(); } System.out.println("Loading files for TBMC chat plugin..."); @@ -316,7 +316,7 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15. if (file.exists()) { YamlConfiguration yc = new YamlConfiguration(); yc.load(file); - MaybeOfflinePlayer.Load(yc); + TBMCPlayer.Load(yc); PlayerListener.NotificationSound = yc .getString("notificationsound"); PlayerListener.NotificationPitch = yc @@ -340,7 +340,7 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15. try { File file = new File("thebuttonmc.yml"); YamlConfiguration yc = new YamlConfiguration(); - MaybeOfflinePlayer.Save(yc); + TBMCPlayer.Save(yc); yc.set("notificationsound", PlayerListener.NotificationSound); yc.set("notificationpitch", PlayerListener.NotificationPitch); yc.set("announcetime", AnnounceTime); diff --git a/src/io/github/norbipeti/thebuttonmcchat/MaybeOfflinePlayer.java b/src/io/github/norbipeti/thebuttonmcchat/TBMCPlayer.java similarity index 86% rename from src/io/github/norbipeti/thebuttonmcchat/MaybeOfflinePlayer.java rename to src/io/github/norbipeti/thebuttonmcchat/TBMCPlayer.java index c5c82f7..e752025 100644 --- a/src/io/github/norbipeti/thebuttonmcchat/MaybeOfflinePlayer.java +++ b/src/io/github/norbipeti/thebuttonmcchat/TBMCPlayer.java @@ -11,7 +11,7 @@ import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; -public class MaybeOfflinePlayer { +public class TBMCPlayer { public String PlayerName; public String UserName; public List UserNames; @@ -37,11 +37,11 @@ public class MaybeOfflinePlayer { public UUID UUID; - public static HashMap AllPlayers = new HashMap<>(); + public static HashMap AllPlayers = new HashMap<>(); - public static MaybeOfflinePlayer AddPlayerIfNeeded(UUID uuid) { + public static TBMCPlayer AddPlayerIfNeeded(UUID uuid) { if (!AllPlayers.containsKey(uuid)) { - MaybeOfflinePlayer player = new MaybeOfflinePlayer(); + TBMCPlayer player = new TBMCPlayer(); player.UUID = uuid; player.FlairTime = FlairTimeNone; player.FlairState = FlairStates.NoComment; @@ -59,7 +59,7 @@ public class MaybeOfflinePlayer { ConfigurationSection cs = yc.getConfigurationSection("players"); for (String key : cs.getKeys(false)) { ConfigurationSection cs2 = cs.getConfigurationSection(key); - MaybeOfflinePlayer mp = AddPlayerIfNeeded(java.util.UUID + TBMCPlayer mp = AddPlayerIfNeeded(java.util.UUID .fromString(cs2.getString("uuid"))); mp.UserName = cs2.getString("username"); String tmp = cs2.getString("flairtime"); @@ -84,7 +84,7 @@ public class MaybeOfflinePlayer { public static void Save(YamlConfiguration yc) { ConfigurationSection cs = yc.createSection("players"); - for (MaybeOfflinePlayer mp : MaybeOfflinePlayer.AllPlayers.values()) { + for (TBMCPlayer mp : TBMCPlayer.AllPlayers.values()) { ConfigurationSection cs2 = cs.createSection(mp.UUID.toString()); cs2.set("playername", mp.PlayerName); cs2.set("username", mp.UserName); @@ -98,7 +98,7 @@ public class MaybeOfflinePlayer { } } - public static MaybeOfflinePlayer GetFromName(String name) { + public static TBMCPlayer GetFromName(String name) { Player p = Bukkit.getPlayer(name); if (p != null) return AllPlayers.get(p.getUniqueId()); @@ -162,7 +162,7 @@ public class MaybeOfflinePlayer { return FlairTime; } - public static MaybeOfflinePlayer GetFromPlayer(Player p) { - return MaybeOfflinePlayer.AllPlayers.get(p.getUniqueId()); + public static TBMCPlayer GetFromPlayer(Player p) { + return TBMCPlayer.AllPlayers.get(p.getUniqueId()); } } diff --git a/src/io/github/norbipeti/thebuttonmcchat/commands/ChatonlyCommand.java b/src/io/github/norbipeti/thebuttonmcchat/commands/ChatonlyCommand.java index 5bd0c9e..50babd3 100644 --- a/src/io/github/norbipeti/thebuttonmcchat/commands/ChatonlyCommand.java +++ b/src/io/github/norbipeti/thebuttonmcchat/commands/ChatonlyCommand.java @@ -1,6 +1,6 @@ package io.github.norbipeti.thebuttonmcchat.commands; -import io.github.norbipeti.thebuttonmcchat.MaybeOfflinePlayer; +import io.github.norbipeti.thebuttonmcchat.TBMCPlayer; import org.bukkit.GameMode; import org.bukkit.command.CommandSender; @@ -21,7 +21,7 @@ public final class ChatonlyCommand extends TBMCCommandBase { @Override public boolean OnCommand(CommandSender sender, String alias, String[] args) { Player player=(Player)sender; - MaybeOfflinePlayer p = MaybeOfflinePlayer.AllPlayers.get(player + TBMCPlayer p = TBMCPlayer.AllPlayers.get(player .getUniqueId()); p.ChatOnly = true; player.setGameMode(GameMode.SPECTATOR); diff --git a/src/io/github/norbipeti/thebuttonmcchat/commands/CommandCaller.java b/src/io/github/norbipeti/thebuttonmcchat/commands/CommandCaller.java index 3836765..bb5df09 100644 --- a/src/io/github/norbipeti/thebuttonmcchat/commands/CommandCaller.java +++ b/src/io/github/norbipeti/thebuttonmcchat/commands/CommandCaller.java @@ -33,26 +33,18 @@ public class CommandCaller implements CommandExecutor { public static void RegisterCommands(PluginMain plugin) { if (instance != null) { - new Exception("Only one instance of CommandCaller is allowed") - .printStackTrace(); + new Exception("Only one instance of CommandCaller is allowed").printStackTrace(); return; } System.out.println("Registering commands..."); - CommandCaller cc = new CommandCaller(); - instance = cc; + if (instance == null) + instance = new CommandCaller(); Reflections rf = new Reflections( - new ConfigurationBuilder() - .setUrls( - ClasspathHelper.forClassLoader(plugin - .getClass().getClassLoader())) - .addClassLoader(plugin.getClass().getClassLoader()) - .addScanners(new SubTypesScanner()) - .filterInputsBy( - (String pkg) -> pkg - .contains("io.github.norbipeti.thebuttonmcchat.commands"))); - Set> cmds = rf - .getSubTypesOf(TBMCCommandBase.class); + new ConfigurationBuilder().setUrls(ClasspathHelper.forClassLoader(plugin.getClass().getClassLoader())) + .addClassLoader(plugin.getClass().getClassLoader()).addScanners(new SubTypesScanner()) + .filterInputsBy((String pkg) -> pkg.contains("io.github.norbipeti.thebuttonmcchat.commands"))); + Set> cmds = rf.getSubTypesOf(TBMCCommandBase.class); for (Class cmd : cmds) { try { if (Modifier.isAbstract(cmd.getModifiers())) @@ -63,8 +55,7 @@ public class CommandCaller implements CommandExecutor { { PluginCommand pc = plugin.getCommand(c.GetCommandPath()); if (pc == null) - new Exception("Can't find top-level command: " - + c.GetCommandPath()).printStackTrace(); + new Exception("Can't find top-level command: " + c.GetCommandPath()).printStackTrace(); else pc.setExecutor(cc); } @@ -76,9 +67,22 @@ public class CommandCaller implements CommandExecutor { } } + public static void AddCommand(Plugin plugin, TBMCCommandBase cmd) { + if (instance == null) + instance = new CommandCaller(); + commands.put(cmd.GetCommandPath(), cmd); + if (!c.GetCommandPath().contains("/")) // Top-level command + { + PluginCommand pc = plugin.getCommand(cmd.GetCommandPath()); + if (pc == null) + new Exception("Can't find top-level command: " + c.GetCommandPath()).printStackTrace(); + else + pc.setExecutor(instance); + } + } + @Override - public boolean onCommand(CommandSender sender, Command command, - String alias, String[] args) { + public boolean onCommand(CommandSender sender, Command command, String alias, String[] args) { String path = command.getName(); for (String arg : args) path += "/" + arg; @@ -92,20 +96,15 @@ public class CommandCaller implements CommandExecutor { if (cmd == null) { sender.sendMessage("§cInternal error: Command not registered to CommandCaller"); if (sender != Bukkit.getConsoleSender()) - Bukkit.getConsoleSender() - .sendMessage( - "§cInternal error: Command not registered to CommandCaller"); + Bukkit.getConsoleSender().sendMessage("§cInternal error: Command not registered to CommandCaller"); return true; } if (cmd.GetPlayerOnly() && sender == Bukkit.getConsoleSender()) { sender.sendMessage("§cOnly ingame players can use this command."); return true; } - if (!cmd.OnCommand( - sender, - alias, - (args.length > 0 ? Arrays.copyOfRange(args, args.length - argc, - args.length) : args))) + if (!cmd.OnCommand(sender, alias, + (args.length > 0 ? Arrays.copyOfRange(args, args.length - argc, args.length) : args))) sender.sendMessage(cmd.GetHelpText(alias)); return true; } @@ -115,8 +114,7 @@ public class CommandCaller implements CommandExecutor { cmds.add("§6---- Subcommands ----"); for (TBMCCommandBase cmd : CommandCaller.GetCommands().values()) { if (cmd.GetCommandPath().startsWith(command.GetCommandPath() + "/")) { - int ind = cmd.GetCommandPath().indexOf('/', - command.GetCommandPath().length() + 2); + int ind = cmd.GetCommandPath().indexOf('/', command.GetCommandPath().length() + 2); if (ind >= 0) continue; cmds.add(cmd.GetCommandPath().replace('/', ' ')); diff --git a/src/io/github/norbipeti/thebuttonmcchat/commands/OOCCommand.java b/src/io/github/norbipeti/thebuttonmcchat/commands/OOCCommand.java index 446d7ee..0b8d6b4 100644 --- a/src/io/github/norbipeti/thebuttonmcchat/commands/OOCCommand.java +++ b/src/io/github/norbipeti/thebuttonmcchat/commands/OOCCommand.java @@ -1,6 +1,6 @@ package io.github.norbipeti.thebuttonmcchat.commands; -import io.github.norbipeti.thebuttonmcchat.MaybeOfflinePlayer; +import io.github.norbipeti.thebuttonmcchat.TBMCPlayer; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -21,12 +21,12 @@ public final class OOCCommand extends TBMCCommandBase { if (args.length == 0) { return false; } else { - MaybeOfflinePlayer.AddPlayerIfNeeded(player.getUniqueId()).RPMode = false; + TBMCPlayer.AddPlayerIfNeeded(player.getUniqueId()).RPMode = false; String message = ""; for (String arg : args) message += arg + " "; player.chat(message.substring(0, message.length() - 1)); - MaybeOfflinePlayer.AddPlayerIfNeeded(player.getUniqueId()).RPMode = true; + TBMCPlayer.AddPlayerIfNeeded(player.getUniqueId()).RPMode = true; } return true; } diff --git a/src/io/github/norbipeti/thebuttonmcchat/commands/ucmds/AcceptCommand.java b/src/io/github/norbipeti/thebuttonmcchat/commands/ucmds/AcceptCommand.java index 16189da..a374328 100644 --- a/src/io/github/norbipeti/thebuttonmcchat/commands/ucmds/AcceptCommand.java +++ b/src/io/github/norbipeti/thebuttonmcchat/commands/ucmds/AcceptCommand.java @@ -1,7 +1,7 @@ package io.github.norbipeti.thebuttonmcchat.commands.ucmds; import io.github.norbipeti.thebuttonmcchat.FlairStates; -import io.github.norbipeti.thebuttonmcchat.MaybeOfflinePlayer; +import io.github.norbipeti.thebuttonmcchat.TBMCPlayer; import io.github.norbipeti.thebuttonmcchat.PlayerJoinTimerTask; import io.github.norbipeti.thebuttonmcchat.PluginMain; @@ -22,7 +22,7 @@ public class AcceptCommand extends UCommandBase { @Override public boolean OnCommand(CommandSender sender, String alias, String[] args) { final Player player = (Player) sender; - MaybeOfflinePlayer p = MaybeOfflinePlayer.GetFromPlayer(player); + TBMCPlayer p = TBMCPlayer.GetFromPlayer(player); if (args.length < 1 && p.UserNames.size() > 1) { player.sendMessage("§9Multiple users commented your name. §bPlease pick one using /u accept "); StringBuilder sb = new StringBuilder(); diff --git a/src/io/github/norbipeti/thebuttonmcchat/commands/ucmds/CCommand.java b/src/io/github/norbipeti/thebuttonmcchat/commands/ucmds/CCommand.java index 9530edb..a164c68 100644 --- a/src/io/github/norbipeti/thebuttonmcchat/commands/ucmds/CCommand.java +++ b/src/io/github/norbipeti/thebuttonmcchat/commands/ucmds/CCommand.java @@ -1,7 +1,7 @@ package io.github.norbipeti.thebuttonmcchat.commands.ucmds; import io.github.norbipeti.thebuttonmcchat.ChatFormatter; -import io.github.norbipeti.thebuttonmcchat.MaybeOfflinePlayer; +import io.github.norbipeti.thebuttonmcchat.TBMCPlayer; import io.github.norbipeti.thebuttonmcchat.PluginMain; import org.bukkit.command.CommandSender; @@ -19,7 +19,7 @@ public class CCommand extends UCommandBase { @Override public boolean OnCommand(CommandSender sender, String alias, String[] args) { Player player = (Player) sender; - MaybeOfflinePlayer p = MaybeOfflinePlayer.AddPlayerIfNeeded(player + TBMCPlayer p = TBMCPlayer.AddPlayerIfNeeded(player .getUniqueId()); if (args.length < 1) { if (PluginMain.permission.has(player, "tbmc.rainbow")) { diff --git a/src/io/github/norbipeti/thebuttonmcchat/commands/ucmds/IgnoreCommand.java b/src/io/github/norbipeti/thebuttonmcchat/commands/ucmds/IgnoreCommand.java index 5764972..d2ab213 100644 --- a/src/io/github/norbipeti/thebuttonmcchat/commands/ucmds/IgnoreCommand.java +++ b/src/io/github/norbipeti/thebuttonmcchat/commands/ucmds/IgnoreCommand.java @@ -1,7 +1,7 @@ package io.github.norbipeti.thebuttonmcchat.commands.ucmds; import io.github.norbipeti.thebuttonmcchat.FlairStates; -import io.github.norbipeti.thebuttonmcchat.MaybeOfflinePlayer; +import io.github.norbipeti.thebuttonmcchat.TBMCPlayer; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -19,7 +19,7 @@ public final class IgnoreCommand extends UCommandBase { @Override public boolean OnCommand(CommandSender sender, String alias, String[] args) { final Player player = (Player) sender; - MaybeOfflinePlayer p = MaybeOfflinePlayer.GetFromPlayer(player); + TBMCPlayer p = TBMCPlayer.GetFromPlayer(player); if (p.FlairState.equals(FlairStates.Accepted)) { player.sendMessage("§cYou can only ignore the \"write yoőu rname in the thread\" message."); return true; @@ -30,7 +30,7 @@ public final class IgnoreCommand extends UCommandBase { } if (!p.FlairState.equals(FlairStates.Ignored)) { p.FlairState = FlairStates.Ignored; - p.SetFlair(MaybeOfflinePlayer.FlairTimeNone); + p.SetFlair(TBMCPlayer.FlairTimeNone); p.UserName = ""; player.sendMessage("§bYou have ignored the message. You can still use /u accept to get a flair.§r"); } else diff --git a/src/io/github/norbipeti/thebuttonmcchat/commands/ucmds/NameCommand.java b/src/io/github/norbipeti/thebuttonmcchat/commands/ucmds/NameCommand.java index 4b617f0..3f36515 100644 --- a/src/io/github/norbipeti/thebuttonmcchat/commands/ucmds/NameCommand.java +++ b/src/io/github/norbipeti/thebuttonmcchat/commands/ucmds/NameCommand.java @@ -1,6 +1,6 @@ package io.github.norbipeti.thebuttonmcchat.commands.ucmds; -import io.github.norbipeti.thebuttonmcchat.MaybeOfflinePlayer; +import io.github.norbipeti.thebuttonmcchat.TBMCPlayer; import org.bukkit.command.CommandSender; @@ -19,7 +19,7 @@ public class NameCommand extends UCommandBase { if (args.length == 1) { return false; } - MaybeOfflinePlayer mp = MaybeOfflinePlayer.GetFromName(args[1]); + TBMCPlayer mp = TBMCPlayer.GetFromName(args[1]); if (mp == null) { sender.sendMessage("§cUnknown user (player has to be online): " + args[1]); diff --git a/src/io/github/norbipeti/thebuttonmcchat/commands/ucmds/admin/ConfirmCommand.java b/src/io/github/norbipeti/thebuttonmcchat/commands/ucmds/admin/ConfirmCommand.java index 2b5d050..3622c14 100644 --- a/src/io/github/norbipeti/thebuttonmcchat/commands/ucmds/admin/ConfirmCommand.java +++ b/src/io/github/norbipeti/thebuttonmcchat/commands/ucmds/admin/ConfirmCommand.java @@ -1,6 +1,6 @@ package io.github.norbipeti.thebuttonmcchat.commands.ucmds.admin; -import io.github.norbipeti.thebuttonmcchat.MaybeOfflinePlayer; +import io.github.norbipeti.thebuttonmcchat.TBMCPlayer; import io.github.norbipeti.thebuttonmcchat.PluginMain; import org.bukkit.command.CommandSender; @@ -25,7 +25,7 @@ public class ConfirmCommand extends AdminCommandBase { PluginMain.LoadFiles(true); // TODO: Add players online for (Player p : PluginMain.GetPlayers()) - MaybeOfflinePlayer.AddPlayerIfNeeded(p.getUniqueId()); + TBMCPlayer.AddPlayerIfNeeded(p.getUniqueId()); if (sender != PluginMain.Console) PluginMain.Console.sendMessage("§6-- Reloading done!§r"); sender.sendMessage("§6-- Reloading done!§r"); diff --git a/src/io/github/norbipeti/thebuttonmcchat/commands/ucmds/admin/PlayerInfoCommand.java b/src/io/github/norbipeti/thebuttonmcchat/commands/ucmds/admin/PlayerInfoCommand.java index 2681835..8bb4c2a 100644 --- a/src/io/github/norbipeti/thebuttonmcchat/commands/ucmds/admin/PlayerInfoCommand.java +++ b/src/io/github/norbipeti/thebuttonmcchat/commands/ucmds/admin/PlayerInfoCommand.java @@ -1,6 +1,6 @@ package io.github.norbipeti.thebuttonmcchat.commands.ucmds.admin; -import io.github.norbipeti.thebuttonmcchat.MaybeOfflinePlayer; +import io.github.norbipeti.thebuttonmcchat.TBMCPlayer; import org.bukkit.command.CommandSender; @@ -20,7 +20,7 @@ public class PlayerInfoCommand extends AdminCommandBase { if (args.length == 0) { return false; } - MaybeOfflinePlayer p = MaybeOfflinePlayer.GetFromName(args[0]); + TBMCPlayer p = TBMCPlayer.GetFromName(args[0]); if (p == null) { sender.sendMessage("§cPlayer not found: " + args[0] + " - Currently only online players can be viewed§r"); diff --git a/src/io/github/norbipeti/thebuttonmcchat/commands/ucmds/admin/SetFlairCommand.java b/src/io/github/norbipeti/thebuttonmcchat/commands/ucmds/admin/SetFlairCommand.java index 9c407b0..69aea5b 100644 --- a/src/io/github/norbipeti/thebuttonmcchat/commands/ucmds/admin/SetFlairCommand.java +++ b/src/io/github/norbipeti/thebuttonmcchat/commands/ucmds/admin/SetFlairCommand.java @@ -1,7 +1,7 @@ package io.github.norbipeti.thebuttonmcchat.commands.ucmds.admin; import io.github.norbipeti.thebuttonmcchat.FlairStates; -import io.github.norbipeti.thebuttonmcchat.MaybeOfflinePlayer; +import io.github.norbipeti.thebuttonmcchat.TBMCPlayer; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; @@ -32,11 +32,11 @@ public class SetFlairCommand extends AdminCommandBase { } short flairtime = 0x00; if (args[1].equalsIgnoreCase("non-presser")) - flairtime = MaybeOfflinePlayer.FlairTimeNonPresser; + flairtime = TBMCPlayer.FlairTimeNonPresser; else if (args[1].equalsIgnoreCase("cant-press")) - flairtime = MaybeOfflinePlayer.FlairTimeCantPress; + flairtime = TBMCPlayer.FlairTimeCantPress; else if (args[1].equalsIgnoreCase("none")) - flairtime = MaybeOfflinePlayer.FlairTimeNone; + flairtime = TBMCPlayer.FlairTimeNone; else { try { flairtime = Short.parseShort(args[1]); @@ -54,7 +54,7 @@ public class SetFlairCommand extends AdminCommandBase { sender.sendMessage("§cUnknown value for cheater parameter. Run without args to see usage."); return true; } - MaybeOfflinePlayer mp = MaybeOfflinePlayer.AddPlayerIfNeeded(p + TBMCPlayer mp = TBMCPlayer.AddPlayerIfNeeded(p .getUniqueId()); mp.SetFlair(flairtime, cheater); mp.FlairState = FlairStates.Accepted;