예제 #1
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());
   }
 }
 protected void addPlayer(OfflinePlayer player) {
   if (player == null) return;
   User user = User.get(player);
   if (!user.hasGuild()) return;
   Scoreboard scoreboard = this.getUser().getScoreboard();
   Team team = scoreboard.getPlayerTeam(player);
   if (team != null) team.removePlayer(player);
   team = scoreboard.getTeam(user.getGuild().getTag());
   if (team == null) {
     addGuild(user.getGuild());
     team = scoreboard.getTeam(user.getGuild().getTag());
   }
   if (this.getUser().hasGuild())
     if (this.getUser().equals(user) || this.getUser().getGuild().getMembers().contains(user))
       team.setPrefix(
           replace(Settings.getInstance().prefixOur, "{TAG}", user.getGuild().getTag()));
   team.addPlayer(player);
 }