From 03f978df05c82e9fa748ebac2a3c5b4ad2b6a8d7 Mon Sep 17 00:00:00 2001 From: xjboss Date: Wed, 19 Apr 2017 14:14:08 +0800 Subject: [PATCH] =?UTF-8?q?=E7=8E=B0=E5=9C=A8=E6=8E=A7=E5=88=B6=E5=8F=B0?= =?UTF-8?q?=E6=97=A0=E8=A7=86=E6=9D=83=E9=99=90=E5=92=8CCD=E4=BA=86?= =?UTF-8?q?=EF=BC=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pw/yumc/TeleportRandom/TeleportRandom.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/java/pw/yumc/TeleportRandom/TeleportRandom.java b/src/main/java/pw/yumc/TeleportRandom/TeleportRandom.java index d9d42dc..e163525 100644 --- a/src/main/java/pw/yumc/TeleportRandom/TeleportRandom.java +++ b/src/main/java/pw/yumc/TeleportRandom/TeleportRandom.java @@ -64,10 +64,10 @@ public class TeleportRandom extends JavaPlugin implements CommandExecutor { case 1: throw new IllegalArgumentException(); case 2: - randomTP(Integer.parseInt(args[1]), p.getWorld(), p); + randomTP(Integer.parseInt(args[1]), p.getWorld(), p,true); return true; case 3: - randomTP(Integer.parseInt(args[1]), Bukkit.getWorld(args[2]), p); + randomTP(Integer.parseInt(args[1]), Bukkit.getWorld(args[2]), p,true); return true; } } @@ -89,18 +89,21 @@ public class TeleportRandom extends JavaPlugin implements CommandExecutor { config = new FileConfig(); } - public void randomTP(final int limit, final World world, final Player p) { + public void randomTP(final int limit, final World world, final Player p){ + randomTP(limit,world,p,false); + } + public void randomTP(final int limit, final World world, final Player p, final boolean console) { if (world == null || p == null) { throw new IllegalArgumentException(); } getServer().getScheduler().runTaskAsynchronously(this, new Runnable() { @Override public void run() { final long t = System.currentTimeMillis(); - if (!p.hasPermission("tpr.nocd") && cd.keySet().contains(p.getName())) { + if (!console&&!p.hasPermission("tpr.nocd") && cd.keySet().contains(p.getName())) { final long leftTime = config.getLong("CD") / 20 - (t - cd.get(p.getName())) / 1000; p.sendMessage(getPrefix() + config.getMessage("Message.CDs").replace("{0}", String.format("%s", leftTime))); return; } - if (!config.getStringList("AllowWorld").contains(world.getName())) { + if (!console&&!config.getStringList("AllowWorld").contains(world.getName())) { p.sendMessage(getPrefix() + config.getMessage("Message.NoPermWorld")); return; } @@ -111,7 +114,7 @@ public class TeleportRandom extends JavaPlugin implements CommandExecutor { } else { lr = limit; final int lrLimit = config.getInt("Limit"); - if (lr > lrLimit) { + if (!console&&lr > lrLimit) { lr = lrLimit; p.sendMessage(String.format(getPrefix() + config.getMessage("Message.Wran"), lrLimit)); }