Ejemplo n.º 1
0
 private void update() {
   this.ss = PlayerListScheme.getScheme();
   Calendar now = Calendar.getInstance();
   int second = now.get(Calendar.SECOND);
   int minute = now.get(Calendar.MINUTE);
   for (int i : PlayerListScheme.getEdit()) {
     String s = ss[i];
     if (s == null || s.isEmpty()) continue;
     if (second < 10) s = StringUtils.replace(s, "{SECOND}", '0' + Integer.toString(second));
     else s = StringUtils.replace(s, "{SECOND}", Integer.toString(second));
     if (minute < 10) s = StringUtils.replace(s, "{MINUTE}", '0' + Integer.toString(minute));
     else s = StringUtils.replace(s, "{MINUTE}", Integer.toString(minute));
     if (user.hasGuild()) {
       s = StringUtils.replace(s, "{GUILD}", user.getGuild().getName());
       s = StringUtils.replace(s, "{TAG}", user.getGuild().getTag());
     } else {
       s = StringUtils.replace(s, "{GUILD}", "Brak");
       s = StringUtils.replace(s, "{TAG}", "Brak");
     }
     s = StringUtils.replace(s, "{ONLINE}", Integer.toString(Bukkit.getOnlinePlayers().size()));
     s = StringUtils.replace(s, "{PLAYER}", user.getName());
     s = StringUtils.replace(s, "{TPS}", Ticking.getTPS());
     s = StringUtils.replace(s, "{PING}", Integer.toString(user.getPing()));
     s = StringUtils.replace(s, "{POINTS}", Integer.toString(user.getRank().getPoints()));
     s = StringUtils.replace(s, "{KILLS}", Integer.toString(user.getRank().getKills()));
     s = StringUtils.replace(s, "{DEATHS}", Integer.toString(user.getRank().getDeaths()));
     s = StringUtils.replace(s, "{HOUR}", Integer.toString(now.get(Calendar.HOUR_OF_DAY)));
     String r = Parser.parseRank(s);
     if (r != null) s = r;
     prefix[i] = "";
     suffix[i] = "";
     ss[i] = s;
   }
 }
Ejemplo n.º 2
0
 @SuppressWarnings("deprecation")
 public void updateScore(User user) {
   if (!Settings.getInstance().dummyEnable) return;
   Scoreboard scoreboard = this.user.getScoreboard();
   Objective objective = scoreboard.getObjective(NAME);
   if (objective == null || !objective.getName().equals(NAME)) initialize();
   else {
     OfflineUser offline = user.getOfflineUser();
     objective.getScore(offline).setScore(user.getRank().getPoints());
   }
 }
Ejemplo n.º 3
0
 private void initialize() {
   if (!Settings.getInstance().dummyEnable) return;
   Scoreboard scoreboard = this.user.getScoreboard();
   Objective objective = scoreboard.getObjective(NAME);
   if (objective == null || !objective.getName().equals(NAME)) {
     objective = scoreboard.registerNewObjective(NAME, "dummy");
     objective.setDisplaySlot(DisplaySlot.BELOW_NAME);
     objective.setDisplayName(Settings.getInstance().dummySuffix);
   }
   for (Player player : Bukkit.getOnlinePlayers()) {
     User user = User.get(player);
     @SuppressWarnings("deprecation")
     Score score = objective.getScore(user.getOfflineUser());
     score.setScore(user.getRank().getPoints());
   }
 }