1
0
mirror of https://e.coding.net/circlecloud/QuickShop.git synced 2024-12-29 08:08:49 +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>
<groupId>org.maxgamer</groupId>
<artifactId>QuickShop</artifactId>
<version>1.1</version>
<version>1.2</version>
<build>
<finalName>${project.name}</finalName>
<resources>

View File

@ -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) {

View File

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

View File

@ -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

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