Code review

This commit is contained in:
Telesphoreo 2022-04-12 21:20:56 -05:00
parent 6763878d74
commit 223eaf30b3
8 changed files with 10 additions and 12 deletions

View File

@ -130,7 +130,7 @@ public class Plex extends JavaPlugin
if (!setupPermissions() && system.equalsIgnoreCase("permissions") && !getServer().getPluginManager().isPluginEnabled("Vault")) 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(); updateChecker = new UpdateChecker();

View File

@ -25,7 +25,7 @@ public class ConsoleSayCommand extends PlexCommand
return usage(); 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; return null;
} }
} }

View File

@ -22,7 +22,7 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@CommandParameters(name = "pdebug", description = "Plex's debug command", usage = "/<command> <redis-reset <player> | gamerules>") @CommandParameters(name = "pdebug", description = "Plex's debug command", usage = "/<command> <aliases <command> | redis-reset <player> | gamerules>")
@CommandPermissions(level = Rank.EXECUTIVE, permission = "plex.debug") @CommandPermissions(level = Rank.EXECUTIVE, permission = "plex.debug")
@System(debug = true) @System(debug = true)
public class DebugCMD extends PlexCommand public class DebugCMD extends PlexCommand

View File

@ -52,14 +52,13 @@ public class PlexCMD extends PlexCommand
plugin.getPunishmentManager().mergeIndefiniteBans(); plugin.getPunishmentManager().mergeIndefiniteBans();
send(sender, "Reloaded indefinite bans"); send(sender, "Reloaded indefinite bans");
plugin.commands.load(); plugin.commands.load();
// plugin.getCommandBlockerManager().syncCommands();
send(sender, "Reloaded blocked commands file"); send(sender, "Reloaded blocked commands file");
plugin.getRankManager().importDefaultRanks(); plugin.getRankManager().importDefaultRanks();
send(sender, "Imported ranks"); send(sender, "Imported ranks");
plugin.setSystem(plugin.config.getString("system")); plugin.setSystem(plugin.config.getString("system"));
if (!plugin.setupPermissions() && plugin.getSystem().equalsIgnoreCase("permissions") && !plugin.getServer().getPluginManager().isPluginEnabled("Vault")) 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().endServices();
plugin.getServiceManager().startServices(); plugin.getServiceManager().startServices();

View File

@ -26,7 +26,7 @@ public class SayCMD extends PlexCommand
return usage(); 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; return null;
} }
} }

View File

@ -27,7 +27,6 @@ public class CommandBlockerService extends AbstractService
public void run() public void run()
{ {
BLOCKED_COMMANDS.clear(); BLOCKED_COMMANDS.clear();
PlexLog.debug("RUNNING COMMAND BLOCKING SERVICE");
plugin.commands.getStringList("commands").forEach(s -> plugin.commands.getStringList("commands").forEach(s ->
{ {
BlockedCommand command = new BlockedCommand(); BlockedCommand command = new BlockedCommand();
@ -44,7 +43,8 @@ public class CommandBlockerService extends AbstractService
PlexLog.debug(" Regex: " + command.getRegex()); PlexLog.debug(" Regex: " + command.getRegex());
PlexLog.debug(" Message: " + command.getMessage()); PlexLog.debug(" Message: " + command.getMessage());
PlexLog.debug("====================");*/ PlexLog.debug("====================");*/
} else if (s.toLowerCase(Locale.ROOT).startsWith("m")) }
else if (s.toLowerCase(Locale.ROOT).startsWith("m"))
{ {
command.setRequiredLevel(args[1]); command.setRequiredLevel(args[1]);
command.setCommand(args[2]); command.setCommand(args[2]);
@ -52,7 +52,7 @@ public class CommandBlockerService extends AbstractService
Command cmd = plugin.getServer().getCommandMap().getCommand(command.getCommand().split(" ")[0]); Command cmd = plugin.getServer().getCommandMap().getCommand(command.getCommand().split(" ")[0]);
if (cmd == null) 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; return;
} }
command.setCommandAliases(cmd.getAliases()); command.setCommandAliases(cmd.getAliases());

View File

@ -432,7 +432,6 @@ public class PlexUtils extends PlexBase
Bukkit.broadcast(component)); Bukkit.broadcast(component));
} }
public static Object simpleGET(String url) public static Object simpleGET(String url)
{ {
try try

View File

@ -170,7 +170,7 @@ allowDropsEnabled: "<gray>Now allowing drops from players."
commandBlocked: "<gray>That command is blocked." commandBlocked: "<gray>That command is blocked."
# 0 - The command sender # 0 - The command sender
# 1 - The message being said # 1 - The message being said
sayCommand: "<blue>[Server: {0}] {1}" sayMessage: "<blue>[Server: {0}] {1}"
# 0 - The command sender # 0 - The command sender
# 1 - The message being said # 1 - The message being said
consoleSayCommand: "<gray>[Console: {0}] <white>{1}" consoleSayMessage: "<gray>[Console: {0}] <white>{1}"