mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-25 12:15:12 +01:00
No longer using Vault for perms, only economy
This commit is contained in:
parent
83e35523b7
commit
fe07c8ef45
@ -71,8 +71,6 @@ public class BSkyBlock extends JavaPlugin implements BSModule {
|
||||
Settings.useEconomy = false;
|
||||
}
|
||||
|
||||
VaultHelper.setupPermissions();
|
||||
|
||||
// Set up commands
|
||||
commandsManager = new CommandsManager();
|
||||
commandsManager.registerCommand(this, new IslandCommand());
|
||||
|
@ -22,10 +22,6 @@ import us.tastybento.bskyblock.util.VaultHelper;
|
||||
*/
|
||||
public class IslandCreateCommand extends CommandArgument {
|
||||
|
||||
/**
|
||||
* @param label
|
||||
* @param aliases
|
||||
*/
|
||||
public IslandCreateCommand() {
|
||||
super("create", "auto");
|
||||
}
|
||||
@ -41,7 +37,7 @@ public class IslandCreateCommand extends CommandArgument {
|
||||
}
|
||||
Player player = (Player)sender;
|
||||
|
||||
if (!VaultHelper.hasPerm(player, Settings.PERMPREFIX + "island.create")) {
|
||||
if (!player.hasPermission(Settings.PERMPREFIX + "island.create")) {
|
||||
sender.sendMessage(ChatColor.RED + getLocale(sender).get("general.errors.no-permission"));
|
||||
}
|
||||
if (getIslands().hasIsland(player.getUniqueId())) {
|
||||
|
@ -21,10 +21,6 @@ import us.tastybento.bskyblock.util.VaultHelper;
|
||||
*/
|
||||
public class IslandGoCommand extends CommandArgument {
|
||||
|
||||
/**
|
||||
* @param label
|
||||
* @param aliases
|
||||
*/
|
||||
public IslandGoCommand() {
|
||||
super("go", "home", "h");
|
||||
}
|
||||
@ -39,7 +35,7 @@ public class IslandGoCommand extends CommandArgument {
|
||||
return true;
|
||||
}
|
||||
Player player = (Player)sender;
|
||||
if (!VaultHelper.hasPerm(player, Settings.PERMPREFIX + "island.home")) {
|
||||
if (!player.hasPermission(Settings.PERMPREFIX + "island.home")) {
|
||||
sender.sendMessage(ChatColor.RED + getLocale(sender).get("general.errors.no-permission"));
|
||||
return true;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public class IslandResetCommand extends CommandArgument {
|
||||
return true;
|
||||
}
|
||||
Player player = (Player)sender;
|
||||
if (!VaultHelper.hasPerm(player, Settings.PERMPREFIX + "island.reset")) {
|
||||
if (!player.hasPermission(Settings.PERMPREFIX + "island.reset")) {
|
||||
sender.sendMessage(getLocale(sender).get("general.errors.no-permission"));
|
||||
return true;
|
||||
}
|
||||
|
@ -20,10 +20,6 @@ import us.tastybento.bskyblock.util.VaultHelper;
|
||||
*/
|
||||
public class IslandResetnameCommand extends CommandArgument {
|
||||
|
||||
/**
|
||||
* @param label
|
||||
* @param aliases
|
||||
*/
|
||||
public IslandResetnameCommand() {
|
||||
super("setname");
|
||||
}
|
||||
@ -40,7 +36,7 @@ public class IslandResetnameCommand extends CommandArgument {
|
||||
Player player = (Player)sender;
|
||||
UUID playerUUID = player.getUniqueId();
|
||||
|
||||
if (!VaultHelper.hasPerm(player, Settings.PERMPREFIX + "island.name")) {
|
||||
if (!player.hasPermission(Settings.PERMPREFIX + "island.name")) {
|
||||
sender.sendMessage(ChatColor.RED + getLocale(sender).get("general.errors.no-permission"));
|
||||
return true;
|
||||
}
|
||||
@ -75,7 +71,7 @@ public class IslandResetnameCommand extends CommandArgument {
|
||||
}
|
||||
|
||||
// Set the name
|
||||
if (VaultHelper.hasPerm(player, Settings.PERMPREFIX + "island.name.format"))
|
||||
if (!player.hasPermission(Settings.PERMPREFIX + "island.name.format"))
|
||||
getIslands().getIsland(player.getUniqueId()).setName(ChatColor.translateAlternateColorCodes('&', name));
|
||||
else getIslands().getIsland(playerUUID).setName(name);
|
||||
|
||||
|
@ -26,7 +26,7 @@ public class IslandSethomeCommand extends CommandArgument {
|
||||
}
|
||||
Player player = (Player)sender;
|
||||
UUID playerUUID = player.getUniqueId();
|
||||
if (!VaultHelper.hasPerm(player, Settings.PERMPREFIX + "island.sethome")) {
|
||||
if (!player.hasPermission(Settings.PERMPREFIX + "island.sethome")) {
|
||||
sender.sendMessage(ChatColor.RED + getLocale(sender).get("general.errors.no-permission"));
|
||||
return true;
|
||||
}
|
||||
|
@ -20,10 +20,6 @@ import us.tastybento.bskyblock.util.VaultHelper;
|
||||
*/
|
||||
public class IslandSetnameCommand extends CommandArgument {
|
||||
|
||||
/**
|
||||
* @param label
|
||||
* @param aliases
|
||||
*/
|
||||
public IslandSetnameCommand() {
|
||||
super("resetname");
|
||||
}
|
||||
@ -40,7 +36,7 @@ public class IslandSetnameCommand extends CommandArgument {
|
||||
Player player = (Player)sender;
|
||||
UUID playerUUID = player.getUniqueId();
|
||||
|
||||
if (!VaultHelper.hasPerm(player, Settings.PERMPREFIX + "island.name")) {
|
||||
if (!player.hasPermission(Settings.PERMPREFIX + "island.name")) {
|
||||
sender.sendMessage(ChatColor.RED + getLocale(sender).get("general.errors.no-permission"));
|
||||
return true;
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public abstract class AbstractIslandTeamCommandArgument extends CommandArgument
|
||||
}
|
||||
player = (Player)sender;
|
||||
playerUUID = player.getUniqueId();
|
||||
if (!VaultHelper.hasPerm(player, Settings.PERMPREFIX + "team")) {
|
||||
if (!player.hasPermission(Settings.PERMPREFIX + "team")) {
|
||||
sender.sendMessage(ChatColor.RED + getLocale(sender).get("general.errors.no-permission"));
|
||||
return false;
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ public class IslandTeamUninviteCommand extends AbstractIslandTeamCommandArgument
|
||||
}
|
||||
Player player = (Player)sender;
|
||||
UUID playerUUID = player.getUniqueId();
|
||||
if (!VaultHelper.hasPerm(player, Settings.PERMPREFIX + "team")) {
|
||||
if (!player.hasPermission(Settings.PERMPREFIX + "team")) {
|
||||
sender.sendMessage(ChatColor.RED + getLocale(sender).get("general.errors.no-permission"));
|
||||
return true;
|
||||
}
|
||||
|
@ -507,7 +507,7 @@ public class PlayersManager{
|
||||
addPlayer(targetUUID);
|
||||
// Check if the target player has a permission bypass (admin.noban)
|
||||
Player target = plugin.getServer().getPlayer(targetUUID);
|
||||
if (target != null && VaultHelper.hasPerm(target, Settings.PERMPREFIX + "admin.noban")) {
|
||||
if (target != null && target.hasPermission(Settings.PERMPREFIX + "admin.noban")) {
|
||||
return false;
|
||||
}
|
||||
Island island = plugin.getIslands().getIsland(playerUUID);
|
||||
|
@ -73,8 +73,7 @@ public class JoinLeaveListener implements Listener {
|
||||
if (currentIsland != null && (currentIsland.isLocked() || plugin.getPlayers().isBanned(currentIsland.getOwner(),player.getUniqueId()))) {
|
||||
if (DEBUG)
|
||||
plugin.getLogger().info("DEBUG: Current island is locked, or player is banned");
|
||||
if (!currentIsland.getMembers().contains(playerUUID) && !player.isOp()
|
||||
&& !VaultHelper.hasPerm(player, Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
if (!currentIsland.getMembers().contains(playerUUID) && !player.hasPermission(Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
if (DEBUG)
|
||||
plugin.getLogger().info("DEBUG: No bypass - teleporting");
|
||||
player.sendMessage(plugin.getLocale(player).get("locked.islandlocked"));
|
||||
|
@ -118,7 +118,7 @@ public class NetherPortals implements Listener {
|
||||
// Portals use is not allowed
|
||||
if (DEBUG)
|
||||
plugin.getLogger().info("DEBUG: Portal use not allowed");
|
||||
if (!event.getPlayer().isOp() && !VaultHelper.hasPerm(event.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
if (!event.getPlayer().hasPermission(Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
event.getPlayer().sendMessage(plugin.getLocale(event.getPlayer()).get("island.protected"));
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
|
@ -138,7 +138,7 @@ public class IslandGuard implements Listener {
|
||||
return actionAllowed(location, flag);
|
||||
}
|
||||
// This permission bypasses protection
|
||||
if (player.isOp() || VaultHelper.hasPerm(player, Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
if (player.hasPermission(Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
return true;
|
||||
}
|
||||
Island island = plugin.getIslands().getProtectedIslandAt(location);
|
||||
@ -226,9 +226,9 @@ public class IslandGuard implements Listener {
|
||||
if (islandTo != null && (islandTo.getOwner() != null || islandTo.isSpawn())) {
|
||||
// Lock check
|
||||
if (islandTo.isLocked() || plugin.getPlayers().isBanned(islandTo.getOwner(),player.getUniqueId())) {
|
||||
if (!islandTo.getMembers().contains(player.getUniqueId()) && !player.isOp()
|
||||
&& !VaultHelper.hasPerm(player, Settings.PERMPREFIX + "mod.bypassprotect")
|
||||
&& !VaultHelper.hasPerm(player, Settings.PERMPREFIX + "mod.bypasslock")) {
|
||||
if (!islandTo.getMembers().contains(player.getUniqueId())
|
||||
&& !player.hasPermission(Settings.PERMPREFIX + "mod.bypassprotect")
|
||||
&& !player.hasPermission(Settings.PERMPREFIX + "mod.bypasslock")) {
|
||||
player.sendMessage(plugin.getLocale(player.getUniqueId()).get("lock.islandlocked"));
|
||||
// Get the vector away from this island
|
||||
Vector v = e.getVehicle().getLocation().toVector().subtract(islandTo.getCenter().toVector()).normalize().multiply(new Vector(1.2,0,1.2));
|
||||
@ -340,9 +340,9 @@ public class IslandGuard implements Listener {
|
||||
if (islandTo != null && (islandTo.getOwner() != null || islandTo.isSpawn())) {
|
||||
// Lock check
|
||||
if (islandTo.isLocked() || plugin.getPlayers().isBanned(islandTo.getOwner(),e.getPlayer().getUniqueId())) {
|
||||
if (!islandTo.getMembers().contains(e.getPlayer().getUniqueId()) && !e.getPlayer().isOp()
|
||||
&& !VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")
|
||||
&& !VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypasslock")) {
|
||||
if (!islandTo.getMembers().contains(e.getPlayer().getUniqueId())
|
||||
&& !e.getPlayer().hasPermission(Settings.PERMPREFIX + "mod.bypassprotect")
|
||||
&& !e.getPlayer().hasPermission(Settings.PERMPREFIX + "mod.bypasslock")) {
|
||||
e.getPlayer().sendMessage(plugin.getLocale(e.getPlayer().getUniqueId()).get("lock.islandlocked"));
|
||||
|
||||
// Get the vector away from this island
|
||||
@ -830,7 +830,7 @@ public class IslandGuard implements Listener {
|
||||
// Ops can do anything
|
||||
if (e.getDamager() instanceof Player) {
|
||||
Player p = (Player) e.getDamager();
|
||||
if (p.isOp() || VaultHelper.hasPerm(p, Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
if (p.hasPermission(Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -977,7 +977,7 @@ public class IslandGuard implements Listener {
|
||||
// plugin.getLogger().info(e.getEventName());
|
||||
if (Util.inWorld(e.getPlayer())) {
|
||||
// This permission bypasses protection
|
||||
if (e.getPlayer().isOp() || VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
if (e.getPlayer().hasPermission(Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
return;
|
||||
}
|
||||
//plugin.getLogger().info("DEBUG: checking is inside protection area");
|
||||
@ -1038,7 +1038,7 @@ public class IslandGuard implements Listener {
|
||||
// plugin.getLogger().info(e.getEventName());
|
||||
if (Util.inWorld(e.getPlayer())) {
|
||||
// This permission bypasses protection
|
||||
if (e.getPlayer().isOp() || VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
if (e.getPlayer().hasPermission(Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
return;
|
||||
}
|
||||
Island island = plugin.getIslands().getProtectedIslandAt(e.getBlock().getLocation());
|
||||
@ -1116,7 +1116,7 @@ public class IslandGuard implements Listener {
|
||||
// plugin.getLogger().info(e.getEventName());
|
||||
if (Util.inWorld(e.getPlayer())) {
|
||||
// This permission bypasses protection
|
||||
if (e.getPlayer().isOp() || VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
if (e.getPlayer().hasPermission(Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
return;
|
||||
}
|
||||
Island island = plugin.getIslands().getProtectedIslandAt(e.getBlock().getLocation());
|
||||
@ -1209,7 +1209,7 @@ public class IslandGuard implements Listener {
|
||||
if (e.getRemover() instanceof Player) {
|
||||
Player p = (Player) e.getRemover();
|
||||
// This permission bypasses protection
|
||||
if (p.isOp() || VaultHelper.hasPerm(p, Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
if (p.hasPermission(Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
return;
|
||||
}
|
||||
if (actionAllowed(p,e.getEntity().getLocation(),SettingsFlag.BREAK_BLOCKS)) {
|
||||
@ -1391,7 +1391,7 @@ public class IslandGuard implements Listener {
|
||||
}
|
||||
if (Util.inWorld(e.getPlayer())) {
|
||||
// This permission bypasses protection
|
||||
if (VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
if (e.getPlayer().hasPermission(Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
return;
|
||||
}
|
||||
Island island = plugin.getIslands().getProtectedIslandAt(e.getBlockClicked().getLocation());
|
||||
@ -1452,7 +1452,7 @@ public class IslandGuard implements Listener {
|
||||
if (!Util.inWorld(e.getPlayer())) {
|
||||
return;
|
||||
}
|
||||
if (e.getPlayer().isOp() || VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
if (e.getPlayer().hasPermission(Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
return;
|
||||
}
|
||||
if ((e.getClickedBlock() != null && plugin.getIslands().locationIsOnIsland(e.getPlayer(), e.getClickedBlock().getLocation()))) {
|
||||
@ -1995,7 +1995,7 @@ public class IslandGuard implements Listener {
|
||||
if (!Util.inWorld(p)) {
|
||||
return;
|
||||
}
|
||||
if (p.isOp() || VaultHelper.hasPerm(p, Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
if (p.hasPermission(Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
// You can do anything if you are Op of have the bypass
|
||||
return;
|
||||
}
|
||||
@ -2210,7 +2210,7 @@ public class IslandGuard implements Listener {
|
||||
//plugin.getLogger().info("DEBUG: target block = " + e.getPlayer().getTargetBlock(transparent, 10));
|
||||
}
|
||||
// Check if this is allowed
|
||||
if (e.getPlayer() != null && (e.getPlayer().isOp() || VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypass"))) {
|
||||
if (e.getPlayer() != null && (e.getPlayer().hasPermission(Settings.PERMPREFIX + "mod.bypass"))) {
|
||||
return;
|
||||
}
|
||||
if (!actionAllowed(e.getBlock().getLocation(), SettingsFlag.FIRE)) {
|
||||
@ -2269,7 +2269,7 @@ public class IslandGuard implements Listener {
|
||||
plugin.getLogger().info("action = " + e.getAction());
|
||||
}
|
||||
if (!Util.inWorld(e.getPlayer()) || !e.getAction().equals(Action.PHYSICAL)
|
||||
|| e.getPlayer().isOp() || VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")
|
||||
|| e.getPlayer().hasPermission(Settings.PERMPREFIX + "mod.bypassprotect")
|
||||
|| plugin.getIslands().playerIsOnIsland(e.getPlayer())) {
|
||||
//plugin.getLogger().info("DEBUG: Not in world");
|
||||
return;
|
||||
@ -2341,7 +2341,7 @@ public class IslandGuard implements Listener {
|
||||
if (DEBUG) {
|
||||
plugin.getLogger().info("egg throwing = " + e.getEventName());
|
||||
}
|
||||
if (!Util.inWorld(e.getPlayer()) || e.getPlayer().isOp() || VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")
|
||||
if (!Util.inWorld(e.getPlayer()) || e.getPlayer().hasPermission(Settings.PERMPREFIX + "mod.bypassprotect")
|
||||
|| plugin.getIslands().playerIsOnIsland(e.getPlayer()) || plugin.getIslands().isAtSpawn(e.getPlayer().getLocation())) {
|
||||
return;
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public class IslandGuard1_8 implements Listener {
|
||||
*/
|
||||
private boolean actionAllowed(Player player, Location location, SettingsFlag flag) {
|
||||
// This permission bypasses protection
|
||||
if (player.isOp() || VaultHelper.hasPerm(player, Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
if (player.hasPermission(Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
return true;
|
||||
}
|
||||
Island island = plugin.getIslands().getProtectedIslandAt(location);
|
||||
@ -101,12 +101,8 @@ public class IslandGuard1_8 implements Listener {
|
||||
if (!Util.inWorld(e.getPlayer())) {
|
||||
return;
|
||||
}
|
||||
if (e.getPlayer().isOp()) {
|
||||
return;
|
||||
}
|
||||
// This permission bypasses protection
|
||||
if (VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")
|
||||
|| VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "craft.dirt")) {
|
||||
if (e.getPlayer().hasPermission(Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
return;
|
||||
}
|
||||
// Prevents tilling of coarse dirt into dirt
|
||||
@ -135,7 +131,7 @@ public class IslandGuard1_8 implements Listener {
|
||||
if (!Util.inWorld(p)) {
|
||||
return;
|
||||
}
|
||||
if (p.isOp() || VaultHelper.hasPerm(p, Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
if (p.hasPermission(Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
// You can do anything if you are Op
|
||||
return;
|
||||
}
|
||||
@ -188,7 +184,7 @@ public class IslandGuard1_8 implements Listener {
|
||||
}
|
||||
if (e.getDamager() instanceof Player) {
|
||||
Player p = (Player) e.getDamager();
|
||||
if (p.isOp() || VaultHelper.hasPerm(p, Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
if (p.hasPermission(Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
return;
|
||||
}
|
||||
// Check if on island
|
||||
|
@ -70,11 +70,8 @@ public class IslandGuard1_9 implements Listener {
|
||||
if (!Util.inWorld(player)) {
|
||||
return;
|
||||
}
|
||||
if (player.isOp()) {
|
||||
return;
|
||||
}
|
||||
// This permission bypasses protection
|
||||
if (VaultHelper.hasPerm(player, Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
if (player.hasPermission(Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
return;
|
||||
}
|
||||
// Check island
|
||||
@ -106,11 +103,8 @@ public class IslandGuard1_9 implements Listener {
|
||||
if (!Util.inWorld(e.getPlayer())) {
|
||||
return;
|
||||
}
|
||||
if (e.getPlayer().isOp()) {
|
||||
return;
|
||||
}
|
||||
// This permission bypasses protection
|
||||
if (VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
if (e.getPlayer().hasPermission(Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
return;
|
||||
}
|
||||
if (e.getRightClicked() != null && e.getRightClicked().getType().equals(EntityType.ENDER_CRYSTAL)) {
|
||||
@ -140,7 +134,7 @@ public class IslandGuard1_9 implements Listener {
|
||||
if (!Util.inWorld(p)) {
|
||||
return;
|
||||
}
|
||||
if (p.isOp() || VaultHelper.hasPerm(p, Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
if (p.hasPermission(Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
// You can do anything if you are Op
|
||||
return;
|
||||
}
|
||||
@ -217,7 +211,7 @@ public class IslandGuard1_9 implements Listener {
|
||||
}
|
||||
}
|
||||
if (p != null) {
|
||||
if (p.isOp() || VaultHelper.hasPerm(p, Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
if (p.hasPermission(Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
if (DEBUG) {
|
||||
plugin.getLogger().info("1.9 " +"Bypassing protection");
|
||||
}
|
||||
@ -320,12 +314,8 @@ public class IslandGuard1_9 implements Listener {
|
||||
if (!Util.inWorld(e.getPlayer())) {
|
||||
return;
|
||||
}
|
||||
if (e.getPlayer().isOp()) {
|
||||
return;
|
||||
}
|
||||
// This permission bypasses protection
|
||||
if (VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")
|
||||
|| VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "craft.dirt")) {
|
||||
if (e.getPlayer().hasPermission(Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
return;
|
||||
}
|
||||
// Prevents tilling of coarse dirt into dirt
|
||||
@ -453,7 +443,7 @@ public class IslandGuard1_9 implements Listener {
|
||||
return actionAllowed(location, flag);
|
||||
}
|
||||
// This permission bypasses protection
|
||||
if (player.isOp() || VaultHelper.hasPerm(player, Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
if (player.hasPermission(Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
return true;
|
||||
}
|
||||
Island island = plugin.getIslands().getProtectedIslandAt(location);
|
||||
|
@ -117,7 +117,7 @@ public class NetherEvents implements Listener {
|
||||
// plugin.getLogger().info("Block break");
|
||||
if ((e.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.worldName + "_nether") && !Settings.netherIslands)
|
||||
|| e.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.worldName + "_the_end")) {
|
||||
if (VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
if (e.getPlayer().hasPermission(Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
return;
|
||||
}
|
||||
if (DEBUG)
|
||||
@ -142,7 +142,7 @@ public class NetherEvents implements Listener {
|
||||
if (!Settings.netherIslands) {
|
||||
if (e.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.worldName + "_nether")
|
||||
|| e.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.worldName + "_the_end")) {
|
||||
if (VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
if (e.getPlayer().hasPermission(Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
return;
|
||||
}
|
||||
if (!awayFromSpawn(e.getPlayer()) && !e.getPlayer().isOp()) {
|
||||
@ -159,7 +159,7 @@ public class NetherEvents implements Listener {
|
||||
if (!Settings.netherIslands) {
|
||||
if (e.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.worldName + "_nether")
|
||||
|| e.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.worldName + "_the_end")) {
|
||||
if (VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
if (e.getPlayer().hasPermission(Settings.PERMPREFIX + "mod.bypassprotect")) {
|
||||
return;
|
||||
}
|
||||
if (!awayFromSpawn(e.getPlayer()) && !e.getPlayer().isOp()) {
|
||||
|
@ -86,7 +86,7 @@ public class VisitorGuard implements Listener {
|
||||
}
|
||||
Island island = plugin.getIslands().getIslandAt(e.getItemDrop().getLocation());
|
||||
if ((island != null && island.getFlag(SettingsFlag.ITEM_DROP))
|
||||
|| e.getPlayer().isOp() || VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")
|
||||
|| e.getPlayer().hasPermission(Settings.PERMPREFIX + "mod.bypassprotect")
|
||||
|| plugin.getIslands().locationIsOnIsland(e.getPlayer(), e.getItemDrop().getLocation())) {
|
||||
return;
|
||||
}
|
||||
@ -153,7 +153,7 @@ public class VisitorGuard implements Listener {
|
||||
}
|
||||
Island island = plugin.getIslands().getIslandAt(e.getItem().getLocation());
|
||||
if ((island != null && island.getFlag(SettingsFlag.ITEM_PICKUP))
|
||||
|| player.isOp() || VaultHelper.hasPerm(player, Settings.PERMPREFIX + "mod.bypassprotect")
|
||||
|| player.hasPermission(Settings.PERMPREFIX + "mod.bypassprotect")
|
||||
|| plugin.getIslands().locationIsOnIsland(player, e.getItem().getLocation())) {
|
||||
return;
|
||||
}
|
||||
|
@ -13,7 +13,6 @@ import net.milkbowl.vault.permission.Permission;
|
||||
*/
|
||||
public class VaultHelper {
|
||||
public static Economy econ = null;
|
||||
public static Permission permission = null;
|
||||
|
||||
/**
|
||||
* Sets up the economy instance
|
||||
@ -28,82 +27,4 @@ public class VaultHelper {
|
||||
}
|
||||
return econ != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up the permissions instance
|
||||
*
|
||||
* @return true if successful
|
||||
*/
|
||||
public static boolean setupPermissions() {
|
||||
RegisteredServiceProvider<Permission> permissionProvider = Bukkit.getServer().getServicesManager()
|
||||
.getRegistration(net.milkbowl.vault.permission.Permission.class);
|
||||
if (permissionProvider != null) {
|
||||
permission = permissionProvider.getProvider();
|
||||
}
|
||||
return (permission != null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks permission of player in the world the player is in now
|
||||
*
|
||||
* @param player
|
||||
* @param perm
|
||||
* @return true if the player has the perm
|
||||
*/
|
||||
public static boolean hasPerm(final Player player, final String perm) {
|
||||
return permission.has(player, perm);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks permission of player in world
|
||||
*
|
||||
* @param player
|
||||
* @param perm
|
||||
* @param world
|
||||
* @return
|
||||
*/
|
||||
public static boolean hasPerm(final Player player, final String perm, final World world) {
|
||||
return permission.playerHas(world.getName(), player, perm);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds permission to player
|
||||
*
|
||||
* @param player
|
||||
* @param perm
|
||||
*/
|
||||
public static void addPerm(final Player player, final String perm) {
|
||||
permission.playerAdd(player, perm);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add permission to player in world
|
||||
* @param player
|
||||
* @param perm
|
||||
* @param world
|
||||
*/
|
||||
public static void addPerm(final Player player, final String perm, final World world) {
|
||||
permission.playerAdd(world.getName(), player, perm);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a player's permission
|
||||
*
|
||||
* @param player
|
||||
* @param perm
|
||||
*/
|
||||
public static void removePerm(final Player player, final String perm) {
|
||||
permission.playerRemove(player, perm);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a player's permission in world
|
||||
*
|
||||
* @param player
|
||||
* @param perm
|
||||
* @param world
|
||||
*/
|
||||
public static void removePerm(final Player player, final String perm, World world) {
|
||||
permission.playerRemove(world.getName(), player, perm);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user