mirror of
https://e.coding.net/circlecloud/TeleportRandom.git
synced 2024-10-31 07:28:47 +00:00
现在控制台无视权限和CD了!
This commit is contained in:
parent
27ead9b23e
commit
03f978df05
@ -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;
|
||||
}
|
||||
}
|
||||
@ -90,17 +90,20 @@ public class TeleportRandom extends JavaPlugin implements CommandExecutor {
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user