From e05b2118e6a53bdf7db011bdca352c19ab707230 Mon Sep 17 00:00:00 2001 From: xjboss2 Date: Fri, 18 Mar 2016 10:46:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=90=8E=E5=8F=B0=E4=BC=A0?= =?UTF-8?q?=E9=80=81=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TeleportRandom/TeleportRandom.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/main/java/cn/citycraft/TeleportRandom/TeleportRandom.java b/src/main/java/cn/citycraft/TeleportRandom/TeleportRandom.java index 066919c..58d482e 100644 --- a/src/main/java/cn/citycraft/TeleportRandom/TeleportRandom.java +++ b/src/main/java/cn/citycraft/TeleportRandom/TeleportRandom.java @@ -50,7 +50,25 @@ public class TeleportRandom extends JavaPlugin implements CommandExecutor { } return true; } - sender.sendMessage(pluginname + "§c控制台无法使用此命令!"); + if(args.length>0){ + try { + switch (args.length) { + case 1: + RandomTP(0,Bukkit.getPlayer(args[0])); + break; + case 2: + RandomTP(Integer.parseInt(args[1]),Bukkit.getPlayer(args[0])); + break; + case 3: + RandomTP(Integer.parseInt(args[1]),Bukkit.getWorld(args[2]),Bukkit.getPlayer(args[0])); + break; + } catch (final Exception e) { + sender.sendMessage(pluginname + "§c非法的参数或不存在的世界!"); + } + } + return true; + } + sender.sendMessage(pluginname + "§c非法的参数!"); return false; }