From 223eaf30b3413be4775910fa8cb6f0e6f17797df Mon Sep 17 00:00:00 2001 From: Telesphoreo Date: Tue, 12 Apr 2022 21:20:56 -0500 Subject: [PATCH] Code review --- src/main/java/dev/plex/Plex.java | 2 +- src/main/java/dev/plex/command/impl/ConsoleSayCommand.java | 2 +- src/main/java/dev/plex/command/impl/DebugCMD.java | 2 +- src/main/java/dev/plex/command/impl/PlexCMD.java | 3 +-- src/main/java/dev/plex/command/impl/SayCMD.java | 2 +- .../java/dev/plex/services/impl/CommandBlockerService.java | 6 +++--- src/main/java/dev/plex/util/PlexUtils.java | 1 - src/main/resources/messages.yml | 4 ++-- 8 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/main/java/dev/plex/Plex.java b/src/main/java/dev/plex/Plex.java index 8e476d7..4214503 100644 --- a/src/main/java/dev/plex/Plex.java +++ b/src/main/java/dev/plex/Plex.java @@ -130,7 +130,7 @@ public class Plex extends JavaPlugin if (!setupPermissions() && system.equalsIgnoreCase("permissions") && !getServer().getPluginManager().isPluginEnabled("Vault")) { - throw new RuntimeException("Vault is required to run on the server if you use 'permissions!'"); + throw new RuntimeException("Vault is required to run on the server if you use permissions!"); } updateChecker = new UpdateChecker(); diff --git a/src/main/java/dev/plex/command/impl/ConsoleSayCommand.java b/src/main/java/dev/plex/command/impl/ConsoleSayCommand.java index 29a16b4..2b00254 100644 --- a/src/main/java/dev/plex/command/impl/ConsoleSayCommand.java +++ b/src/main/java/dev/plex/command/impl/ConsoleSayCommand.java @@ -25,7 +25,7 @@ public class ConsoleSayCommand extends PlexCommand return usage(); } - PlexUtils.broadcast(PlexUtils.messageComponent("consoleSayCommand", sender.getName(), PlexUtils.mmStripColor(StringUtils.join(args, " ")))); + PlexUtils.broadcast(PlexUtils.messageComponent("consoleSayMessage", sender.getName(), PlexUtils.mmStripColor(StringUtils.join(args, " ")))); return null; } } \ No newline at end of file diff --git a/src/main/java/dev/plex/command/impl/DebugCMD.java b/src/main/java/dev/plex/command/impl/DebugCMD.java index bf00bc5..10a8dc6 100644 --- a/src/main/java/dev/plex/command/impl/DebugCMD.java +++ b/src/main/java/dev/plex/command/impl/DebugCMD.java @@ -22,7 +22,7 @@ import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -@CommandParameters(name = "pdebug", description = "Plex's debug command", usage = "/ | gamerules>") +@CommandParameters(name = "pdebug", description = "Plex's debug command", usage = "/ | redis-reset | gamerules>") @CommandPermissions(level = Rank.EXECUTIVE, permission = "plex.debug") @System(debug = true) public class DebugCMD extends PlexCommand diff --git a/src/main/java/dev/plex/command/impl/PlexCMD.java b/src/main/java/dev/plex/command/impl/PlexCMD.java index 9b86eda..c4e7fae 100644 --- a/src/main/java/dev/plex/command/impl/PlexCMD.java +++ b/src/main/java/dev/plex/command/impl/PlexCMD.java @@ -52,14 +52,13 @@ public class PlexCMD extends PlexCommand plugin.getPunishmentManager().mergeIndefiniteBans(); send(sender, "Reloaded indefinite bans"); plugin.commands.load(); -// plugin.getCommandBlockerManager().syncCommands(); send(sender, "Reloaded blocked commands file"); plugin.getRankManager().importDefaultRanks(); send(sender, "Imported ranks"); plugin.setSystem(plugin.config.getString("system")); if (!plugin.setupPermissions() && plugin.getSystem().equalsIgnoreCase("permissions") && !plugin.getServer().getPluginManager().isPluginEnabled("Vault")) { - throw new RuntimeException("Vault is required to run on the server if you use 'permissions!'"); + throw new RuntimeException("Vault is required to run on the server if you use permissions!"); } plugin.getServiceManager().endServices(); plugin.getServiceManager().startServices(); diff --git a/src/main/java/dev/plex/command/impl/SayCMD.java b/src/main/java/dev/plex/command/impl/SayCMD.java index cc3e339..4314faa 100644 --- a/src/main/java/dev/plex/command/impl/SayCMD.java +++ b/src/main/java/dev/plex/command/impl/SayCMD.java @@ -26,7 +26,7 @@ public class SayCMD extends PlexCommand return usage(); } - PlexUtils.broadcast(PlexUtils.messageComponent("sayCommand", sender.getName(), PlexUtils.mmStripColor(StringUtils.join(args, " ")))); + PlexUtils.broadcast(PlexUtils.messageComponent("sayMessage", sender.getName(), PlexUtils.mmStripColor(StringUtils.join(args, " ")))); return null; } } \ No newline at end of file diff --git a/src/main/java/dev/plex/services/impl/CommandBlockerService.java b/src/main/java/dev/plex/services/impl/CommandBlockerService.java index eaefd0f..79e5931 100644 --- a/src/main/java/dev/plex/services/impl/CommandBlockerService.java +++ b/src/main/java/dev/plex/services/impl/CommandBlockerService.java @@ -27,7 +27,6 @@ public class CommandBlockerService extends AbstractService public void run() { BLOCKED_COMMANDS.clear(); - PlexLog.debug("RUNNING COMMAND BLOCKING SERVICE"); plugin.commands.getStringList("commands").forEach(s -> { BlockedCommand command = new BlockedCommand(); @@ -44,7 +43,8 @@ public class CommandBlockerService extends AbstractService PlexLog.debug(" Regex: " + command.getRegex()); PlexLog.debug(" Message: " + command.getMessage()); PlexLog.debug("====================");*/ - } else if (s.toLowerCase(Locale.ROOT).startsWith("m")) + } + else if (s.toLowerCase(Locale.ROOT).startsWith("m")) { command.setRequiredLevel(args[1]); command.setCommand(args[2]); @@ -52,7 +52,7 @@ public class CommandBlockerService extends AbstractService Command cmd = plugin.getServer().getCommandMap().getCommand(command.getCommand().split(" ")[0]); if (cmd == null) { - PlexLog.error("Command '{0}' specified in the configuration was null!", command.getCommand().split(" ")[0]); + PlexLog.error("Command '{0}' does not belong to any plugin!", command.getCommand().split(" ")[0]); return; } command.setCommandAliases(cmd.getAliases()); diff --git a/src/main/java/dev/plex/util/PlexUtils.java b/src/main/java/dev/plex/util/PlexUtils.java index b593412..750850a 100644 --- a/src/main/java/dev/plex/util/PlexUtils.java +++ b/src/main/java/dev/plex/util/PlexUtils.java @@ -432,7 +432,6 @@ public class PlexUtils extends PlexBase Bukkit.broadcast(component)); } - public static Object simpleGET(String url) { try diff --git a/src/main/resources/messages.yml b/src/main/resources/messages.yml index effd0bc..7f09924 100644 --- a/src/main/resources/messages.yml +++ b/src/main/resources/messages.yml @@ -170,7 +170,7 @@ allowDropsEnabled: "Now allowing drops from players." commandBlocked: "That command is blocked." # 0 - The command sender # 1 - The message being said -sayCommand: "[Server: {0}] {1}" +sayMessage: "[Server: {0}] {1}" # 0 - The command sender # 1 - The message being said -consoleSayCommand: "[Console: {0}] {1}" \ No newline at end of file +consoleSayMessage: "[Console: {0}] {1}" \ No newline at end of file