Security Fix: added missing permission check for enable/disable border

This commit is contained in:
Paul Schulze 2013-02-20 15:59:58 +01:00
parent 0176ec3a3a
commit c671f04f65
2 changed files with 13 additions and 4 deletions

View File

@ -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);
}

View File

@ -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.";