Java 类org.bukkit.scoreboard.Team.Option 实例源码

项目:MT_Core    文件:CustomScoreboards.java   
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);
    }
}
项目:Blur    文件:BlurTeam.java   
public void updateTeamFields(@Nonnull Team team, boolean updatePlayers) {
    if (!team.getDisplayName().equals(getName())) {
        team.setDisplayName(getName());
    }
    if (!team.getPrefix().equals(getChatPrefix())) {
        team.setPrefix(getChatPrefix());
    }
    if (!team.getOption(Option.NAME_TAG_VISIBILITY).equals(getNametagVisibility().getBukkit())) {
        team.setOption(Option.NAME_TAG_VISIBILITY, getNametagVisibility().getBukkit());
    }
    if (!team.getOption(Option.DEATH_MESSAGE_VISIBILITY).equals(getDeathMessageVisibility().getBukkit())) {
        team.setOption(Option.DEATH_MESSAGE_VISIBILITY, getDeathMessageVisibility().getBukkit());
    }
    if (!team.getOption(Option.COLLISION_RULE).equals(getCollisionRule().getBukkit())) {
        team.setOption(Option.COLLISION_RULE, getCollisionRule().getBukkit());
    }
    if (updatePlayers) {
        Set<String> oldEntries = players.stream().map(BlurPlayer::getName).collect(Collectors.toSet());
        oldEntries.removeAll(team.getEntries());
        oldEntries.forEach(team::removeEntry);
        for (BlurPlayer blurPlayer : players) {
            team.addEntry(blurPlayer.getName());
        }
    }
}
项目:Blur    文件:BlurTeam.java   
public void updateTeamFields(@Nonnull Team team, boolean updatePlayers) {
    if (!team.getDisplayName().equals(getName())) {
        team.setDisplayName(getName());
    }
    if (!team.getPrefix().equals(getChatPrefix())) {
        team.setPrefix(getChatPrefix());
    }
    if (!team.getOption(Option.NAME_TAG_VISIBILITY).equals(getNametagVisibility().getBukkit())) {
        team.setOption(Option.NAME_TAG_VISIBILITY, getNametagVisibility().getBukkit());
    }
    if (!team.getOption(Option.DEATH_MESSAGE_VISIBILITY).equals(getDeathMessageVisibility().getBukkit())) {
        team.setOption(Option.DEATH_MESSAGE_VISIBILITY, getDeathMessageVisibility().getBukkit());
    }
    if (!team.getOption(Option.COLLISION_RULE).equals(getCollisionRule().getBukkit())) {
        team.setOption(Option.COLLISION_RULE, getCollisionRule().getBukkit());
    }
    if (updatePlayers) {
        Set<String> oldEntries = players.stream().map(BlurPlayer::getName).collect(Collectors.toSet());
        oldEntries.removeAll(team.getEntries());
        oldEntries.forEach(team::removeEntry);
        for (BlurPlayer blurPlayer : players) {
            team.addEntry(blurPlayer.getName());
        }
    }
}
项目:Ultra-Hardcore-1.8    文件:UhcTeams.java   
private void cInv() {
    uE = uA.getServer().createInventory(null, 18, "          - Select Team -");
    for (int a = 0; a < uCa.length; a++) {
        if (uB.getTeam(uCa[a]) != null) {
            uB.getTeam(uCa[a]).unregister();
        }
        Team b = uB.registerNewTeam(uCa[a]);
        b.setPrefix("\u00A7" + uCb[a]);
        b.setSuffix("\u00A7r");
        b.setAllowFriendlyFire(uA.mC.cGd);
        b.setCanSeeFriendlyInvisibles(uA.mC.cGe);
        b.setOption(Option.NAME_TAG_VISIBILITY, tStat(uA.mC.cGf));
        b.setOption(Option.COLLISION_RULE, tStat(uA.mC.cGf));
        ItemStack c = nItem(Material.ENCHANTED_BOOK, 0, "\u00A7" + uCb[a] + "\u00A7l" + uCa[a].replace("_", " "), "0|", "1|\u00A78Max " + uA.mC.cGb + " Player" + (uA.mC.cGb > 1 ? "s" : ""));
        uE.addItem(c);
    }
    uE.setItem(17, nItem(Material.BARRIER, 0, "\u00A7cSpectator Mode", ""));
}
项目:Pokkit    文件:ScoreboardPersister.java   
private void loadTeam(ConfigurationSection config, Team team) {
    team.setDisplayName(config.getString("display_name", ""));
    team.setPrefix(config.getString("prefix", ""));
    team.setSuffix(config.getString("suffix", ""));
    team.setOption(Option.COLLISION_RULE, toOptionStatus(config.getString("collisions", "")));
    team.setOption(Option.DEATH_MESSAGE_VISIBILITY, toOptionStatus(config.getString("death_messages", "")));
    team.setOption(Option.NAME_TAG_VISIBILITY, toOptionStatus(config.getString("name_tags", "")));
    team.setAllowFriendlyFire(config.getBoolean("friendly_fire"));
    team.setColor(toChatColor(config.getString("color", "")));

    List<String> members = config.getStringList("members");
    if (members != null) {
        members.forEach(team::addEntry);
    }
}
项目:Pokkit    文件:ScoreboardPersister.java   
private void saveTeam(ConfigurationSection config, Team team) {
    config.set("display_name", team.getDisplayName());
    config.set("prefix", team.getPrefix());
    config.set("suffix", team.getSuffix());
    config.set("collisions", team.getOption(Option.COLLISION_RULE).name().toLowerCase());
    config.set("death_messages", team.getOption(Option.DEATH_MESSAGE_VISIBILITY).name().toLowerCase());
    config.set("name_tags", team.getOption(Option.NAME_TAG_VISIBILITY).name().toLowerCase());
    config.set("friendly_fire", team.allowFriendlyFire());
    config.set("members", new ArrayList<>(team.getEntries()));
    config.set("color", team.getColor().name());
}
项目:Ultra-Hardcore-1.8    文件:UhcTeams.java   
public void updateOptions(boolean a) {
    if (a) {
        for (int b = 0; b < uCa.length; b++) {
            if (uB.getTeam(uCa[b]) != null) {
                Team c = uB.getTeam(uCa[b]);
                c.setAllowFriendlyFire(uA.mC.cGd);
                c.setCanSeeFriendlyInvisibles(uA.mC.cGe);
                c.setOption(Option.NAME_TAG_VISIBILITY, tStat(uA.mC.cGf));
                c.setOption(Option.COLLISION_RULE, tStat(uA.mC.cGg));
            }
        }
        return;
    }
    updateInv();
}
项目:skRayFall    文件:TeamManager.java   
/**
 * 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);
    }
  }
}
项目:skRayFall    文件:Eff1_9TeamCollisionRule.java   
@Override
protected void execute(Event evt) {
  if (team != null && optionStatus != null) {
    Core.teamManager.setTeamOption(team.getSingle(evt).replace("\"", ""),
        Option.DEATH_MESSAGE_VISIBILITY, optionStatus.getSingle(evt));
  }
}
项目:skRayFall    文件:Eff1_9MessageOnDeathRule.java   
@Override
protected void execute(Event evt) {
  if (team != null) {
    Core.teamManager.setTeamOption(team.getSingle(evt).replace("\"", ""),
        Option.DEATH_MESSAGE_VISIBILITY, status.getSingle(evt));
  }
}
项目:skRayFall    文件:Eff1_9NameTagVisibility.java   
@Override
protected void execute(Event evt) {
  if (optionStatus != null && team != null) {
    Core.teamManager.setTeamOption(team.getSingle(evt).replace("\"", ""),
        Option.NAME_TAG_VISIBILITY, optionStatus.getSingle(evt));
  }
}
项目:CraftoPlugin    文件:ScoreboardManager.java   
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());
        }
    }
}