1
0
mirror of https://e.coding.net/circlecloud/QuickShop.git synced 2024-11-22 01:58:54 +00:00

fix remove shop and add invcheck...

Signed-off-by: j502647092 <jtb1@163.com>
This commit is contained in:
j502647092 2015-10-06 22:25:24 +08:00
parent 8a3cc86780
commit ba8848eff4
5 changed files with 41 additions and 20 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.maxgamer</groupId> <groupId>org.maxgamer</groupId>
<artifactId>QuickShop</artifactId> <artifactId>QuickShop</artifactId>
<version>1.1</version> <version>1.2</version>
<build> <build>
<finalName>${project.name}</finalName> <finalName>${project.name}</finalName>
<resources> <resources>

View File

@ -44,7 +44,7 @@ public class BlockListener implements Listener {
} }
// If they're either survival or the owner, they can break it // If they're either survival or the owner, they can break it
final ItemStack pinh = p.getItemInHand(); 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. // Cancel their current menu... Doesnt cancel other's menu's.
final Info action = plugin.getShopManager().getActions().get(p.getName()); final Info action = plugin.getShopManager().getActions().get(p.getName());
if (action != null) { if (action != null) {

View File

@ -37,7 +37,7 @@ public class LockListener implements Listener {
return; // Wasn't a shop return; // Wasn't a shop
} }
// If they owned it or have bypass perms, they can destroy it // 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); e.setCancelled(true);
p.sendMessage(MsgUtil.p("no-permission")); p.sendMessage(MsgUtil.p("no-permission"));
return; return;
@ -50,13 +50,8 @@ public class LockListener implements Listener {
final Shop shop = plugin.getShopManager().getShop(b.getLocation()); final Shop shop = plugin.getShopManager().getShop(b.getLocation());
if (shop == null) { if (shop == null) {
return; return;
} } else {
// 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")) {
e.setCancelled(true); e.setCancelled(true);
p.sendMessage(MsgUtil.p("no-permission"));
return;
} }
} }
} }
@ -83,7 +78,7 @@ public class LockListener implements Listener {
return; return;
} }
} }
if (!shop.getOwner().equals(p.getUniqueId())) { if (!shop.getOwner().equals(p.getName())) {
if (p.hasPermission("quickshop.other.open")) { if (p.hasPermission("quickshop.other.open")) {
p.sendMessage(MsgUtil.p("bypassing-lock")); p.sendMessage(MsgUtil.p("bypassing-lock"));
return; return;
@ -143,7 +138,7 @@ public class LockListener implements Listener {
return; return;
} }
} }
if (p.getUniqueId().equals(shop.getOwner()) == false) { if (p.getName().equals(shop.getOwner()) == false) {
if (p.hasPermission("quickshop.other.open")) { if (p.hasPermission("quickshop.other.open")) {
p.sendMessage(MsgUtil.p("bypassing-lock")); p.sendMessage(MsgUtil.p("bypassing-lock"));
return; return;

View File

@ -16,7 +16,6 @@ import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.inventory.Inventory; 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 @EventHandler
public void onPlayerQuit(final PlayerQuitEvent e) { public void onPlayerQuit(final PlayerQuitEvent e) {
// Remove them from the menu // Remove them from the menu

View File

@ -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);
}
}
}