示例#1
0
 public void updateLabel(XLabel label) {
   resetScores(label);
   if (label.isVisible()) {
     if (label.getValue().equals("")) {
       return;
     }
     if (label.getValue().equals("§a ")) {
       // Is a spacer label, no need to make a team and shit for it as teams
       // don't seem to like the name only being a space and color
       scoreboard
           .getObjective(DisplaySlot.SIDEBAR)
           .getScore(label.getValue())
           .setScore(label.getScore());
     } else {
       int split = Math.round(label.getValue().length() / 2);
       final String key = label.getValue().substring(0, split);
       if (key.equals("")) {
         return;
       }
       final String value = label.getValue().substring(split, label.getValue().length());
       scoreboard.getObjective(DisplaySlot.SIDEBAR).getScore(key).setScore(label.getScore());
       if (scoreboard.getEntries().toArray().length != 0) {
         Team team = this.scoreboard.getTeam(key);
         if (team == null) {
           team = this.scoreboard.registerNewTeam(key);
           team.addPlayer(new FakeOfflinePlayer(key));
         }
         team.setSuffix(value);
       }
     }
   }
   scores.put(label.getScore(), label);
   label.setUpdated(true);
 }