Example #1
0
 public static void toggleSelShow(Player player) {
   if (selShow.contains(player.getName())) selShow.remove(player.getName());
   else selShow.add(player.getName());
 }
Example #2
0
 public static boolean isSelShow(Player player) {
   return selShow.contains(player.getName());
 }
Example #3
0
 public boolean execute(CommandSender sender, String commandLabel, String[] args) {
   if (!sender.hasPermission(this.getPermission())) {
     Message.YOU_DONT_HAVE_PERMISSION.print(sender, 'c');
   } else {
     if (args.length >= 1) {
       switch (args[0]) {
         case "tp":
           if (args.length == 3) {
             Player p = this.plugin.getServer().getPlayer(args[2]);
             if (p == null) {
               p = this.plugin.sortedListPlayers(args[0]);
               if (p == null) {
                 Message.UNKNOWN_PLAYER.print(sender, "prefix:&7[&aWorld&7]", 'c');
                 return true;
               }
             }
             if (sender.hasPermission("toolspro.commands.world")
                 || sender.hasPermission("toolspro.commands.world.other")
                 || sender.hasPermission("toolspro.commands.world." + args[1])) {
               if (p.getLevel().getName().equalsIgnoreCase(args[1])) {
                 Message.CMD_WORLD_TP_PLAYER_ALREADY_IN_THIS_WORLD.print(
                     sender, "prefix:&7[&aWorld&7]", 'c');
                 return false;
               } else if (!p.getServer().isLevelGenerated(args[1])) {
                 Message.CMD_WORLD_TP_NOT_FOUND.print(sender, "prefix:&7[&aWorld&7]", 'c');
                 return false;
               } else if (!p.getServer().isLevelLoaded(args[1])) {
                 Message.CMD_WORLD_TP_NOT_LOADED.print(sender, "prefix:&7[&aWorld&7]", 'c');
                 if (!p.getServer().loadLevel(args[1])) {
                   Message.CMD_WORLD_TP_ERROR_LOADING.print(sender, "prefix:&7[&aWorld&7]", 'c');
                   return false;
                 }
               }
               p.teleport(this.plugin.getServer().getLevelByName(args[1]).getSafeSpawn());
               Message.CMD_WORLD_TP_SENDER.print(
                   sender, "prefix:&7[&aWorld&7]", 'a', 'b', p.getName(), args[1]);
               Message.CMD_WORLD_TP_PLAYER_MESSAGE.print(
                   p, "prefix:&7[&aWorld&7]", 'a', 'b', args[1]);
             } else {
               Message.CMD_WORLD_TP_PLAYER_PERMISSION.print(sender, "prefix:&7[&aWorld&7]", 'c');
             }
           } else {
             if (sender instanceof Player) {
               if (args.length == 2) {
                 if (sender.hasPermission("toolspro.commands.world")
                     || sender.hasPermission("toolspro.world." + args[1].toLowerCase())) {
                   if (((Player) sender).getLevel().getName().equalsIgnoreCase(args[1])) {
                     Message.CMD_WORLD_TP_SENDER_ALREADY_IN_THIS_WORLD.print(
                         sender, "prefix:&7[&aWorld&7]", 'c');
                     return false;
                   } else if (!sender.getServer().isLevelGenerated(args[1])) {
                     Message.CMD_WORLD_TP_NOT_FOUND.print(sender, "prefix:&7[&aWorld&7]", 'c');
                     return false;
                   } else if (!sender.getServer().isLevelLoaded(args[1])) {
                     Message.CMD_WORLD_TP_NOT_LOADED.print(sender, "prefix:&7[&aWorld&7]", 'c');
                     if (!sender.getServer().loadLevel(args[1])) {
                       Message.CMD_WORLD_TP_ERROR_LOADING.print(
                           sender, "prefix:&7[&aWorld&7]", 'c');
                       return false;
                     }
                   }
                   ((Player) sender)
                       .teleport(this.plugin.getServer().getLevelByName(args[1]).getSafeSpawn());
                   Message.CMD_WORLD_TP.print(sender, "prefix:&7[&aWorld&7]", 'a');
                 } else {
                   Message.CMD_WORLD_TP_SENDER_NO_PERMISSION.print(
                       sender, "prefix:&7[&aWorld&7]", 'c');
                 }
               } else {
                 Message.CMD_WORLD_USAGE_TP.print(sender, "prefix:&7[&aWorld&7]", 'c');
               }
             } else {
               Message.NEED_PLAYER.print(sender, "prefix:&7[&aWorld&7]", 'c');
             }
           }
           return true;
         case "create":
           if (sender.hasPermission("toolspro.commands.world.create")) {
             if (args.length >= 2) {
               if (!sender.getServer().isLevelGenerated(args[1])) {
                 long seed = System.currentTimeMillis();
                 Class generator;
                 if (args.length <= 2) {
                   generator = Generator.getGenerator(Generator.TYPE_INFINITE);
                 } else {
                   int type;
                   switch (args[2].toLowerCase()) {
                     case "old":
                       type = Generator.TYPE_OLD;
                       break;
                     case "infinite":
                     default:
                       type = Generator.TYPE_INFINITE;
                       break;
                     case "flat":
                       type = Generator.TYPE_FLAT;
                       break;
                   }
                   generator = Generator.getGenerator(type);
                 }
                 sender
                     .getServer()
                     .generateLevel(
                         args[1], seed == 0 ? System.currentTimeMillis() : seed, generator);
                 Message.CMD_WORLD_CREATE.print(sender, "prefix:&7[&aWorld&7]", 'a', 'b', args[1]);
               } else {
                 Message.CMD_WORLD_CREATE_ALREADY_EXISTS.print(
                     sender, "prefix:&7[&aWorld&7]", 'c');
               }
             } else {
               return Message.CMD_WORLD_USAGE_CREATE.print(sender, "prefix:&7[&aWorld&7]", 'c');
             }
           } else {
             return Message.YOU_DONT_HAVE_PERMISSION.print(sender, 'c');
           }
           return true;
         default:
           return Message.CMD_WORLD_USAGE.print(sender, "prefix:&7[&aWorld&7]", 'c');
       }
     } else {
       return Message.CMD_WORLD_USAGE.print(sender, "prefix:&7[&aWorld&7]", 'c');
     }
   }
   return true;
 }
Example #4
0
 @Override
 public void setBlock(Player player, Block block, Location loc1, Location loc2) {
   setBlock(player.getName(), block, loc1, loc2);
 }
Example #5
0
 @Override
 public void replaceBlock(
     Player player, Block b1, Block b2, boolean compareData, Location loc1, Location loc2) {
   replaceBlock(player.getName(), b1, b2, compareData, loc1, loc2);
 }
Example #6
0
 @Override
 public void setBlockWall(Player player, Block block, Location l1, Location l2) {
   setBlockBox(player.getName(), block, l1, l2);
 }
Example #7
0
 @Override
 public void setBlock(Player player, Collection<Block> blocks) {
   setBlock(player.getName(), blocks);
 }