Polish up border bypass handling a bit

This commit is contained in:
Brettflan 2012-11-04 15:48:16 -06:00
parent 243e23f9a2
commit 28e5ea7019
3 changed files with 9 additions and 3 deletions

View File

@ -47,7 +47,7 @@ public class BorderCheckTask implements Runnable
return null; return null;
// if player has "worldborder.bypass" permission, allow them beyond border // if player has "worldborder.bypass" permission, allow them beyond border
if (Config.HasPermission(player, "bypass")) if (Config.HasPermission(player, "bypass", false))
return null; return null;
Location newLoc = newLocation(player, loc, border); Location newLoc = newLocation(player, loc, border);

View File

@ -280,6 +280,10 @@ public class Config
public static boolean HasPermission(Player player, String request) public static boolean HasPermission(Player player, String request)
{
return HasPermission(player, request, true);
}
public static boolean HasPermission(Player player, String request, boolean notify)
{ {
if (player == null) // console, always permitted if (player == null) // console, always permitted
return true; return true;
@ -287,7 +291,9 @@ public class Config
if (player.hasPermission("worldborder." + request)) // built-in Bukkit superperms if (player.hasPermission("worldborder." + request)) // built-in Bukkit superperms
return true; return true;
if (notify)
player.sendMessage("You do not have sufficient permissions."); player.sendMessage("You do not have sufficient permissions.");
return false; return false;
} }

View File

@ -107,4 +107,4 @@ permissions:
default: op default: op
worldborder.bypass: worldborder.bypass:
description: Can go beyond the border without being knocked back description: Can go beyond the border without being knocked back
default: none default: false