From 8d64101d1196d1d0944b28ff571d65bc51fa3d9f Mon Sep 17 00:00:00 2001 From: Shevchik Date: Mon, 30 Sep 2013 11:21:58 +0400 Subject: [PATCH] Remove permissions from code, we will add them to plugin.yml --- src/com/cnaude/chairs/Chairs.java | 16 +------------- src/com/cnaude/chairs/ChairsCommand.java | 4 ++-- src/com/cnaude/chairs/EventListener.java | 28 +----------------------- 3 files changed, 4 insertions(+), 44 deletions(-) diff --git a/src/com/cnaude/chairs/Chairs.java b/src/com/cnaude/chairs/Chairs.java index a47dc22..88b4e80 100644 --- a/src/com/cnaude/chairs/Chairs.java +++ b/src/com/cnaude/chairs/Chairs.java @@ -20,8 +20,6 @@ import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.HandlerList; -import org.bukkit.permissions.Permission; -import org.bukkit.permissions.PermissionDefault; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.util.Vector; @@ -33,7 +31,7 @@ public class Chairs extends JavaPlugin { public static ChairEffects chairEffects; public List allowedBlocks; public List validSigns; - public boolean autoRotate, signCheck, permissions, notifyplayer, opsOverridePerms; + public boolean autoRotate, signCheck, notifyplayer; public boolean invertedStairCheck, invertedStepCheck, perItemPerms, ignoreIfBlockInHand; public boolean sitEffectsEnabled; public double sittingHeight, sittingHeightAdj, distance; @@ -224,12 +222,10 @@ public class Chairs extends JavaPlugin { sittingHeightAdj = getConfig().getDouble("sitting-height-adj"); distance = getConfig().getDouble("distance"); maxChairWidth = getConfig().getInt("max-chair-width"); - permissions = getConfig().getBoolean("permissions"); notifyplayer = getConfig().getBoolean("notify-player"); invertedStairCheck = getConfig().getBoolean("upside-down-check"); invertedStepCheck = getConfig().getBoolean("upper-step-check"); perItemPerms = getConfig().getBoolean("per-item-perms"); - opsOverridePerms = getConfig().getBoolean("ops-override-perms"); ignoreIfBlockInHand = getConfig().getBoolean("ignore-if-block-in-hand"); sitEffectsEnabled = getConfig().getBoolean("sit-effects.enabled", false); @@ -305,16 +301,6 @@ public class Chairs extends JavaPlugin { pm.removePermission(s); } } - PermissionDefault pd; - if (opsOverridePerms) { - pd = PermissionDefault.OP; - } else { - pd = PermissionDefault.FALSE; - } - - pm.addPermission(new Permission("chairs.sit","Allow player to sit on a block.",pd)); - pm.addPermission(new Permission("chairs.reload","Allow player to reload the Chairs configuration.",pd)); - pm.addPermission(new Permission("chairs.self","Allow player to self disable or enable sitting.",pd)); } public void logInfo(String _message) { diff --git a/src/com/cnaude/chairs/ChairsCommand.java b/src/com/cnaude/chairs/ChairsCommand.java index 8de9018..b56aee0 100644 --- a/src/com/cnaude/chairs/ChairsCommand.java +++ b/src/com/cnaude/chairs/ChairsCommand.java @@ -45,7 +45,7 @@ public class ChairsCommand implements CommandExecutor { if (sender instanceof Player) { Player p = (Player) sender; if (args[0].equalsIgnoreCase("on")) { - if (p.hasPermission("chairs.self") || !plugin.permissions) { + if (p.hasPermission("chairs.self")) { ignoreList.removePlayer(p.getName()); if (!plugin.msgEnabled.isEmpty()) { p.sendMessage(plugin.msgEnabled); @@ -57,7 +57,7 @@ public class ChairsCommand implements CommandExecutor { } } if (args[0].equalsIgnoreCase("off")) { - if (p.hasPermission("chairs.self") || !plugin.permissions) { + if (p.hasPermission("chairs.self")) { ignoreList.addPlayer(p.getName()); if (!plugin.msgDisabled.isEmpty()) { p.sendMessage(plugin.msgDisabled); diff --git a/src/com/cnaude/chairs/EventListener.java b/src/com/cnaude/chairs/EventListener.java index ca15f72..7b08f84 100644 --- a/src/com/cnaude/chairs/EventListener.java +++ b/src/com/cnaude/chairs/EventListener.java @@ -19,8 +19,6 @@ import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.material.Stairs; import org.bukkit.material.Step; import org.bukkit.material.WoodenStep; -import org.bukkit.permissions.Permission; -import org.bukkit.permissions.PermissionDefault; import org.bukkit.util.Vector; public class EventListener implements Listener { @@ -101,32 +99,8 @@ public class EventListener implements Listener { return false; } // Permissions Check - if (plugin.permissions) { - if (!player.hasPermission("chairs.sit")) { + if (!player.hasPermission("chairs.sit")) { return false; - } - } - if (plugin.perItemPerms) { - if (plugin.pm.getPermission("chairs.sit." + block.getTypeId()) == null) { - plugin.pm.addPermission(new Permission("chairs.sit." + block.getTypeId(), - "Allow players to sit on a '" + block.getType().name() + "'", - PermissionDefault.FALSE)); - } - if (plugin.pm.getPermission("chairs.sit." + block.getType().toString()) == null) { - plugin.pm.addPermission(new Permission("chairs.sit." + block.getType().toString(), - "Allow players to sit on a '" + block.getType().name() + "'", - PermissionDefault.FALSE)); - } - if (plugin.pm.getPermission("chairs.sit." + block.getTypeId() + ":" + block.getData()) == null) { - plugin.pm.addPermission(new Permission("chairs.sit." + block.getTypeId() + ":" + block.getData(), - "Allow players to sit on a '" + block.getType().name() + "'", - PermissionDefault.FALSE)); - } - if (plugin.pm.getPermission("chairs.sit." + block.getType().toString() + ":" + block.getData()) == null) { - plugin.pm.addPermission(new Permission("chairs.sit." + block.getType().toString() + ":" + block.getData(), - "Allow players to sit on a '" + block.getType().name() + "'", - PermissionDefault.FALSE)); - } } for (ChairBlock cb : plugin.allowedBlocks) {