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

add new SuperItem Action...

Signed-off-by: j502647092 <jtb1@163.com>
This commit is contained in:
j502647092 2015-10-08 22:20:14 +08:00
parent 8ac297cd4d
commit a0768cdf7a

View File

@ -23,6 +23,7 @@ import org.maxgamer.QuickShop.QuickShop;
import org.maxgamer.QuickShop.Shop.Info;
import org.maxgamer.QuickShop.Shop.Shop;
import org.maxgamer.QuickShop.Shop.ShopAction;
import org.maxgamer.QuickShop.Shop.ShopType;
import org.maxgamer.QuickShop.Util.MsgUtil;
import org.maxgamer.QuickShop.Util.Util;
@ -171,10 +172,24 @@ public class PlayerListener implements Listener {
final Block attached = Util.getAttached(b);
final Shop shop = attached == null ? null : plugin.getShopManager().getShop(attached.getLocation());
if (shop != null) {
if (e.getAction() == Action.RIGHT_CLICK_BLOCK && p.hasPermission("quickshop.unlimited")) {
shop.setUnlimited(!shop.isUnlimited());
if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
if (p.hasPermission("quickshop.unlimited") && p.getGameMode() == GameMode.CREATIVE) {
shop.setUnlimited(!shop.isUnlimited());
p.sendMessage(MsgUtil.p("command.toggle-unlimited", (shop.isUnlimited() ? "无限模式" : "有限模式")));
return;
} else if (p.getGameMode() == GameMode.SURVIVAL) {
if (shop.getShopType() == ShopType.BUYING && p.hasPermission("quickshop.create.sell")) {
shop.setShopType(ShopType.SELLING);
p.sendMessage(MsgUtil.p("command.now-selling", shop.getDataName()));
return;
} else if (shop.getShopType() == ShopType.SELLING && p.hasPermission("quickshop.create.buy")) {
shop.setShopType(ShopType.BUYING);
p.sendMessage(MsgUtil.p("command.now-buying", shop.getDataName()));
return;
}
}
shop.setSignText();
shop.update();
p.sendMessage(MsgUtil.p("command.toggle-unlimited", (shop.isUnlimited() ? "无限模式" : "有限模式")));
}
}
}