fix some bug...

Signed-off-by: 502647092 <jtb1@163.com>
pull/3/HEAD
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;
buying = selling = doubles = chunks = worlds = 0;
int nostock = 0;
sender.sendMessage(ChatColor.RED + "检索商店信息中...");
sender.sendMessage(ChatColor.RED + "开始检索商店信息中...");
for (final HashMap<ShopChunk, HashMap<Location, Shop>> inWorld : plugin.getShopManager().getShops().values()) {
worlds++;
for (final HashMap<Location, Shop> inChunk : inWorld.values()) {

View File

@ -21,6 +21,7 @@ public class CommandPrice extends BaseCommand {
this.plugin = plugin;
setMinimumArguments(1);
setOnlyPlayerExecutable();
setPossibleArguments("<价格>");
setPermission("quickshop.create.changeprice");
setDescription(MsgUtil.p("command.description.price"));
}
@ -29,13 +30,9 @@ public class CommandPrice extends BaseCommand {
@Override
public void execute(final CommandSender sender, final Command command, final String label, final String[] args) throws CommandException {
final Player p = (Player) sender;
if (args.length < 2) {
sender.sendMessage(MsgUtil.p("no-price-given"));
return;
}
double price;
try {
price = Double.parseDouble(args[1]);
price = Double.parseDouble(args[0]);
} catch (final NumberFormatException e) {
sender.sendMessage(MsgUtil.p("thats-not-a-number"));
return;
@ -57,7 +54,7 @@ public class CommandPrice extends BaseCommand {
while (bIt.hasNext()) {
final Block b = bIt.next();
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) {
// Stop here if there isn't a 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) {
super("refill");
this.plugin = plugin;
setMinimumArguments(1);
setPossibleArguments("<数量>");
setPermission("quickshop.refill");
setDescription(MsgUtil.p("command.description.refill"));
}
@Override
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;
try {
add = Integer.parseInt(args[1]);
add = Integer.parseInt(args[0]);
} catch (final NumberFormatException e) {
sender.sendMessage(MsgUtil.p("thats-not-a-number"));
return;

View File

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