public CustomScoreboards(MortuusTerraCore main) { this.main = main; ScoreboardManager manager = Bukkit.getScoreboardManager(); pkTeamsBoard = manager.getNewScoreboard(); pkTeamsBoard.registerNewTeam("NEUTRAL"); pkTeamsBoard.registerNewTeam("ORANGE"); pkTeamsBoard.registerNewTeam("RED"); pkTeamsBoard.getTeam("NEUTRAL").setPrefix(PKStates.NEUTRAL.getColor() + ""); pkTeamsBoard.getTeam("ORANGE").setPrefix(PKStates.ORANGE.getColor() + ""); pkTeamsBoard.getTeam("RED").setPrefix(PKStates.RED.getColor() + ""); for (Team team : pkTeamsBoard.getTeams()) { team.setOption(Option.NAME_TAG_VISIBILITY, OptionStatus.ALWAYS); } }
private OptionStatus toOptionStatus(String string) { try { return OptionStatus.valueOf(string.toUpperCase()); } catch (IllegalArgumentException e) { return OptionStatus.ALWAYS; } }
private OptionStatus tStat(int a) { if (a == 0) { return OptionStatus.ALWAYS; } else if (a == 1) { return OptionStatus.FOR_OTHER_TEAMS; } else if (a == 2) { return OptionStatus.FOR_OWN_TEAM; } return OptionStatus.NEVER; }
/** * Set the a teams option by team name. * * @param team The reference name of the team. * @param option The option to be set. * @param status The options value to be set. */ public void setTeamOption(String team, Option option, OptionStatus status) { if (teamMap.containsKey(team)) { teamMap.get(team).setOption(option, status); for (Object p : Bukkit.getServer().getOnlinePlayers().toArray()) { // Debug Bukkit.broadcastMessage("Team option set!"); ((Player) p).getScoreboard().getTeam(team).setOption(option, status); } } }
@SuppressWarnings("unchecked") @Override public boolean init(Expression<?>[] exp, int arg1, Kleenean arg2, ParseResult arg3) { status = (Expression<OptionStatus>) exp[0]; team = (Expression<String>) exp[1]; return true; }
@SuppressWarnings("unchecked") @Override public boolean init(Expression<?>[] exp, int arg1, Kleenean arg2, ParseResult arg3) { optionStatus = (Expression<OptionStatus>) exp[0]; team = (Expression<String>) exp[1]; return true; }
public void load() { final Scoreboard scoreboard = this.module.getServer().getScoreboardManager().getMainScoreboard(); for (final Group group : Groups.values()) { Team team = scoreboard.getTeam( group.getName().toLowerCase() ); if (team == null) { scoreboard.registerNewTeam(group.getName().toLowerCase()); team = scoreboard.getTeam(group.getName().toLowerCase()); team.setOption(Option.COLLISION_RULE, OptionStatus.NEVER); team.setAllowFriendlyFire(false); Utility.runCommand("scoreboard teams option " + team.getName() + " color " + group.getColor().name()); } } }