diff --git a/pom.xml b/pom.xml
index af24ada..2d9f462 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
4.0.0
org.maxgamer
QuickShop
- 1.1
+ 1.2
${project.name}
diff --git a/src/main/java/org/maxgamer/QuickShop/Listeners/BlockListener.java b/src/main/java/org/maxgamer/QuickShop/Listeners/BlockListener.java
index 34198d8..83f6e94 100644
--- a/src/main/java/org/maxgamer/QuickShop/Listeners/BlockListener.java
+++ b/src/main/java/org/maxgamer/QuickShop/Listeners/BlockListener.java
@@ -44,7 +44,7 @@ public class BlockListener implements Listener {
}
// If they're either survival or the owner, they can break it
final ItemStack pinh = p.getItemInHand();
- if (p.getName().equals(shop.getOwner()) || (pinh != null && pinh.getType() == plugin.getConfigManager().getSuperItem()) || (p.getGameMode() == GameMode.SURVIVAL)) {
+ if (p.getName().equals(shop.getOwner()) || p.getGameMode() == GameMode.SURVIVAL || pinh == null || pinh.getType() == plugin.getConfigManager().getSuperItem()) {
// Cancel their current menu... Doesnt cancel other's menu's.
final Info action = plugin.getShopManager().getActions().get(p.getName());
if (action != null) {
diff --git a/src/main/java/org/maxgamer/QuickShop/Listeners/LockListener.java b/src/main/java/org/maxgamer/QuickShop/Listeners/LockListener.java
index 413f864..a1d9b31 100644
--- a/src/main/java/org/maxgamer/QuickShop/Listeners/LockListener.java
+++ b/src/main/java/org/maxgamer/QuickShop/Listeners/LockListener.java
@@ -37,7 +37,7 @@ public class LockListener implements Listener {
return; // Wasn't a shop
}
// If they owned it or have bypass perms, they can destroy it
- if (!shop.getOwner().equals(p.getUniqueId()) && !p.hasPermission("quickshop.other.destroy")) {
+ if (!shop.getOwner().equals(p.getName()) && !p.hasPermission("quickshop.other.destroy")) {
e.setCancelled(true);
p.sendMessage(MsgUtil.p("no-permission"));
return;
@@ -50,13 +50,8 @@ public class LockListener implements Listener {
final Shop shop = plugin.getShopManager().getShop(b.getLocation());
if (shop == null) {
return;
- }
- // If they're the shop owner or have bypass perms, they can destroy
- // it.
- if (!shop.getOwner().equals(p.getUniqueId()) && !p.hasPermission("quickshop.other.destroy")) {
+ } else {
e.setCancelled(true);
- p.sendMessage(MsgUtil.p("no-permission"));
- return;
}
}
}
@@ -83,7 +78,7 @@ public class LockListener implements Listener {
return;
}
}
- if (!shop.getOwner().equals(p.getUniqueId())) {
+ if (!shop.getOwner().equals(p.getName())) {
if (p.hasPermission("quickshop.other.open")) {
p.sendMessage(MsgUtil.p("bypassing-lock"));
return;
@@ -143,7 +138,7 @@ public class LockListener implements Listener {
return;
}
}
- if (p.getUniqueId().equals(shop.getOwner()) == false) {
+ if (p.getName().equals(shop.getOwner()) == false) {
if (p.hasPermission("quickshop.other.open")) {
p.sendMessage(MsgUtil.p("bypassing-lock"));
return;
diff --git a/src/main/java/org/maxgamer/QuickShop/Listeners/PlayerListener.java b/src/main/java/org/maxgamer/QuickShop/Listeners/PlayerListener.java
index ba9529c..fc91d3d 100644
--- a/src/main/java/org/maxgamer/QuickShop/Listeners/PlayerListener.java
+++ b/src/main/java/org/maxgamer/QuickShop/Listeners/PlayerListener.java
@@ -16,7 +16,6 @@ import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerMoveEvent;
-import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.inventory.Inventory;
@@ -172,14 +171,6 @@ public class PlayerListener implements Listener {
}
}
- @EventHandler
- public void onPlayerPickup(final PlayerPickupItemEvent e) {
- final ItemStack ci = e.getItem().getItemStack();
- if (MarkUtil.hasMark(ci)) {
- e.setCancelled(true);
- }
- }
-
@EventHandler
public void onPlayerQuit(final PlayerQuitEvent e) {
// Remove them from the menu
diff --git a/src/main/java/org/maxgamer/QuickShop/Listeners/ProtectListener.java b/src/main/java/org/maxgamer/QuickShop/Listeners/ProtectListener.java
new file mode 100644
index 0000000..8647acb
--- /dev/null
+++ b/src/main/java/org/maxgamer/QuickShop/Listeners/ProtectListener.java
@@ -0,0 +1,35 @@
+package org.maxgamer.QuickShop.Listeners;
+
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.inventory.InventoryMoveItemEvent;
+import org.bukkit.event.player.PlayerPickupItemEvent;
+import org.bukkit.inventory.ItemStack;
+import org.maxgamer.QuickShop.Util.MarkUtil;
+
+public class ProtectListener {
+
+ @EventHandler
+ public void onInvMove(final InventoryMoveItemEvent e) {
+ final ItemStack ci = e.getItem();
+ if (MarkUtil.hasMark(ci)) {
+ e.setCancelled(true);
+ }
+ }
+
+ // @EventHandler
+ // public void onInvPickup(final InventoryPickupItemEvent e) {
+ // final ItemStack ci = e.getItem().getItemStack();
+ // if (MarkUtil.hasMark(ci)) {
+ // e.setCancelled(true);
+ // }
+ // }
+
+ @EventHandler
+ public void onPlayerPickup(final PlayerPickupItemEvent e) {
+ final ItemStack ci = e.getItem().getItemStack();
+ if (MarkUtil.hasMark(ci)) {
+ e.setCancelled(true);
+ }
+ }
+
+}