private boolean resetServerViewDistance(CommandSender sender, Server server) {
   if (server == null) {
     return false;
   }
   if (!sender.hasPermission("viewdistance.reset.server")
       && !sender.hasPermission("viewdistance.reset.server." + server.getName())) {
     sender.sendMessage("You do not have permission to use this command.");
     return true;
   }
   try {
     server.setViewDistance(SERVER_DEFAULT_VIEW_DISTANCE);
   } catch (IllegalArgumentException e) {
     sender.sendMessage(e.getMessage());
     return false;
   }
   sender.sendMessage("Server view distance reset. It is now " + server.getViewDistance());
   return true;
 }
Esempio n. 2
0
 @Override
 public int getViewDistance() {
   return server.getViewDistance();
 }