From f64af66f09769fd33822558a4961a6f47b9eeffd Mon Sep 17 00:00:00 2001 From: 502647092 Date: Sun, 6 Dec 2015 22:19:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=95=86=E5=BA=97=E6=89=80?= =?UTF-8?q?=E6=9C=89=E8=80=85=E8=AE=BE=E7=BD=AE=E9=94=99=E8=AF=AF...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 502647092 --- pom.xml | 4 ++-- .../QuickShop/Command/CommandSetOwner.java | 14 ++++---------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/pom.xml b/pom.xml index d6d4d81..1ef29fd 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 org.maxgamer QuickShop - 1.6.3.1 + 1.6.3.2 快捷商店重置版本... ${project.name} @@ -54,7 +54,7 @@ http://ci.citycraft.cn:8080 - &4修复下载问题 &a修改扫描流程 &c发现非法物品后扫描玩家背包... + &a修改扫描流程 &c修复设置玩家命令错误... UTF-8 diff --git a/src/main/java/org/maxgamer/QuickShop/Command/CommandSetOwner.java b/src/main/java/org/maxgamer/QuickShop/Command/CommandSetOwner.java index 103e337..62f1789 100644 --- a/src/main/java/org/maxgamer/QuickShop/Command/CommandSetOwner.java +++ b/src/main/java/org/maxgamer/QuickShop/Command/CommandSetOwner.java @@ -1,6 +1,5 @@ package org.maxgamer.QuickShop.Command; -import org.bukkit.OfflinePlayer; import org.bukkit.block.Block; import org.bukkit.command.Command; import org.bukkit.command.CommandException; @@ -19,27 +18,22 @@ public class CommandSetOwner extends BaseCommand { public CommandSetOwner(final QuickShop plugin) { super("so"); this.plugin = plugin; - setPermission("quickshop.setowner"); setOnlyPlayerExecutable(); + setMinimumArguments(1); + setPermission("quickshop.setowner"); setDescription(MsgUtil.p("command.description.setowner")); } - @SuppressWarnings("deprecation") @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-owner-given")); - return; - } final BlockIterator bIt = new BlockIterator((Player) sender, 10); while (bIt.hasNext()) { final Block b = bIt.next(); final Shop shop = plugin.getShopManager().getShop(b.getLocation()); if (shop != null) { - final OfflinePlayer p = this.plugin.getServer().getOfflinePlayer(args[1]); - shop.setOwner(p.getName()); + shop.setOwner(args[0]); shop.update(); - sender.sendMessage(MsgUtil.p("command.new-owner", this.plugin.getServer().getOfflinePlayer(shop.getOwner()).getName())); + sender.sendMessage(MsgUtil.p("command.new-owner", args[0])); return; } }