@Override
 public void execute(CommandSender commandSender, String[] args) {
   ProxiedPlayer p = (ProxiedPlayer) commandSender;
   User user = UserManager.getUser(p.getUniqueId());
   if (commandSender instanceof ProxiedPlayer) {
     if (!user.can(type)) {
       p.sendMessage(Settings.NO_PERM);
       return;
     } // OTEK LUBI W DUPE
   }
   Ranking rank = null;
   if (args.length > 1) {
     p.sendMessage(Settings.BAD_USAGE + "/ranking [NICK]");
     return;
   } else if (args.length == 0) {
     rank = UserManager.getUser(p.getUniqueId()).getRanking();
   } else if (args.length == 1) {
     String name = args[0];
     if (!UserManager.isUser(name)) {
       p.sendMessage(Settings.USER_NO_EXIST.replace("%nick%", name));
       return;
     }
     rank = UserManager.getUserByName(name).getRanking();
   }
   for (String s : Settings.INFO_RANKINGS) {
     p.sendMessage(
         s.replace("%nick%", rank.getUser().getName())
             .replace("%points%", "" + rank.getPoints())
             .replace("%kills%", "" + rank.getKills())
             .replace("%deaths%", "" + rank.getDeaths())
             .replace("%positon%", "" + rank.getPlace()));
   }
 }
 @Override
 public void run() {
   for (Player p : Bukkit.getOnlinePlayers()) {
     User user = UserManager.getUser(p.getUniqueId());
     if (user.hasCombat()) {
       ChatUtil.sendActionBar(p, ChatUtil.fixColors("&7[&cANTYRELOG&7]"));
       continue;
     }
     int distance = LocationUtil.getDistanceFromBorder(p.getLocation());
     if (distance < 50) {
       ChatUtil.sendActionBar(p, ChatUtil.fixColors("&7GRANICA SEKTORA -- > &c" + distance));
     }
   }
 }
Exemple #3
0
 // OTEK LUBI W DUPE
 @Override
 public void execute(CommandSender commandSender, String[] args) {
   ProxiedPlayer pp = (ProxiedPlayer) commandSender;
   User user = UserManager.getUser(pp.getUniqueId());
   if (commandSender instanceof ProxiedPlayer) {
     if (!user.can(type)) {
       pp.sendMessage(Settings.NO_PERM);
       return;
     }
   }
   if (args.length != 0) {
     pp.sendMessage(Settings.BAD_USAGE + "/spawn");
     return;
   }
   Sector sector = SectorManager.getSectorByLocation(0, 0);
   if (!user.getSector().equals(sector)) {
     pp.connect(sector.getServer());
   }
   sector
       .getClient()
       .sendPacket(
           new PlayerTeleportRequestPacket(pp.getUniqueId().toString(), 5, 1, "-33:90:-148"));
   pp.sendMessage(Settings.TELEPORT_IS_PENDING);
 }