Security Fix: added missing permission check for enable/disable border
This commit is contained in:
parent
0176ec3a3a
commit
c671f04f65
@ -127,15 +127,24 @@ public class Commands implements CommandExecutor
|
|||||||
// on
|
// on
|
||||||
if ( args.length == 1 && ( args[0].equalsIgnoreCase("on") || args[0].equalsIgnoreCase("off") ) )
|
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();
|
World world = ( (Player) sender ).getWorld();
|
||||||
Border border = Border.getBorders().get(world);
|
Border border = Border.getBorders().get(world);
|
||||||
|
|
||||||
if ( border != null )
|
if ( border != null )
|
||||||
{
|
{
|
||||||
if (args[0].equalsIgnoreCase("on")) {
|
if ( args[0].equalsIgnoreCase("on") )
|
||||||
|
{
|
||||||
border.enable();
|
border.enable();
|
||||||
sender.sendMessage(Messages.borderEnabled);
|
sender.sendMessage(Messages.borderEnabled);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
border.disable();
|
border.disable();
|
||||||
sender.sendMessage(Messages.borderDisabled);
|
sender.sendMessage(Messages.borderDisabled);
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ public class Messages
|
|||||||
ChatColor.YELLOW + "No border in this world.";
|
ChatColor.YELLOW + "No border in this world.";
|
||||||
|
|
||||||
public static String noPermissionSet =
|
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 =
|
public static String borderEnabled =
|
||||||
ChatColor.YELLOW + "Border enabled.";
|
ChatColor.YELLOW + "Border enabled.";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user