1
0
mirror of https://e.coding.net/circlecloud/QuickShop.git synced 2025-10-02 12:37:27 +00:00

fix some bug...

Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
502647092
2015-10-09 13:29:28 +08:00
parent 3f09e80b0b
commit 2f22d07915
4 changed files with 21 additions and 26 deletions

View File

@ -30,7 +30,7 @@ public class CommandInfo extends BaseCommand {
int buying, selling, doubles, chunks, worlds; int buying, selling, doubles, chunks, worlds;
buying = selling = doubles = chunks = worlds = 0; buying = selling = doubles = chunks = worlds = 0;
int nostock = 0; int nostock = 0;
sender.sendMessage(ChatColor.RED + "检索商店信息中..."); sender.sendMessage(ChatColor.RED + "开始检索商店信息中...");
for (final HashMap<ShopChunk, HashMap<Location, Shop>> inWorld : plugin.getShopManager().getShops().values()) { for (final HashMap<ShopChunk, HashMap<Location, Shop>> inWorld : plugin.getShopManager().getShops().values()) {
worlds++; worlds++;
for (final HashMap<Location, Shop> inChunk : inWorld.values()) { for (final HashMap<Location, Shop> inChunk : inWorld.values()) {

View File

@ -21,6 +21,7 @@ public class CommandPrice extends BaseCommand {
this.plugin = plugin; this.plugin = plugin;
setMinimumArguments(1); setMinimumArguments(1);
setOnlyPlayerExecutable(); setOnlyPlayerExecutable();
setPossibleArguments("<价格>");
setPermission("quickshop.create.changeprice"); setPermission("quickshop.create.changeprice");
setDescription(MsgUtil.p("command.description.price")); setDescription(MsgUtil.p("command.description.price"));
} }
@ -29,13 +30,9 @@ public class CommandPrice extends BaseCommand {
@Override @Override
public void execute(final CommandSender sender, final Command command, final String label, final String[] args) throws CommandException { public void execute(final CommandSender sender, final Command command, final String label, final String[] args) throws CommandException {
final Player p = (Player) sender; final Player p = (Player) sender;
if (args.length < 2) {
sender.sendMessage(MsgUtil.p("no-price-given"));
return;
}
double price; double price;
try { try {
price = Double.parseDouble(args[1]); price = Double.parseDouble(args[0]);
} catch (final NumberFormatException e) { } catch (final NumberFormatException e) {
sender.sendMessage(MsgUtil.p("thats-not-a-number")); sender.sendMessage(MsgUtil.p("thats-not-a-number"));
return; return;
@ -57,7 +54,7 @@ public class CommandPrice extends BaseCommand {
while (bIt.hasNext()) { while (bIt.hasNext()) {
final Block b = bIt.next(); final Block b = bIt.next();
final Shop shop = plugin.getShopManager().getShop(b.getLocation()); final Shop shop = plugin.getShopManager().getShop(b.getLocation());
if (shop != null && (shop.getOwner().equals(((Player) sender).getUniqueId()) || sender.hasPermission("quickshop.other.price"))) { if (shop != null && (shop.getOwner().equals(p.getName()) || sender.hasPermission("quickshop.other.price"))) {
if (shop.getPrice() == price) { if (shop.getPrice() == price) {
// Stop here if there isn't a price change // Stop here if there isn't a price change
sender.sendMessage(MsgUtil.p("no-price-change")); sender.sendMessage(MsgUtil.p("no-price-change"));

View File

@ -18,19 +18,17 @@ public class CommandRefill extends BaseCommand {
public CommandRefill(final QuickShop plugin) { public CommandRefill(final QuickShop plugin) {
super("refill"); super("refill");
this.plugin = plugin; this.plugin = plugin;
setMinimumArguments(1);
setPossibleArguments("<数量>");
setPermission("quickshop.refill"); setPermission("quickshop.refill");
setDescription(MsgUtil.p("command.description.refill")); setDescription(MsgUtil.p("command.description.refill"));
} }
@Override @Override
public void execute(final CommandSender sender, final Command command, final String label, final String[] args) throws CommandException { public void execute(final CommandSender sender, final Command command, final String label, final String[] args) throws CommandException {
if (args.length < 2) {
sender.sendMessage(MsgUtil.p("command.no-amount-given"));
return;
}
int add; int add;
try { try {
add = Integer.parseInt(args[1]); add = Integer.parseInt(args[0]);
} catch (final NumberFormatException e) { } catch (final NumberFormatException e) {
sender.sendMessage(MsgUtil.p("thats-not-a-number")); sender.sendMessage(MsgUtil.p("thats-not-a-number"));
return; return;

View File

@ -1,10 +1,10 @@
Version: 1.2 Version: 1.2
not-looking-at-shop: '&c没找到快捷商店. 你必须看着那个箱子.' not-looking-at-shop: '&c没找到快捷商店. 你必须看着那个商店.'
no-permission: '&4你没有此命令的权限.' no-permission: '&4你没有此命令的权限.'
no-creative-break: '&c你不能在创造模式中打破其他玩家的商店,请使用生存模式.' no-creative-break: '&c你不能在创造模式中打破其他玩家的商店,请使用生存模式.'
no-double-chests: '&c你没有权限创建一个大箱子商店请使用个箱子.' no-double-chests: '&c你没有权限创建一个大箱子商店请使用个箱子.'
shop-already-owned: '&c这已经是一个箱子了.' shop-already-owned: '&c当前箱子已经是商店了.'
chest-was-removed: '&c商店已被移除.' chest-was-removed: '&c商店已被移除.'
price-too-cheap: '&c商品价格不能低于 &e{0}' price-too-cheap: '&c商品价格不能低于 &e{0}'
no-price-change: '&c商店价格未改变!' no-price-change: '&c商店价格未改变!'
@ -21,7 +21,7 @@ you-cant-afford-to-buy: '&c此商品需要 {0}, 但是你只有 {1}'
negative-amount: '&c警告, 错误的物品数量.' negative-amount: '&c警告, 错误的物品数量.'
player-bought-from-your-store: '&d{0} 购买了 {1} {2} 从你的商店.' player-bought-from-your-store: '&d{0} 购买了 {1} {2} 从你的商店.'
shop-out-of-stock: '&5你在 {0}, {1}, {2} 的商店, {3} 库存不足了' shop-out-of-stock: '&5你在 {0}, {1}, {2} 的商店, {3} 库存不足了'
shop-has-no-space: '&c商店只能收购 {0} more {1}.' shop-has-no-space: '&c商店只能收购 {0} {1} 商品.'
you-dont-have-that-many-items: '&c你只有 {0} {1}.' you-dont-have-that-many-items: '&c你只有 {0} {1}.'
the-owner-cant-afford-to-buy-from-you: '&c此商品出售价格为 {0} 但是所有者只有 {1}' the-owner-cant-afford-to-buy-from-you: '&c此商品出售价格为 {0} 但是所有者只有 {1}'
player-sold-to-your-store: '&a{0} 出售 {1} 个 {2} 到你的商店.' player-sold-to-your-store: '&a{0} 出售 {1} 个 {2} 到你的商店.'
@ -30,14 +30,14 @@ fee-charged-for-price-change: '&a你只付了 &c{0}&a 改变了商品价格.'
price-is-now: '&a此商店目前的价格为 &e{0}' price-is-now: '&a此商店目前的价格为 &e{0}'
thats-not-a-number: '&4错误参数:请输入一个数字!' thats-not-a-number: '&4错误参数:请输入一个数字!'
no-price-given: '&c请设置一个价格.' no-price-given: '&c请设置一个价格.'
average-price-nearby: '&a附近平均价格: &e{0}' average-price-nearby: '&a附近平均价格: &e{0}.'
shop-has-changed: '&c你点击的商店已经改变!' shop-has-changed: '&c你点击的商店已经改变!'
nearby-shop-this-way: '&a商店距离你 {0} 个方块.' nearby-shop-this-way: '&a商店距离你 {0} 个方块.'
no-nearby-shop: '&c附近未找到 {0} 商店.' no-nearby-shop: '&c附近未找到 {0} 商店.'
buying-more-than-selling: '&4警告: 你购买的物品超出了商店的库存!' buying-more-than-selling: '&4警告: 你购买的物品超出了商店的库存!'
not-enough-space: '&c你没有足够的空间装 {0} !' not-enough-space: '&c你没有足够的空间装 {0} !'
refill-success: '&a库存补充成功' refill-success: '&a库存补充成功!'
empty-success: '&a库存清理成功' empty-success: '&a商店清理成功!'
menu: menu:
successful-purchase: '&a商品购买成功:' successful-purchase: '&a商品购买成功:'
@ -55,11 +55,11 @@ menu:
this-shop-is-selling: '&a此商店只 &b出售&a 商品.' this-shop-is-selling: '&a此商店只 &b出售&a 商品.'
info: info:
title: '当前加载的 {0} 个区块中 共有 {1} 个商店 覆盖 {2} 个世界.' title: '&a当前加载的 &e{0} &a个区块中 共有 &e{1} &a个商店 覆盖 &e{2} &a个世界.'
selling: '出售商店{0} 个.' selling: '&b出售商店&a有 &e{0} &a个.'
buying: '收购商店{0} 个.' buying: '&d收购商店&a有 &e{0} &a个.'
double: '大箱子商店 {0} 个.' double: '&3大箱子商店 &e{0} &a个.'
canclean: '可以用 /qs clean 清理的商店有 {0} 个.' canclean: '&a可以用 &b/qs clean &a清理的商店有 &e{0} &a个.'
bypassing-lock: '&c无视快捷商店锁!' bypassing-lock: '&c无视快捷商店锁!'
that-is-locked: '&c此快捷商店已上锁.' that-is-locked: '&c此快捷商店已上锁.'
@ -98,4 +98,4 @@ command:
signs: signs:
selling: '出售数量: {0}' selling: '出售数量: {0}'
buying: '收购数量: {0}' buying: '收购数量: {0}'
price: '每件价格: ${0}' price: '每件价格: {0}'