1
0
mirror of https://e.coding.net/circlecloud/TeleportRandom.git synced 2024-11-01 07:38:47 +00:00

fix: 修复控制台命令失效问题

Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
502647092 2016-08-09 14:03:53 +08:00
parent 85e530a127
commit 13ccb1a96b

View File

@ -27,6 +27,18 @@ public class TeleportRandom extends JavaPlugin implements CommandExecutor {
@Override @Override
public boolean onCommand(final CommandSender sender, final Command cmd, final String string, final String[] args) { public boolean onCommand(final CommandSender sender, final Command cmd, final String string, final String[] args) {
if (args.length > 0) {
if (args[0].equalsIgnoreCase("reload")) {
config.reload();
sender.sendMessage(getPrefix() + config.getMessage("Message.Reload"));
return true;
}
if (args[0].equalsIgnoreCase("help")) {
sender.sendMessage("玩家: /tpr [范围] [世界]");
sender.sendMessage("控制台: /tpr <玩家> [范围] [世界]");
return true;
}
}
try { try {
if (sender instanceof Player) { if (sender instanceof Player) {
final Player p = (Player) sender; final Player p = (Player) sender;
@ -59,18 +71,6 @@ public class TeleportRandom extends JavaPlugin implements CommandExecutor {
} }
} }
} catch (final IllegalArgumentException e) { } catch (final IllegalArgumentException e) {
if (args.length > 0) {
if (args[0].equalsIgnoreCase("reload")) {
config.reload();
sender.sendMessage(getPrefix() + config.getMessage("Message.Reload"));
return true;
}
if (args[0].equalsIgnoreCase("help")) {
sender.sendMessage("玩家: /tpr [范围] [世界]");
sender.sendMessage("控制台: /tpr <玩家> [范围] [世界]");
return true;
}
}
sender.sendMessage(getPrefix() + "§c非法的参数或不存在的世界!"); sender.sendMessage(getPrefix() + "§c非法的参数或不存在的世界!");
} }
return false; return false;