From ab04e461a8556f9090ae8a6cda965d81412ec102 Mon Sep 17 00:00:00 2001 From: lishid Date: Wed, 24 Oct 2012 16:00:52 -0400 Subject: [PATCH] New permission node for openself. --- src/lishid/openinv/Permissions.java | 1 + src/lishid/openinv/commands/OpenInvPluginCommand.java | 8 ++++++++ src/lishid/openinv/utils/OpenInvPlayerInventory.java | 2 +- src/plugin.yml | 2 +- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/lishid/openinv/Permissions.java b/src/lishid/openinv/Permissions.java index d2ce2bd..73d7173 100644 --- a/src/lishid/openinv/Permissions.java +++ b/src/lishid/openinv/Permissions.java @@ -12,4 +12,5 @@ public class Permissions public static final String PERM_SEARCH = "OpenInv.search"; public static final String PERM_EDITINV = "OpenInv.editinv"; public static final String PERM_EDITENDER = "OpenInv.editender"; + public static final String PERM_OPENSELF = "OpenInv.openself"; } diff --git a/src/lishid/openinv/commands/OpenInvPluginCommand.java b/src/lishid/openinv/commands/OpenInvPluginCommand.java index bd3b322..eeca5f5 100644 --- a/src/lishid/openinv/commands/OpenInvPluginCommand.java +++ b/src/lishid/openinv/commands/OpenInvPluginCommand.java @@ -166,12 +166,20 @@ public class OpenInvPluginCommand implements CommandExecutor return true; } + // Crosswork check if ((!player.hasPermission(Permissions.PERM_CROSSWORLD) && !player.hasPermission(Permissions.PERM_OVERRIDE)) && target.getWorld() != player.getWorld()) { sender.sendMessage(ChatColor.RED + target.getDisplayName() + " is not in your world!"); return true; } + // Self-open check + if (!player.hasPermission(Permissions.PERM_OPENSELF) && target.equals(player)) + { + sender.sendMessage(ChatColor.RED + "You're not allowed to openinv yourself."); + return true; + } + // Record the target history = target.getName(); openInvHistory.put(player, history); diff --git a/src/lishid/openinv/utils/OpenInvPlayerInventory.java b/src/lishid/openinv/utils/OpenInvPlayerInventory.java index dba6ca9..ba04479 100644 --- a/src/lishid/openinv/utils/OpenInvPlayerInventory.java +++ b/src/lishid/openinv/utils/OpenInvPlayerInventory.java @@ -57,7 +57,7 @@ public class OpenInvPlayerInventory extends PlayerInventory public void PlayerGoOnline(CraftPlayer p) { - if(!playerOnline) + if (!playerOnline) { p.getHandle().inventory.items = this.items; p.getHandle().inventory.armor = this.armor; diff --git a/src/plugin.yml b/src/plugin.yml index e78c27c..0478072 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: OpenInv main: lishid.openinv.OpenInv -version: 1.8.7 +version: 1.8.8 author: lishid website: http://forums.bukkit.org/threads/15379/ description: >