From c671f04f65cc4730367b3ff9559e496df484a7ce Mon Sep 17 00:00:00 2001 From: Paul Schulze Date: Wed, 20 Feb 2013 15:59:58 +0100 Subject: [PATCH] Security Fix: added missing permission check for enable/disable border --- .../de/craftinc/borderprotection/Commands.java | 15 ++++++++++++--- .../de/craftinc/borderprotection/Messages.java | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/craftinc/borderprotection/Commands.java b/src/main/java/de/craftinc/borderprotection/Commands.java index 2db04c2..7ef00dd 100644 --- a/src/main/java/de/craftinc/borderprotection/Commands.java +++ b/src/main/java/de/craftinc/borderprotection/Commands.java @@ -127,15 +127,24 @@ public class Commands implements CommandExecutor // on if ( args.length == 1 && ( args[0].equalsIgnoreCase("on") || args[0].equalsIgnoreCase("off") ) ) { + if ( !sender.hasPermission("craftinc.borderprotection.set") ) + { + sender.sendMessage(Messages.noPermissionSet); + return false; + } + World world = ( (Player) sender ).getWorld(); Border border = Border.getBorders().get(world); - if (border != null) + if ( border != null ) { - if (args[0].equalsIgnoreCase("on")) { + if ( args[0].equalsIgnoreCase("on") ) + { border.enable(); sender.sendMessage(Messages.borderEnabled); - } else { + } + else + { border.disable(); sender.sendMessage(Messages.borderDisabled); } diff --git a/src/main/java/de/craftinc/borderprotection/Messages.java b/src/main/java/de/craftinc/borderprotection/Messages.java index f63a069..94b37a8 100644 --- a/src/main/java/de/craftinc/borderprotection/Messages.java +++ b/src/main/java/de/craftinc/borderprotection/Messages.java @@ -95,7 +95,7 @@ public class Messages ChatColor.YELLOW + "No border in this world."; public static String noPermissionSet = - ChatColor.RED + "Sorry, you don't have permission to set the border."; + ChatColor.RED + "Sorry, you don't have permission to change the border."; public static String borderEnabled = ChatColor.YELLOW + "Border enabled.";