예제 #1
0
 public void loadAll() {
   shelves.clear();
   for (int i = 0; i < getFile().size(); i++) {
     String key = (String) getFile().keySet().toArray()[i];
     int x;
     int y;
     int z;
     World world;
     Location location;
     try {
       x = Integer.parseInt(key.split(",")[1]);
       y = Integer.parseInt(key.split(",")[2]);
       z = Integer.parseInt(key.split(",")[3]);
     } catch (NumberFormatException e) {
       BenCmd.log(
           Level.WARNING,
           "Shelf (" + getFile().keySet().toArray()[i] + ")'s location is invalid!");
       continue;
     } catch (IndexOutOfBoundsException e) {
       BenCmd.log(
           Level.WARNING,
           "Shelf (" + getFile().keySet().toArray()[i] + ")'s location is invalid!");
       continue;
     }
     if ((world = Bukkit.getWorld(key.split(",")[0])) == null) {
       BenCmd.log(
           Level.WARNING,
           "Shelf (" + getFile().keySet().toArray()[i] + ")'s location is invalid!");
       continue;
     }
     location = new Location(world, x, y, z);
     String text = getFile().getProperty(key);
     shelves.put(location, new Shelf(location, text));
   }
 }
예제 #2
0
 public void online(User user, String[] args) {
   if (args.length == 0) {
     if (user.isServer()) {
       BenCmd.getLocale().sendMessage(user, "basic.noServerUse");
       return;
     }
     if (!user.isOffline()) {
       BenCmd.getLocale().sendMessage(user, "command.online.selfAlready");
     } else {
       user.goOnline();
       BenCmd.getLocale().sendMessage(user, "command.online.self");
     }
   } else if (args.length == 1) {
     if (!user.hasPerm("bencmd.poof.offline.other")) {
       BenCmd.getPlugin().logPermFail(user, "online", args, true);
       return;
     }
     User user2 = User.matchUserAllowPartial(args[0]);
     if (user2 == null) {
       BenCmd.getLocale().sendMessage(user, "basic.userNotFound", args[0]);
       return;
     }
     if (!user2.isOffline()) {
       BenCmd.getLocale().sendMessage(user, "command.online.otherAlready", user2.getName());
     } else {
       user2.goOnline();
       BenCmd.getLocale().sendMessage(user2, "command.online.self");
       BenCmd.getLocale().sendMessage(user, "command.online.other", user2.getName());
     }
   } else {
     BenCmd.showUse(user, "online");
   }
 }
예제 #3
0
 public void monitor(User user, String[] args) {
   if (args.length == 0) {
     BenCmd.showUse(user, "monitor");
   } else if (args[0].equalsIgnoreCase("none")) {
     BenCmd.getMonitorController().cancelMonitor(user.getPlayerHandle());
   } else {
     User user2 = User.matchUserAllowPartial(args[0]);
     if (user2 == null) {
       BenCmd.getLocale().sendMessage(user, "basic.userNotFound", args[0]);
       return;
     }
     BenCmd.getMonitorController().setMonitor(user.getPlayerHandle(), user2.getPlayerHandle());
     BenCmd.getLocale().sendMessage(user, "command.monitor.success", user2.getName());
   }
 }
예제 #4
0
 public void noPoof(User user, String args[]) {
   if (args.length == 0) {
     if (user.isServer()) {
       BenCmd.getLocale().sendMessage(user, "basic.noServerUse");
       return;
     }
     if (!user.isNoPoofed()) {
       user.noPoof();
       BenCmd.getLocale().sendMessage(user, "command.nopoof.poof");
     } else {
       user.unNoPoof();
       BenCmd.getLocale().sendMessage(user, "command.nopoof.unpoof");
     }
   } else if (args.length == 1) {
     if (!user.hasPerm("bencmd.poof.nopoof.other")) {
       BenCmd.getPlugin().logPermFail(user, "nopoof", args, true);
       return;
     }
     User user2 = User.matchUserAllowPartial(args[0]);
     if (user2 == null) {
       BenCmd.getLocale().sendMessage(user, "basic.userNotFound", args[0]);
       return;
     }
     if (!user2.isNoPoofed()) {
       user2.noPoof();
       BenCmd.getLocale().sendMessage(user2, "command.nopoof.poof");
       BenCmd.getLocale().sendMessage(user, "command.nopoof.poofOther", user2.getName());
     } else {
       user2.unNoPoof();
       BenCmd.getLocale().sendMessage(user2, "command.nopoof.unpoof");
       BenCmd.getLocale().sendMessage(user, "command.allpoof.unpoofOther", user2.getName());
     }
   } else {
     BenCmd.showUse(user, "nopoof");
   }
 }
예제 #5
0
 public void poof(User user, String[] args) {
   if (args.length == 0) {
     if (user.isServer()) {
       BenCmd.getLocale().sendMessage(user, "basic.noServerUse");
       return;
     }
     if (!user.isPoofed()) {
       user.poof();
       BenCmd.getLocale().sendMessage(user, "command.poof.poof");
     } else {
       if (user.isOffline()) {
         BenCmd.getLocale().sendMessage(user, "command.poof.selfOffline");
       } else if (BenCmd.getMonitorController().isMonitoring((Player) user.getHandle())) {
         BenCmd.getLocale().sendMessage(user, "command.poof.selfMonitor");
       } else if (user.isAllPoofed()) {
         user.unAllPoof();
         user.unPoof();
         BenCmd.getLocale().sendMessage(user, "command.poof.unpoof");
       } else {
         user.unPoof();
         BenCmd.getLocale().sendMessage(user, "command.poof.unpoof");
       }
     }
   } else if (args.length == 1) {
     if (!user.hasPerm("bencmd.poof.poof.other")) {
       BenCmd.getPlugin().logPermFail(user, "poof", args, true);
       return;
     }
     User user2 = User.matchUserAllowPartial(args[0]);
     if (user2 == null) {
       BenCmd.getLocale().sendMessage(user, "basic.userNotFound", args[0]);
       return;
     }
     if (!user2.isPoofed()) {
       user2.poof();
       BenCmd.getLocale().sendMessage(user2, "command.poof.poof");
     } else {
       if (user2.isOffline()) {
         BenCmd.getLocale().sendMessage(user, "command.poof.otherOffline");
       } else if (BenCmd.getMonitorController().isMonitoring((Player) user2.getHandle())) {
         BenCmd.getLocale().sendMessage(user, "command.poof.otherMonitor");
       } else if (user2.isAllPoofed()) {
         user2.unAllPoof();
         user2.unPoof();
         BenCmd.getLocale().sendMessage(user2, "command.poof.unpoof");
         BenCmd.getLocale().sendMessage(user, "command.poof.unpoofOther", user2.getName());
       } else {
         user2.unPoof();
         BenCmd.getLocale().sendMessage(user2, "command.poof.unpoof");
         BenCmd.getLocale().sendMessage(user, "command.poof.unpoofOther", user2.getName());
       }
     }
   } else {
     BenCmd.showUse(user, "poof");
   }
 }