From a9207b6f3857c643be783b9a752e1c97dd16f25a Mon Sep 17 00:00:00 2001 From: nossr50 Date: Tue, 2 Jul 2019 19:19:43 -0700 Subject: [PATCH] Renamed a lot of Command classes --- ...Command.java => AbilityToggleCommand.java} | 4 +- ...ava => ChatNotificationToggleCommand.java} | 4 +- ...onvertCommand.java => ConvertCommand.java} | 8 +-- ...ommand.java => ExperienceRateCommand.java} | 4 +- ...{McgodCommand.java => GodModeCommand.java} | 4 +- .../{McmmoCommand.java => McMMOCommand.java} | 4 +- ...mand.java => RefreshCooldownsCommand.java} | 4 +- ...ardCommand.java => ScoreboardCommand.java} | 4 +- ...eCommand.java => ReloadLocaleCommand.java} | 4 +- .../{McChatSpy.java => ChatSpyCommand.java} | 10 +++- ...{McpurgeCommand.java => PurgeCommand.java} | 4 +- ...bCommand.java => ShowDatabaseCommand.java} | 4 +- ...velsCommand.java => AddLevelsCommand.java} | 4 +- .../{AddxpCommand.java => AddXPCommand.java} | 8 ++- ...editCommand.java => SkillEditCommand.java} | 4 +- ...setCommand.java => SkillResetCommand.java} | 6 +- ...ldownCommand.java => CooldownCommand.java} | 4 +- ...opCommand.java => LeaderboardCommand.java} | 4 +- .../{McrankCommand.java => RankCommand.java} | 4 +- ...atsCommand.java => SkillStatsCommand.java} | 4 +- ...dCommand.java => ReloadPluginCommand.java} | 4 +- src/main/java/com/gmail/nossr50/mcMMO.java | 2 + .../com/gmail/nossr50/util/EventManager.java | 4 +- .../commands/CommandRegistrationManager.java | 60 +++++++++---------- .../nossr50/util/commands/CommandTools.java | 9 --- 25 files changed, 91 insertions(+), 84 deletions(-) rename src/main/java/com/gmail/nossr50/commands/{McabilityCommand.java => AbilityToggleCommand.java} (90%) rename src/main/java/com/gmail/nossr50/commands/{McnotifyCommand.java => ChatNotificationToggleCommand.java} (91%) rename src/main/java/com/gmail/nossr50/commands/{McconvertCommand.java => ConvertCommand.java} (91%) rename src/main/java/com/gmail/nossr50/commands/{XprateCommand.java => ExperienceRateCommand.java} (97%) rename src/main/java/com/gmail/nossr50/commands/{McgodCommand.java => GodModeCommand.java} (91%) rename src/main/java/com/gmail/nossr50/commands/{McmmoCommand.java => McMMOCommand.java} (98%) rename src/main/java/com/gmail/nossr50/commands/{McrefreshCommand.java => RefreshCooldownsCommand.java} (90%) rename src/main/java/com/gmail/nossr50/commands/{McscoreboardCommand.java => ScoreboardCommand.java} (96%) rename src/main/java/com/gmail/nossr50/commands/admin/{McmmoReloadLocaleCommand.java => ReloadLocaleCommand.java} (87%) rename src/main/java/com/gmail/nossr50/commands/chat/{McChatSpy.java => ChatSpyCommand.java} (83%) rename src/main/java/com/gmail/nossr50/commands/database/{McpurgeCommand.java => PurgeCommand.java} (91%) rename src/main/java/com/gmail/nossr50/commands/database/{MmoshowdbCommand.java => ShowDatabaseCommand.java} (91%) rename src/main/java/com/gmail/nossr50/commands/experience/{AddlevelsCommand.java => AddLevelsCommand.java} (93%) rename src/main/java/com/gmail/nossr50/commands/experience/{AddxpCommand.java => AddXPCommand.java} (91%) rename src/main/java/com/gmail/nossr50/commands/experience/{MmoeditCommand.java => SkillEditCommand.java} (94%) rename src/main/java/com/gmail/nossr50/commands/experience/{SkillresetCommand.java => SkillResetCommand.java} (96%) rename src/main/java/com/gmail/nossr50/commands/player/{MccooldownCommand.java => CooldownCommand.java} (96%) rename src/main/java/com/gmail/nossr50/commands/player/{MctopCommand.java => LeaderboardCommand.java} (97%) rename src/main/java/com/gmail/nossr50/commands/player/{McrankCommand.java => RankCommand.java} (98%) rename src/main/java/com/gmail/nossr50/commands/player/{McstatsCommand.java => SkillStatsCommand.java} (96%) rename src/main/java/com/gmail/nossr50/commands/server/{ReloadCommand.java => ReloadPluginCommand.java} (89%) diff --git a/src/main/java/com/gmail/nossr50/commands/McabilityCommand.java b/src/main/java/com/gmail/nossr50/commands/AbilityToggleCommand.java similarity index 90% rename from src/main/java/com/gmail/nossr50/commands/McabilityCommand.java rename to src/main/java/com/gmail/nossr50/commands/AbilityToggleCommand.java index a34d61819..c13328e3c 100644 --- a/src/main/java/com/gmail/nossr50/commands/McabilityCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/AbilityToggleCommand.java @@ -5,11 +5,11 @@ import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.util.Permissions; import org.bukkit.command.CommandSender; -public class McabilityCommand extends ToggleCommand { +public class AbilityToggleCommand extends ToggleCommand { private mcMMO pluginRef; - public McabilityCommand(mcMMO pluginRef) { + public AbilityToggleCommand(mcMMO pluginRef) { this.pluginRef = pluginRef; } diff --git a/src/main/java/com/gmail/nossr50/commands/McnotifyCommand.java b/src/main/java/com/gmail/nossr50/commands/ChatNotificationToggleCommand.java similarity index 91% rename from src/main/java/com/gmail/nossr50/commands/McnotifyCommand.java rename to src/main/java/com/gmail/nossr50/commands/ChatNotificationToggleCommand.java index 67ec2fd39..2eed60766 100644 --- a/src/main/java/com/gmail/nossr50/commands/McnotifyCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/ChatNotificationToggleCommand.java @@ -11,11 +11,11 @@ import org.bukkit.entity.Player; import java.util.List; -public class McnotifyCommand implements TabExecutor { +public class ChatNotificationToggleCommand implements TabExecutor { private mcMMO pluginRef; - public McnotifyCommand(mcMMO pluginRef) { + public ChatNotificationToggleCommand(mcMMO pluginRef) { this.pluginRef = pluginRef; } diff --git a/src/main/java/com/gmail/nossr50/commands/McconvertCommand.java b/src/main/java/com/gmail/nossr50/commands/ConvertCommand.java similarity index 91% rename from src/main/java/com/gmail/nossr50/commands/McconvertCommand.java rename to src/main/java/com/gmail/nossr50/commands/ConvertCommand.java index ec268ce97..e05ee4bd7 100644 --- a/src/main/java/com/gmail/nossr50/commands/McconvertCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/ConvertCommand.java @@ -17,16 +17,16 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -public class McconvertCommand implements TabExecutor { +public class ConvertCommand implements TabExecutor { private List FORMULA_TYPES; private List DATABASE_TYPES; - private final List SUBCOMMANDS = ImmutableList.of("database", "experience"); + private final List CONVERSION_SUBCOMMANDS = ImmutableList.of("database", "experience"); private CommandExecutor databaseConvertCommand; private CommandExecutor experienceConvertCommand; private mcMMO pluginRef; - public McconvertCommand(mcMMO pluginRef) { + public ConvertCommand(mcMMO pluginRef) { this.pluginRef = pluginRef; databaseConvertCommand = new ConvertDatabaseCommand(pluginRef); experienceConvertCommand = new ConvertExperienceCommand(pluginRef); @@ -79,7 +79,7 @@ public class McconvertCommand implements TabExecutor { public List onTabComplete(CommandSender sender, Command command, String alias, String[] args) { switch (args.length) { case 1: - return StringUtil.copyPartialMatches(args[0], SUBCOMMANDS, new ArrayList<>(SUBCOMMANDS.size())); + return StringUtil.copyPartialMatches(args[0], CONVERSION_SUBCOMMANDS, new ArrayList<>(CONVERSION_SUBCOMMANDS.size())); case 2: if (args[1].equalsIgnoreCase("database") || args[1].equalsIgnoreCase("db")) { return StringUtil.copyPartialMatches(args[0], DATABASE_TYPES, new ArrayList<>(DATABASE_TYPES.size())); diff --git a/src/main/java/com/gmail/nossr50/commands/XprateCommand.java b/src/main/java/com/gmail/nossr50/commands/ExperienceRateCommand.java similarity index 97% rename from src/main/java/com/gmail/nossr50/commands/XprateCommand.java rename to src/main/java/com/gmail/nossr50/commands/ExperienceRateCommand.java index 52a5d5edc..4c10c5f7f 100644 --- a/src/main/java/com/gmail/nossr50/commands/XprateCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/ExperienceRateCommand.java @@ -14,11 +14,11 @@ import org.bukkit.util.StringUtil; import java.util.ArrayList; import java.util.List; -public class XprateCommand implements TabExecutor { +public class ExperienceRateCommand implements TabExecutor { private mcMMO pluginRef; - public XprateCommand(mcMMO pluginRef) { + public ExperienceRateCommand(mcMMO pluginRef) { this.pluginRef = pluginRef; } diff --git a/src/main/java/com/gmail/nossr50/commands/McgodCommand.java b/src/main/java/com/gmail/nossr50/commands/GodModeCommand.java similarity index 91% rename from src/main/java/com/gmail/nossr50/commands/McgodCommand.java rename to src/main/java/com/gmail/nossr50/commands/GodModeCommand.java index bcb4b0d2d..edeb3136d 100644 --- a/src/main/java/com/gmail/nossr50/commands/McgodCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/GodModeCommand.java @@ -5,11 +5,11 @@ import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.util.Permissions; import org.bukkit.command.CommandSender; -public class McgodCommand extends ToggleCommand { +public class GodModeCommand extends ToggleCommand { private mcMMO pluginRef; - public McgodCommand(mcMMO pluginRef) { + public GodModeCommand(mcMMO pluginRef) { this.pluginRef = pluginRef; } diff --git a/src/main/java/com/gmail/nossr50/commands/McmmoCommand.java b/src/main/java/com/gmail/nossr50/commands/McMMOCommand.java similarity index 98% rename from src/main/java/com/gmail/nossr50/commands/McmmoCommand.java rename to src/main/java/com/gmail/nossr50/commands/McMMOCommand.java index 7d922194a..b8e9f9efb 100644 --- a/src/main/java/com/gmail/nossr50/commands/McmmoCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/McMMOCommand.java @@ -8,11 +8,11 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; -public class McmmoCommand implements CommandExecutor { +public class McMMOCommand implements CommandExecutor { private mcMMO pluginRef; - public McmmoCommand(mcMMO pluginRef) { + public McMMOCommand(mcMMO pluginRef) { this.pluginRef = pluginRef; } diff --git a/src/main/java/com/gmail/nossr50/commands/McrefreshCommand.java b/src/main/java/com/gmail/nossr50/commands/RefreshCooldownsCommand.java similarity index 90% rename from src/main/java/com/gmail/nossr50/commands/McrefreshCommand.java rename to src/main/java/com/gmail/nossr50/commands/RefreshCooldownsCommand.java index 1f3dba285..b67841a72 100644 --- a/src/main/java/com/gmail/nossr50/commands/McrefreshCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/RefreshCooldownsCommand.java @@ -5,11 +5,11 @@ import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.util.Permissions; import org.bukkit.command.CommandSender; -public class McrefreshCommand extends ToggleCommand { +public class RefreshCooldownsCommand extends ToggleCommand { private mcMMO pluginRef; - public McrefreshCommand(mcMMO pluginRef) { + public RefreshCooldownsCommand(mcMMO pluginRef) { this.pluginRef = pluginRef; } diff --git a/src/main/java/com/gmail/nossr50/commands/McscoreboardCommand.java b/src/main/java/com/gmail/nossr50/commands/ScoreboardCommand.java similarity index 96% rename from src/main/java/com/gmail/nossr50/commands/McscoreboardCommand.java rename to src/main/java/com/gmail/nossr50/commands/ScoreboardCommand.java index f4e7b3717..967ddc6a5 100644 --- a/src/main/java/com/gmail/nossr50/commands/McscoreboardCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/ScoreboardCommand.java @@ -11,11 +11,11 @@ import org.bukkit.util.StringUtil; import java.util.ArrayList; import java.util.List; -public class McscoreboardCommand implements TabExecutor { +public class ScoreboardCommand implements TabExecutor { private mcMMO pluginRef; - public McscoreboardCommand(mcMMO pluginRef) { + public ScoreboardCommand(mcMMO pluginRef) { this.pluginRef = pluginRef; } diff --git a/src/main/java/com/gmail/nossr50/commands/admin/McmmoReloadLocaleCommand.java b/src/main/java/com/gmail/nossr50/commands/admin/ReloadLocaleCommand.java similarity index 87% rename from src/main/java/com/gmail/nossr50/commands/admin/McmmoReloadLocaleCommand.java rename to src/main/java/com/gmail/nossr50/commands/admin/ReloadLocaleCommand.java index 0cecaddb6..31bca1a11 100644 --- a/src/main/java/com/gmail/nossr50/commands/admin/McmmoReloadLocaleCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/admin/ReloadLocaleCommand.java @@ -9,11 +9,11 @@ import org.bukkit.command.CommandSender; /** * @author Mark Vainomaa */ -public final class McmmoReloadLocaleCommand implements CommandExecutor { +public final class ReloadLocaleCommand implements CommandExecutor { private mcMMO pluginRef; - public McmmoReloadLocaleCommand(mcMMO pluginRef) { + public ReloadLocaleCommand(mcMMO pluginRef) { this.pluginRef = pluginRef; } diff --git a/src/main/java/com/gmail/nossr50/commands/chat/McChatSpy.java b/src/main/java/com/gmail/nossr50/commands/chat/ChatSpyCommand.java similarity index 83% rename from src/main/java/com/gmail/nossr50/commands/chat/McChatSpy.java rename to src/main/java/com/gmail/nossr50/commands/chat/ChatSpyCommand.java index df05fbcf7..326eaf63a 100644 --- a/src/main/java/com/gmail/nossr50/commands/chat/McChatSpy.java +++ b/src/main/java/com/gmail/nossr50/commands/chat/ChatSpyCommand.java @@ -2,10 +2,18 @@ package com.gmail.nossr50.commands.chat; import com.gmail.nossr50.commands.ToggleCommand; import com.gmail.nossr50.datatypes.player.McMMOPlayer; +import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.util.Permissions; import org.bukkit.command.CommandSender; -public class McChatSpy extends ToggleCommand { +public class ChatSpyCommand extends ToggleCommand { + + private mcMMO pluginRef; + + public ChatSpyCommand(mcMMO pluginRef) { + this.pluginRef = pluginRef; + } + @Override protected boolean hasOtherPermission(CommandSender sender) { return Permissions.adminChatSpyOthers(sender); diff --git a/src/main/java/com/gmail/nossr50/commands/database/McpurgeCommand.java b/src/main/java/com/gmail/nossr50/commands/database/PurgeCommand.java similarity index 91% rename from src/main/java/com/gmail/nossr50/commands/database/McpurgeCommand.java rename to src/main/java/com/gmail/nossr50/commands/database/PurgeCommand.java index d245c67a7..5e9791aa8 100644 --- a/src/main/java/com/gmail/nossr50/commands/database/McpurgeCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/database/PurgeCommand.java @@ -8,11 +8,11 @@ import org.bukkit.command.TabExecutor; import java.util.List; -public class McpurgeCommand implements TabExecutor { +public class PurgeCommand implements TabExecutor { private mcMMO pluginRef; - public McpurgeCommand(mcMMO pluginRef) { + public PurgeCommand(mcMMO pluginRef) { this.pluginRef = pluginRef; } diff --git a/src/main/java/com/gmail/nossr50/commands/database/MmoshowdbCommand.java b/src/main/java/com/gmail/nossr50/commands/database/ShowDatabaseCommand.java similarity index 91% rename from src/main/java/com/gmail/nossr50/commands/database/MmoshowdbCommand.java rename to src/main/java/com/gmail/nossr50/commands/database/ShowDatabaseCommand.java index 2598d79ca..886008955 100644 --- a/src/main/java/com/gmail/nossr50/commands/database/MmoshowdbCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/database/ShowDatabaseCommand.java @@ -9,11 +9,11 @@ import org.bukkit.command.TabExecutor; import java.util.List; -public class MmoshowdbCommand implements TabExecutor { +public class ShowDatabaseCommand implements TabExecutor { private mcMMO pluginRef; - public MmoshowdbCommand(mcMMO pluginRef) { + public ShowDatabaseCommand(mcMMO pluginRef) { this.pluginRef = pluginRef; } diff --git a/src/main/java/com/gmail/nossr50/commands/experience/AddlevelsCommand.java b/src/main/java/com/gmail/nossr50/commands/experience/AddLevelsCommand.java similarity index 93% rename from src/main/java/com/gmail/nossr50/commands/experience/AddlevelsCommand.java rename to src/main/java/com/gmail/nossr50/commands/experience/AddLevelsCommand.java index 7429d366c..126f2cc85 100644 --- a/src/main/java/com/gmail/nossr50/commands/experience/AddlevelsCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/experience/AddLevelsCommand.java @@ -8,9 +8,9 @@ import com.gmail.nossr50.util.Permissions; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -public class AddlevelsCommand extends ExperienceCommand { +public class AddLevelsCommand extends ExperienceCommand { - public AddlevelsCommand(mcMMO pluginRef) { + public AddLevelsCommand(mcMMO pluginRef) { super(pluginRef); } diff --git a/src/main/java/com/gmail/nossr50/commands/experience/AddxpCommand.java b/src/main/java/com/gmail/nossr50/commands/experience/AddXPCommand.java similarity index 91% rename from src/main/java/com/gmail/nossr50/commands/experience/AddxpCommand.java rename to src/main/java/com/gmail/nossr50/commands/experience/AddXPCommand.java index c47259b7b..9c2fd283d 100644 --- a/src/main/java/com/gmail/nossr50/commands/experience/AddxpCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/experience/AddXPCommand.java @@ -4,12 +4,18 @@ import com.gmail.nossr50.datatypes.experience.XPGainReason; import com.gmail.nossr50.datatypes.experience.XPGainSource; import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; +import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.player.UserManager; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -public class AddxpCommand extends ExperienceCommand { +public class AddXPCommand extends ExperienceCommand { + + public AddXPCommand(mcMMO pluginRef) { + super(pluginRef); + } + @Override protected boolean permissionsCheckSelf(CommandSender sender) { return Permissions.addxp(sender); diff --git a/src/main/java/com/gmail/nossr50/commands/experience/MmoeditCommand.java b/src/main/java/com/gmail/nossr50/commands/experience/SkillEditCommand.java similarity index 94% rename from src/main/java/com/gmail/nossr50/commands/experience/MmoeditCommand.java rename to src/main/java/com/gmail/nossr50/commands/experience/SkillEditCommand.java index 15dc4898d..79de12dc5 100644 --- a/src/main/java/com/gmail/nossr50/commands/experience/MmoeditCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/experience/SkillEditCommand.java @@ -8,8 +8,8 @@ import com.gmail.nossr50.util.Permissions; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -public class MmoeditCommand extends ExperienceCommand { - public MmoeditCommand(mcMMO pluginRef) { +public class SkillEditCommand extends ExperienceCommand { + public SkillEditCommand(mcMMO pluginRef) { super(pluginRef); } diff --git a/src/main/java/com/gmail/nossr50/commands/experience/SkillresetCommand.java b/src/main/java/com/gmail/nossr50/commands/experience/SkillResetCommand.java similarity index 96% rename from src/main/java/com/gmail/nossr50/commands/experience/SkillresetCommand.java rename to src/main/java/com/gmail/nossr50/commands/experience/SkillResetCommand.java index c77edd6b3..3d819382a 100644 --- a/src/main/java/com/gmail/nossr50/commands/experience/SkillresetCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/experience/SkillResetCommand.java @@ -23,15 +23,15 @@ import java.util.UUID; * This class mirrors the structure of ExperienceCommand, except the * value/quantity argument is removed. */ -public class SkillresetCommand implements TabExecutor { +public class SkillResetCommand implements TabExecutor { private mcMMO pluginRef; - public SkillresetCommand(mcMMO pluginRef) { + public SkillResetCommand(mcMMO pluginRef) { this.pluginRef = pluginRef; } - protected static void handleSenderMessage(CommandSender sender, String playerName, PrimarySkillType skill) { + protected void handleSenderMessage(CommandSender sender, String playerName, PrimarySkillType skill) { if (skill == null) { sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.addlevels.AwardAll.2", playerName)); } else { diff --git a/src/main/java/com/gmail/nossr50/commands/player/MccooldownCommand.java b/src/main/java/com/gmail/nossr50/commands/player/CooldownCommand.java similarity index 96% rename from src/main/java/com/gmail/nossr50/commands/player/MccooldownCommand.java rename to src/main/java/com/gmail/nossr50/commands/player/CooldownCommand.java index d48f40596..f78dcf98d 100644 --- a/src/main/java/com/gmail/nossr50/commands/player/MccooldownCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/player/CooldownCommand.java @@ -13,11 +13,11 @@ import org.bukkit.entity.Player; import java.util.List; -public class MccooldownCommand implements TabExecutor { +public class CooldownCommand implements TabExecutor { private mcMMO pluginRef; - public MccooldownCommand(mcMMO pluginRef) { + public CooldownCommand(mcMMO pluginRef) { this.pluginRef = pluginRef; } diff --git a/src/main/java/com/gmail/nossr50/commands/player/MctopCommand.java b/src/main/java/com/gmail/nossr50/commands/player/LeaderboardCommand.java similarity index 97% rename from src/main/java/com/gmail/nossr50/commands/player/MctopCommand.java rename to src/main/java/com/gmail/nossr50/commands/player/LeaderboardCommand.java index 30906aee1..3897bc1fb 100644 --- a/src/main/java/com/gmail/nossr50/commands/player/MctopCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/player/LeaderboardCommand.java @@ -20,11 +20,11 @@ import org.bukkit.util.StringUtil; import java.util.ArrayList; import java.util.List; -public class MctopCommand implements TabExecutor { +public class LeaderboardCommand implements TabExecutor { private mcMMO pluginRef; - public MctopCommand(mcMMO pluginRef) { + public LeaderboardCommand(mcMMO pluginRef) { this.pluginRef = pluginRef; } diff --git a/src/main/java/com/gmail/nossr50/commands/player/McrankCommand.java b/src/main/java/com/gmail/nossr50/commands/player/RankCommand.java similarity index 98% rename from src/main/java/com/gmail/nossr50/commands/player/McrankCommand.java rename to src/main/java/com/gmail/nossr50/commands/player/RankCommand.java index eeb6e8b3e..3071322b3 100644 --- a/src/main/java/com/gmail/nossr50/commands/player/McrankCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/player/RankCommand.java @@ -18,11 +18,11 @@ import org.bukkit.util.StringUtil; import java.util.ArrayList; import java.util.List; -public class McrankCommand implements TabExecutor { +public class RankCommand implements TabExecutor { private mcMMO pluginRef; - public McrankCommand(mcMMO pluginRef) { + public RankCommand(mcMMO pluginRef) { this.pluginRef = pluginRef; } diff --git a/src/main/java/com/gmail/nossr50/commands/player/McstatsCommand.java b/src/main/java/com/gmail/nossr50/commands/player/SkillStatsCommand.java similarity index 96% rename from src/main/java/com/gmail/nossr50/commands/player/McstatsCommand.java rename to src/main/java/com/gmail/nossr50/commands/player/SkillStatsCommand.java index ad5442d5e..f82daa8c5 100644 --- a/src/main/java/com/gmail/nossr50/commands/player/McstatsCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/player/SkillStatsCommand.java @@ -11,11 +11,11 @@ import org.bukkit.entity.Player; import java.util.List; -public class McstatsCommand implements TabExecutor { +public class SkillStatsCommand implements TabExecutor { private mcMMO pluginRef; - public McstatsCommand(mcMMO pluginRef) { + public SkillStatsCommand(mcMMO pluginRef) { this.pluginRef = pluginRef; } diff --git a/src/main/java/com/gmail/nossr50/commands/server/ReloadCommand.java b/src/main/java/com/gmail/nossr50/commands/server/ReloadPluginCommand.java similarity index 89% rename from src/main/java/com/gmail/nossr50/commands/server/ReloadCommand.java rename to src/main/java/com/gmail/nossr50/commands/server/ReloadPluginCommand.java index 7d14628dd..8a4b32b12 100644 --- a/src/main/java/com/gmail/nossr50/commands/server/ReloadCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/server/ReloadPluginCommand.java @@ -9,11 +9,11 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; -public class ReloadCommand implements CommandExecutor { +public class ReloadPluginCommand implements CommandExecutor { private mcMMO pluginRef; - public ReloadCommand(mcMMO plugin) { + public ReloadPluginCommand(mcMMO plugin) { this.pluginRef = plugin; } diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index c7285e6ad..714faad41 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -206,6 +206,8 @@ public class mcMMO extends JavaPlugin { //Init Event Manager eventManager = new EventManager(this); + //Init Command Tools + //TODO: Better name? commandTools = new CommandTools(this); } diff --git a/src/main/java/com/gmail/nossr50/util/EventManager.java b/src/main/java/com/gmail/nossr50/util/EventManager.java index b186416bb..825426a84 100644 --- a/src/main/java/com/gmail/nossr50/util/EventManager.java +++ b/src/main/java/com/gmail/nossr50/util/EventManager.java @@ -209,7 +209,7 @@ public class EventManager { } - public boolean tryLevelChangeEvent(Player player, PrimarySkillType skill, int levelsChanged, float xpRemoved, boolean isLevelUp, XPGainReason xpGainReason) { + public boolean tryLevelChangeEvent(Player player, PrimarySkillType skill, int levelsChanged, double xpRemoved, boolean isLevelUp, XPGainReason xpGainReason) { McMMOPlayerLevelChangeEvent event = isLevelUp ? new McMMOPlayerLevelUpEvent(player, skill, levelsChanged, xpGainReason) : new McMMOPlayerLevelDownEvent(player, skill, levelsChanged, xpGainReason); pluginRef.getServer().getPluginManager().callEvent(event); @@ -225,7 +225,7 @@ public class EventManager { return isCancelled; } - public boolean tryLevelEditEvent(Player player, PrimarySkillType skill, int levelsChanged, float xpRemoved, boolean isLevelUp, XPGainReason xpGainReason, int oldLevel) { + public boolean tryLevelEditEvent(Player player, PrimarySkillType skill, int levelsChanged, double xpRemoved, boolean isLevelUp, XPGainReason xpGainReason, int oldLevel) { McMMOPlayerLevelChangeEvent event = isLevelUp ? new McMMOPlayerLevelUpEvent(player, skill, levelsChanged - oldLevel, xpGainReason) : new McMMOPlayerLevelDownEvent(player, skill, levelsChanged, xpGainReason); pluginRef.getServer().getPluginManager().callEvent(event); diff --git a/src/main/java/com/gmail/nossr50/util/commands/CommandRegistrationManager.java b/src/main/java/com/gmail/nossr50/util/commands/CommandRegistrationManager.java index 0673783dd..222009198 100644 --- a/src/main/java/com/gmail/nossr50/util/commands/CommandRegistrationManager.java +++ b/src/main/java/com/gmail/nossr50/util/commands/CommandRegistrationManager.java @@ -1,21 +1,21 @@ package com.gmail.nossr50.util.commands; import com.gmail.nossr50.commands.*; -import com.gmail.nossr50.commands.admin.McmmoReloadLocaleCommand; +import com.gmail.nossr50.commands.admin.ReloadLocaleCommand; import com.gmail.nossr50.commands.chat.AdminChatCommand; -import com.gmail.nossr50.commands.chat.McChatSpy; +import com.gmail.nossr50.commands.chat.ChatSpyCommand; import com.gmail.nossr50.commands.chat.PartyChatCommand; -import com.gmail.nossr50.commands.database.McpurgeCommand; +import com.gmail.nossr50.commands.database.PurgeCommand; import com.gmail.nossr50.commands.database.McremoveCommand; -import com.gmail.nossr50.commands.database.MmoshowdbCommand; -import com.gmail.nossr50.commands.experience.AddlevelsCommand; -import com.gmail.nossr50.commands.experience.AddxpCommand; -import com.gmail.nossr50.commands.experience.MmoeditCommand; -import com.gmail.nossr50.commands.experience.SkillresetCommand; +import com.gmail.nossr50.commands.database.ShowDatabaseCommand; +import com.gmail.nossr50.commands.experience.AddLevelsCommand; +import com.gmail.nossr50.commands.experience.AddXPCommand; +import com.gmail.nossr50.commands.experience.SkillEditCommand; +import com.gmail.nossr50.commands.experience.SkillResetCommand; import com.gmail.nossr50.commands.party.PartyCommand; import com.gmail.nossr50.commands.party.teleport.PtpCommand; import com.gmail.nossr50.commands.player.*; -import com.gmail.nossr50.commands.server.ReloadCommand; +import com.gmail.nossr50.commands.server.ReloadPluginCommand; import com.gmail.nossr50.commands.skills.*; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.mcMMO; @@ -120,7 +120,7 @@ public final class CommandRegistrationManager { command.setPermission("mcmmo.commands.addlevels;mcmmo.commands.addlevels.others"); command.setPermissionMessage(permissionsMessage); command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.3", "addlevels", "[" + pluginRef.getLocaleManager().getString("Commands.Usage.Player") + "]", "<" + pluginRef.getLocaleManager().getString("Commands.Usage.Skill") + ">", "<" + pluginRef.getLocaleManager().getString("Commands.Usage.Level") + ">")); - command.setExecutor(new AddlevelsCommand()); + command.setExecutor(new AddLevelsCommand()); } private void registerAddxpCommand() { @@ -129,7 +129,7 @@ public final class CommandRegistrationManager { command.setPermission("mcmmo.commands.addxp;mcmmo.commands.addxp.others"); command.setPermissionMessage(permissionsMessage); command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.3", "addxp", "[" + pluginRef.getLocaleManager().getString("Commands.Usage.Player") + "]", "<" + pluginRef.getLocaleManager().getString("Commands.Usage.Skill") + ">", "<" + pluginRef.getLocaleManager().getString("Commands.Usage.XP") + ">")); - command.setExecutor(new AddxpCommand()); + command.setExecutor(new AddXPCommand()); } private void registerMcgodCommand() { @@ -138,7 +138,7 @@ public final class CommandRegistrationManager { command.setPermission("mcmmo.commands.mcgod;mcmmo.commands.mcgod.others"); command.setPermissionMessage(permissionsMessage); command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.1", "mcgod", "[" + pluginRef.getLocaleManager().getString("Commands.Usage.Player") + "]")); - command.setExecutor(new McgodCommand()); + command.setExecutor(new GodModeCommand()); } private void registerMmoInfoCommand() { @@ -156,7 +156,7 @@ public final class CommandRegistrationManager { command.setPermission("mcmmo.commands.mcchatspy;mcmmo.commands.mcchatspy.others"); command.setPermissionMessage(permissionsMessage); command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.1", "mcchatspy", "[" + pluginRef.getLocaleManager().getString("Commands.Usage.Player") + "]")); - command.setExecutor(new McChatSpy()); + command.setExecutor(new ChatSpyCommand()); } private void registerMcrefreshCommand() { @@ -165,7 +165,7 @@ public final class CommandRegistrationManager { command.setPermission("mcmmo.commands.mcrefresh;mcmmo.commands.mcrefresh.others"); command.setPermissionMessage(permissionsMessage); command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.1", "mcrefresh", "[" + pluginRef.getLocaleManager().getString("Commands.Usage.Player") + "]")); - command.setExecutor(new McrefreshCommand()); + command.setExecutor(new RefreshCooldownsCommand()); } private void registerMmoeditCommand() { @@ -174,7 +174,7 @@ public final class CommandRegistrationManager { command.setPermission("mcmmo.commands.mmoedit;mcmmo.commands.mmoedit.others"); command.setPermissionMessage(permissionsMessage); command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.3", "mmoedit", "[" + pluginRef.getLocaleManager().getString("Commands.Usage.Player") + "]", "<" + pluginRef.getLocaleManager().getString("Commands.Usage.Skill") + ">", "<" + pluginRef.getLocaleManager().getString("Commands.Usage.Level") + ">")); - command.setExecutor(new MmoeditCommand()); + command.setExecutor(new SkillEditCommand()); } private void registerMcmmoReloadCommand() { @@ -183,7 +183,7 @@ public final class CommandRegistrationManager { command.setPermission("mcmmo.commands.reload"); command.setPermissionMessage(permissionsMessage); command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.0", "mcmmoreload")); - command.setExecutor(new ReloadCommand(pluginRef)); + command.setExecutor(new ReloadPluginCommand(pluginRef)); } private void registerSkillresetCommand() { @@ -192,7 +192,7 @@ public final class CommandRegistrationManager { command.setPermission("mcmmo.commands.skillreset;mcmmo.commands.skillreset.others"); // Only need the main ones, not the individual skill ones command.setPermissionMessage(permissionsMessage); command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.2", "skillreset", "[" + pluginRef.getLocaleManager().getString("Commands.Usage.Player") + "]", "<" + pluginRef.getLocaleManager().getString("Commands.Usage.Skill") + ">")); - command.setExecutor(new SkillresetCommand()); + command.setExecutor(new SkillResetCommand()); } private void registerXprateCommand() { @@ -206,7 +206,7 @@ public final class CommandRegistrationManager { command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.2", "xprate", "<" + pluginRef.getLocaleManager().getString("Commands.Usage.Rate") + ">", "")); command.setUsage(command.getUsage() + "\n" + pluginRef.getLocaleManager().getString("Commands.Usage.1", "xprate", "reset")); command.setAliases(aliasList); - command.setExecutor(new XprateCommand()); + command.setExecutor(new ExperienceRateCommand()); } private void registerInspectCommand() { @@ -224,7 +224,7 @@ public final class CommandRegistrationManager { command.setPermission("mcmmo.commands.mccooldown"); command.setPermissionMessage(permissionsMessage); command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.0", "mccooldowns")); - command.setExecutor(new MccooldownCommand()); + command.setExecutor(new CooldownCommand()); } private void registerMcabilityCommand() { @@ -233,7 +233,7 @@ public final class CommandRegistrationManager { command.setPermission("mcmmo.commands.mcability;mcmmo.commands.mcability.others"); command.setPermissionMessage(permissionsMessage); command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.1", "mcability", "[" + pluginRef.getLocaleManager().getString("Commands.Usage.Player") + "]")); - command.setExecutor(new McabilityCommand()); + command.setExecutor(new AbilityToggleCommand()); } private void registerMcmmoCommand() { @@ -243,7 +243,7 @@ public final class CommandRegistrationManager { command.setPermissionMessage(permissionsMessage); command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.0", "mcmmo")); command.setUsage(command.getUsage() + "\n" + pluginRef.getLocaleManager().getString("Commands.Usage.1", "mcmmo", "help")); - command.setExecutor(new McmmoCommand()); + command.setExecutor(new McMMOCommand()); } private void registerMcrankCommand() { @@ -252,7 +252,7 @@ public final class CommandRegistrationManager { command.setPermission("mcmmo.commands.mcrank;mcmmo.commands.mcrank.others;mcmmo.commands.mcrank.others.far;mcmmo.commands.mcrank.others.offline"); command.setPermissionMessage(permissionsMessage); command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.1", "mcrank", "[" + pluginRef.getLocaleManager().getString("Commands.Usage.Player") + "]")); - command.setExecutor(new McrankCommand()); + command.setExecutor(new RankCommand()); } private void registerMcstatsCommand() { @@ -261,7 +261,7 @@ public final class CommandRegistrationManager { command.setPermission("mcmmo.commands.mcstats"); command.setPermissionMessage(permissionsMessage); command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.0", "mcstats")); - command.setExecutor(new McstatsCommand()); + command.setExecutor(new SkillStatsCommand()); } private void registerMctopCommand() { @@ -270,7 +270,7 @@ public final class CommandRegistrationManager { command.setPermission("mcmmo.commands.mctop"); // Only need the main one, not the individual skill ones command.setPermissionMessage(permissionsMessage); command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.2", "mctop", "[" + pluginRef.getLocaleManager().getString("Commands.Usage.Skill") + "]", "[" + pluginRef.getLocaleManager().getString("Commands.Usage.Page") + "]")); - command.setExecutor(new MctopCommand()); + command.setExecutor(new LeaderboardCommand()); } private void registerMcpurgeCommand() { @@ -279,7 +279,7 @@ public final class CommandRegistrationManager { command.setPermission("mcmmo.commands.mcpurge"); command.setPermissionMessage(permissionsMessage); command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.0", "mcpurge")); - command.setExecutor(new McpurgeCommand()); + command.setExecutor(new PurgeCommand()); } private void registerMcremoveCommand() { @@ -297,7 +297,7 @@ public final class CommandRegistrationManager { command.setPermission("mcmmo.commands.mmoshowdb"); command.setPermissionMessage(permissionsMessage); command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.0", "mmoshowdb")); - command.setExecutor(new MmoshowdbCommand()); + command.setExecutor(new ShowDatabaseCommand()); } private void registerMcconvertCommand() { @@ -307,7 +307,7 @@ public final class CommandRegistrationManager { command.setPermissionMessage(permissionsMessage); command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.2", "mcconvert", "database", "")); command.setUsage(command.getUsage() + "\n" + pluginRef.getLocaleManager().getString("Commands.Usage.2", "mcconvert", "experience", "")); - command.setExecutor(new McconvertCommand()); + command.setExecutor(new ConvertCommand()); } private void registerAdminChatCommand() { @@ -379,7 +379,7 @@ public final class CommandRegistrationManager { command.setPermission("mcmmo.commands.mcnotify"); command.setPermissionMessage(permissionsMessage); command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.0", "mcnotify")); - command.setExecutor(new McnotifyCommand()); + command.setExecutor(new ChatNotificationToggleCommand()); } private void registerMHDCommand() { @@ -398,7 +398,7 @@ public final class CommandRegistrationManager { command.setPermissionMessage(permissionsMessage); command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.1", "mcscoreboard", "")); command.setUsage(command.getUsage() + "\n" + pluginRef.getLocaleManager().getString("Commands.Usage.2", "mcscoreboard", "time", "")); - command.setExecutor(new McscoreboardCommand()); + command.setExecutor(new ScoreboardCommand()); } private void registerMcImportCommand() { @@ -416,7 +416,7 @@ public final class CommandRegistrationManager { command.setPermission("mcmmo.commands.reloadlocale"); command.setPermissionMessage(permissionsMessage); command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.0", "mcmmoreloadlocale")); - command.setExecutor(new McmmoReloadLocaleCommand()); + command.setExecutor(new ReloadLocaleCommand()); } public void registerCommands() { diff --git a/src/main/java/com/gmail/nossr50/util/commands/CommandTools.java b/src/main/java/com/gmail/nossr50/util/commands/CommandTools.java index b34fa19da..510adb36d 100644 --- a/src/main/java/com/gmail/nossr50/util/commands/CommandTools.java +++ b/src/main/java/com/gmail/nossr50/util/commands/CommandTools.java @@ -61,15 +61,6 @@ public final class CommandTools { return true; } - public boolean isOffline(CommandSender sender, OfflinePlayer player) { - if (player.isOnline()) { - return false; - } - - sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Offline")); - return true; - } - /** * Checks if there is a valid mcMMOPlayer object. *