From 0fa8faa6759157a7e4df8578d2629ecde9ede7cb Mon Sep 17 00:00:00 2001 From: Ziggeh Date: Tue, 12 Aug 2014 14:34:46 +0200 Subject: [PATCH] Fixed an issue where non-admins could use admin commands --- src/services/command/CommandService.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/services/command/CommandService.java b/src/services/command/CommandService.java index 404c09e4..6842c5e3 100644 --- a/src/services/command/CommandService.java +++ b/src/services/command/CommandService.java @@ -688,13 +688,14 @@ public class CommandService implements INetworkDispatch { public void processCommand(CreatureObject actor, SWGObject target, BaseSWGCommand command, int actionCounter, String commandArgs) { - if (command.getGodLevel() > 0 || command.getCommandName().equals("setgodmode")) { // TODO: When loading commands, simply don't put the "admin" characterAbility into the commands + if (command.getGodLevel() > 0 || command.getCommandName().equals("setgodmode")) { String accessLevel = core.adminService.getAccessLevelFromDB(actor.getClient().getAccountId()); - - if(accessLevel != null) { + String filePath = "accesslevels/" + accessLevel + ".txt"; + System.out.println(command.getCommandName() + " was just used by an admin with accessLevel: " + accessLevel + "."); + if(FileUtilities.doesFileExist(filePath)) { Scanner scanner; try { - scanner = new Scanner(new File("accesslevels/" + accessLevel + ".txt")); + scanner = new Scanner(new File(filePath)); boolean levelHasCommand = false; while(scanner.hasNextLine()) { @@ -714,7 +715,8 @@ public class CommandService implements INetworkDispatch { // TODO Auto-generated catch block e.printStackTrace(); } - } + } else + return; } if (command.getCooldown() > 0f) {