1
0
mirror of https://e.coding.net/circlecloud/QuickShop.git synced 2024-10-02 17:48:48 +00:00

change Aciton Mode...

Signed-off-by: j502647092 <jtb1@163.com>
This commit is contained in:
j502647092 2015-10-08 23:13:04 +08:00
parent a0768cdf7a
commit 8b4e2c5ece

View File

@ -162,10 +162,10 @@ public class PlayerListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onSuperItemClick(final PlayerInteractEvent e) { public void onSuperItemClick(final PlayerInteractEvent e) {
if (e.getAction() == Action.LEFT_CLICK_BLOCK || e.getMaterial() != plugin.getConfigManager().getSuperItem()) { final Player p = e.getPlayer();
if (e.getAction() == Action.LEFT_CLICK_BLOCK || p.getGameMode() != GameMode.SURVIVAL || e.getMaterial() != plugin.getConfigManager().getSuperItem()) {
return; return;
} }
final Player p = e.getPlayer();
final Block b = e.getClickedBlock(); final Block b = e.getClickedBlock();
// If that wasn't a shop, search nearby shops // If that wasn't a shop, search nearby shops
if (b.getType() == Material.WALL_SIGN) { if (b.getType() == Material.WALL_SIGN) {
@ -173,11 +173,12 @@ public class PlayerListener implements Listener {
final Shop shop = attached == null ? null : plugin.getShopManager().getShop(attached.getLocation()); final Shop shop = attached == null ? null : plugin.getShopManager().getShop(attached.getLocation());
if (shop != null) { if (shop != null) {
if (e.getAction() == Action.RIGHT_CLICK_BLOCK) { if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
if (p.hasPermission("quickshop.unlimited") && p.getGameMode() == GameMode.CREATIVE) { if (p.hasPermission("quickshop.unlimited")) {
shop.setUnlimited(!shop.isUnlimited()); shop.setUnlimited(!shop.isUnlimited());
p.sendMessage(MsgUtil.p("command.toggle-unlimited", (shop.isUnlimited() ? "无限模式" : "有限模式"))); p.sendMessage(MsgUtil.p("command.toggle-unlimited", (shop.isUnlimited() ? "无限模式" : "有限模式")));
return; return;
} else if (p.getGameMode() == GameMode.SURVIVAL) { }
} else {
if (shop.getShopType() == ShopType.BUYING && p.hasPermission("quickshop.create.sell")) { if (shop.getShopType() == ShopType.BUYING && p.hasPermission("quickshop.create.sell")) {
shop.setShopType(ShopType.SELLING); shop.setShopType(ShopType.SELLING);
p.sendMessage(MsgUtil.p("command.now-selling", shop.getDataName())); p.sendMessage(MsgUtil.p("command.now-selling", shop.getDataName()));
@ -193,7 +194,6 @@ public class PlayerListener implements Listener {
} }
} }
} }
}
@EventHandler @EventHandler
public void onTeleport(final PlayerTeleportEvent e) { public void onTeleport(final PlayerTeleportEvent e) {