Java 类org.bukkit.scoreboard.Scoreboard 实例源码

项目:SpigotBoard    文件:SBScoreboard.java   
@Override
public void enableScoreboard() {
       final Scoreboard board = Bukkit.getScoreboardManager().getNewScoreboard();
       final Objective obj = board.registerNewObjective("Spigotboard", "dummy");

       obj.setDisplaySlot(DisplaySlot.SIDEBAR);
       obj.setDisplayName(ChatColor.translateAlternateColorCodes('&', Main.instance.getConfig().getString("title")));

       new BukkitRunnable() {
           @Override
           public void run() {
               for(Player p : Bukkit.getOnlinePlayers()) {
                int count = Main.instance.getConfig().getList("text").size();

                PlaceholderUtils placeholders = new PlaceholderUtils(p);
                   for(Object text : Main.instance.getConfig().getList("text")){
                    obj.getScore(ChatColor.translateAlternateColorCodes('&', placeholders.replace(text.toString()))).setScore(count);
                    count--;
                   }
                   p.setScoreboard(board);
               }
           }
       }.runTaskTimer(Main.instance, 0, 20);
}
项目:ProjectAres    文件:ScoreboardMatchModule.java   
public Scoreboard getScoreboard(Party party) {
    return MapUtils.computeIfAbsent(partyScoreboards, party, () -> {
        // Create the new party's scoreboard
        Scoreboard scoreboard = getMatch().getServer().getScoreboardManager().getNewScoreboard();
        logger.fine("Created scoreboard " + toString(scoreboard) + " for party " + party);

        // Add all other party scoreboards to the new party's scoreboard
        for(Party oldParty : partyScoreboards.keySet()) {
            createPartyScoreboardTeam(oldParty, scoreboard, !(party instanceof Competitor));
        }

        // Add the new party to its own scoreboard
        createPartyScoreboardTeam(party, scoreboard, !(party instanceof Competitor));

        // Add the new party to the hidden scoreboard
        createPartyScoreboardTeam(party, hiddenScoreboard, false);

        // Add the new party to all other party scoreboards
        for(Map.Entry<Party, Scoreboard> entry : partyScoreboards.entrySet()) {
            createPartyScoreboardTeam(party, entry.getValue(), !(entry.getKey() instanceof Competitor));
        }
        return scoreboard;
    });
}
项目:ProjectAres    文件:RaindropsListener.java   
@EventHandler(priority = EventPriority.MONITOR)
public void displayScoreboard(final PlayerJoinEvent event) {
    final Player player = event.getPlayer();
    final User user = userStore.getUser(player);
    final PlayerId playerId = tc.oc.api.bukkit.users.Users.playerId(player);
    final Scoreboard scoreboard = Bukkit.getScoreboardManager().getMainScoreboard();
    final Objective objective = getOrCreateObjective(scoreboard, player.getName(), "dummy");
    final String raindropsName = ChatColor.AQUA + "Raindrops";

    objective.setDisplayName(renderer.renderLegacy(generalFormatter.brandName(), event.getPlayer()));

    objective.getScore(raindropsName).setScore(2);
    Utils.displayScoreboard(player, objective);
    setRaindropsCount(player, user.raindrops());
    GizmoUtils.setGizmo(player, Gizmos.emptyGizmo, true);
}
项目:ProjectAres    文件:RaindropsListener.java   
private void setRaindropsCount(Player player, int count) {
    if(player == null) return;

    final Scoreboard scoreboard = Bukkit.getScoreboardManager().getMainScoreboard();
    Objective objective = scoreboard.getObjective(player.getName());

    Integer oldCount = raindrops.get(player);
    if(oldCount != null) {
        Utils.removeScore(player, String.format("%,d", oldCount));
    }
    Utils.addScore(player, objective, String.format("%,d", count), 1);

    raindrops.put(player, count);

    Utils.giveGhastTear(player, count);
}
项目:AlphaLibary    文件:GameTeam.java   
public GameTeam removePlayer(Player p, boolean updateTab) {

        TeamLeaveEvent event = new TeamLeaveEvent(p, this);
        Bukkit.getPluginManager().callEvent(event);

        if (event.isCancelled()) return this;

        if (members.contains(p.getName())) {

            if (updateTab) {
                if (p.getScoreboard() != null) {

                    Scoreboard s = p.getScoreboard();

                    if (s.getTeam(this.getTeamName()) != null) {
                        Team team = s.getTeam(this.getRawTeamName());

                        team.removeEntry(p.getName());
                    }
                }
            }

            members.remove(p.getName());
        }
        return this;
    }
项目:skLib    文件:SbManager.java   
public static void createscrollsb(Player p, String title) {
    Scoreboard scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
    playerScoreboard = scoreboard.registerNewObjective("sklib", "dummy"); //The name of the scoreboard is the name of the player, not that it really needs to be
    playerScoreboard.setDisplayName("Placeholder"); //Will not show to the user, we just need to set this to make bukkit happy
    playerScoreboard.setDisplaySlot(DisplaySlot.SIDEBAR);
    p.setScoreboard(scoreboard);
    new BukkitRunnable()
    {
        Scroller scroller = new Scroller(p, title, 16, 4, '&');

        public void run()
        {
            playerScoreboard.setDisplayName(scroller.next(p));
        }

    }.runTaskTimer(Main.getInstance(), 0L, 3L); // runs every 3 ticks

}
项目:SurvivalAPI    文件:SurvivalTeam.java   
/**
 * Constructor
 *
 * @param game Team based game instance
 * @param name Team's name
 * @param color Team's color
 * @param chatColor Team's color in chat
 */
public SurvivalTeam(SurvivalTeamGame game, String name, DyeColor color, ChatColor chatColor)
{
    this.game = game;
    this.teamName = name;
    this.chatColor = chatColor;
    this.icon = new ItemStack(Material.WOOL, 1, color.getData());
    this.maxSize = game.getPersonsPerTeam();

    this.invited = new ArrayList<>();
    this.players = new HashMap<>();

    SurvivalAPI.get().registerEvent(SurvivalAPI.EventType.WORLDLOADED, () ->
    {
        Scoreboard board = game.getScoreboard();

        this.team = board.registerNewTeam("meow" + chatColor.getChar());
        this.team.setDisplayName(name);
        this.team.setCanSeeFriendlyInvisibles(true);
        this.team.setPrefix(chatColor + "");
        this.team.setSuffix(ChatColor.RESET + "");
    });

}
项目:Thirst    文件:ThirstManager.java   
private void refreshScoreboard(Player player)
{
    if (getThirstString(player).length() > 40)
    {
        Thirst.getInstance().printPluginError("Error occurred while displaying scoreboard.", "The string "+getThirstString(player)+" is longer than 40 characters." +
                                                                                                     "\nYou must have a thirst message under 40 characters to use the SCOREBOARD displaytype." +
                                                                                                     "\n " +
                                                                                                     "\nNOTE: This message will be displayed every time Thirst tries to update someones thirst (A lot!)");
        return;
    }

    Scoreboard board = manager.getNewScoreboard();
    Objective obj = board.registerNewObjective(player.getName().toUpperCase(), "dummy");

    obj.setDisplaySlot(DisplaySlot.SIDEBAR);
    obj.setDisplayName(ChatColor.translateAlternateColorCodes('&', Thirst.getInstance().getYAMLConfig().scoreboardName.replace("%player%", player.getName())));
    obj.getScore(getThirstString(player)).setScore(-1);

    player.setScoreboard(board);
}
项目:BukkitOldCombatMechanics    文件:OCMMain.java   
private void createTeam() {
    String name = "ocmInternal";
    Scoreboard scoreboard = Bukkit.getScoreboardManager().getMainScoreboard();

    Team team = null;

    for (Team t : scoreboard.getTeams()) {
        if (t.getName().equals(name)) {
            team = t;
            break;
        }
    }

    if (team == null)
        team = scoreboard.registerNewTeam(name);

    team.setOption(Team.Option.COLLISION_RULE, Team.OptionStatus.FOR_OWN_TEAM);
    team.setAllowFriendlyFire(true);
}
项目:AthenaGM    文件:ScoreboardModule.java   
/**
 * Show the player's health under their nameplate
 */
private void createPlayerHealthObjective(Match match) {

    Scoreboard board = boards.get(match);
    Objective objective = board.registerNewObjective("playerhealth", "health");
    objective.setDisplaySlot(DisplaySlot.BELOW_NAME);
    objective.setDisplayName(ChatColor.RED + "❤");

    //Force health objective to update health readout
    for (Team team : match.getTeams().values()) {
        for (Player player : team.getPlayers()) {
            player.setHealth(player.getHealth());
        }
    }

}
项目:AthenaGM    文件:ScoreboardModule.java   
/**
 * Set up the sidebar score box
 */
private void createSidebarTeamScoreObjective(Match match) {

    Scoreboard board = boards.get(match);
    Objective objective = board.registerNewObjective("matchscore", "dummy");
    objective.setDisplaySlot(DisplaySlot.SIDEBAR);
    objective.setDisplayName(String.format("Match %s(00:00)", ChatColor.AQUA));

    // Create score lines for each team
    for (Team team : match.getTeams().values()) {
        if (!team.isSpectator()) {
            Score score = objective.getScore(team.getChatColor() + team.getName());
            score.setScore(0);
        }
    }

}
项目:Pokkit    文件:ScoreboardPersister.java   
/**
 * Saves a scoreboard to a configuration file.
 *
 * @param config
 *            The configuration file.
 * @param scoreboard
 *            The scoreboard.
 */
public void saveScoreboard(Configuration config, Scoreboard scoreboard) {
    // Save teams
    ConfigurationSection teamsSection = config.createSection("teams");
    scoreboard.getTeams().forEach(team -> {
        ConfigurationSection teamSection = teamsSection.createSection(team.getName());
        saveTeam(teamSection, team);
    });

    // Save objectives
    ConfigurationSection objectivesSection = config.createSection("objectives");
    scoreboard.getObjectives().forEach(objective -> {
        ConfigurationSection objectiveSection = objectivesSection.createSection(objective.getName());
        objectiveSection.set("criteria", objective.getCriteria());
        objectiveSection.set("display_name", objective.getDisplayName());
        objectiveSection.set("display_slot", objective.getDisplaySlot().toString().toLowerCase());
    });

    // Save scores
    ConfigurationSection scoresSection = config.createSection("scores");
    scoreboard.getEntries().forEach(playerName -> {
        ConfigurationSection playerSection = scoresSection.createSection(playerName);
        scoreboard.getScores(playerName)
                .forEach(score -> playerSection.set(score.getObjective().getName(), score.getScore()));
    });
}
项目:Skellett    文件:CondObjectiveExists.java   
public boolean check(Event e) {
    Scoreboard board = Bukkit.getScoreboardManager().getMainScoreboard();
    if (scoreboard != null) {
        board = scoreboard.getSingle(e);
    }
    if (board.getObjective(obj.getSingle(e)) != null) {
        if (boo == true) {
            return true;
        } else {
            return false;
        }
    } else {
        if (boo == false) {
            return true;
        } else {
            return false;
        }
    }
}
项目:Skellett    文件:EffScoreboardClearSlot.java   
@Override
protected void execute(Event e) {
    Scoreboard board = Bukkit.getScoreboardManager().getMainScoreboard();
    if (scoreboard != null) {
        board = scoreboard.getSingle(e);
    }
    if (obj.getSingle(e).equals("BELOW_NAME")||obj.getSingle(e).equals("PLAYER_LIST")||obj.getSingle(e).equals("SIDEBAR")) {
        DisplaySlot slot = DisplaySlot.valueOf(obj.getSingle(e).replace("\"", "").trim().replace(" ", "_").toUpperCase());
        try {
            slot = DisplaySlot.valueOf(slot.toString().replace("\"", "").trim().replace(" ", "_").toUpperCase());
        } catch (IllegalArgumentException t) {
            return;
        }
        board.clearSlot(slot);
    } else {
        return;
    }
}
项目:Skellett    文件:ExprGetObjective.java   
@Override
@Nullable
protected Objective[] get(Event e) {
    Scoreboard board = Bukkit.getScoreboardManager().getMainScoreboard();
    if (scoreboard != null) {
        board = scoreboard.getSingle(e);
    }
    if (obj.getSingle(e).equals("BELOW_NAME")||obj.getSingle(e).equals("PLAYER_LIST")||obj.getSingle(e).equals("SIDEBAR")) {
        DisplaySlot slot = DisplaySlot.valueOf(obj.getSingle(e).replace("\"", "").trim().replace(" ", "_").toUpperCase());
        try {
            slot = DisplaySlot.valueOf(slot.toString().replace("\"", "").trim().replace(" ", "_").toUpperCase());
        } catch (IllegalArgumentException t) {
            return null;
        }
        return new Objective[]{board.getObjective(slot)};
    } else {
        return new Objective[]{board.getObjective(obj.getSingle(e))};
    }
}
项目:Uranium    文件:CraftPlayer.java   
public void setScoreboard(Scoreboard scoreboard) {
    Validate.notNull(scoreboard, "Scoreboard cannot be null");
    net.minecraft.network.NetHandlerPlayServer playerConnection = getHandle().playerNetServerHandler;
    if (playerConnection == null) {
        throw new IllegalStateException("Cannot set scoreboard yet");
    }
    if (playerConnection.isDisconnected()) {
        // throw new IllegalStateException("Cannot set scoreboard for invalid CraftPlayer"); // Spigot - remove this as Mojang's semi asynchronous Netty implementation can lead to races
    }

    this.server.getScoreboardManager().setPlayerBoard(this, scoreboard);
}
项目:SpigotBoard    文件:SBScoreboard.java   
@Override
public void disableScoreboard() {
       Scoreboard board = Bukkit.getScoreboardManager().getNewScoreboard();
       board.registerNewObjective("Spigotboard", "dummy");

       for(Player p : Bukkit.getOnlinePlayers()) {
           p.setScoreboard(board);
       }
}
项目:ProjectAres    文件:ScoreboardMatchModule.java   
protected Team createPartyScoreboardTeam(Party party, Scoreboard scoreboard, boolean forObservers) {
    logger.fine("Creating team for party " + party + " on scoreboard " + toString(scoreboard));

    Team team = scoreboard.registerNewTeam(getScoreboardTeamName(party));
    updatePartyScoreboardTeam(party, team, forObservers);
    for(MatchPlayer player : party.getPlayers()) {
        team.addPlayer(player.getBukkit());
    }

    return team;
}
项目:ProjectAres    文件:ScoreboardMatchModule.java   
protected void updatePlayer(MatchPlayer player, Party party, boolean show) {
    if(show) {
        Scoreboard scoreboard = partyScoreboards.get(party);
        logger.fine("Setting player " + player + " to scoreboard " + toString(scoreboard));
        player.getBukkit().setScoreboard(scoreboard);
    } else {
        logger.fine("Setting player " + player + " to hidden scoreboard");
        player.getBukkit().setScoreboard(getHiddenScoreboard());
    }
}
项目:ProjectAres    文件:ScoreboardMatchModule.java   
public void updatePartyScoreboardTeam(Party party) {
    String teamName = getScoreboardTeamName(party);
    updatePartyScoreboardTeam(party, hiddenScoreboard.getTeam(teamName), false);
    for(Map.Entry<Party, Scoreboard> entry : partyScoreboards.entrySet()) {
        updatePartyScoreboardTeam(party, entry.getValue().getTeam(teamName), !(entry.getKey() instanceof Competitor));
    }
}
项目:ProjectAres    文件:Lobby.java   
private void setupScoreboard() {
    Scoreboard scoreboard = Bukkit.getScoreboardManager().getMainScoreboard();
    for(Team team : scoreboard.getTeams()) {
        team.unregister();
    }
    for(Objective objective : scoreboard.getObjectives()) {
        objective.unregister();
    }
}
项目:ProjectAres    文件:RaindropsListener.java   
private static Objective getOrCreateObjective(Scoreboard scoreboard, String name, String criteria) {
    Objective obj = scoreboard.getObjective(name);
    if(obj == null) {
        obj = scoreboard.registerNewObjective(name, criteria);
    }
    return obj;
}
项目:VanillaPlus    文件:ScoreboardUtil.java   
public ScoreboardUtil(Scoreboard scoreboard , String objectiveName){
    if(craftScoreboard==null){
        craftScoreboard = ReflectionUtils.getBukkitClass("scoreboard.CraftScoreboard");
        Scoreboard = ReflectionUtils.getServerClass("Scoreboard");
        ScoreboardObjective = ReflectionUtils.getServerClass("ScoreboardObjective");
        ScoreboardScore = ReflectionUtils.getServerClass("ScoreboardScore");
        scoreboardScore = new ReflectionObject(ScoreboardScore, Scoreboard, ScoreboardObjective ,String.class);
        toAdd = PacketUtils.craftPacket("PacketPlayOutScoreboardScore", scoreboardScore.getClazz());
    }
    if(scoreboard != null && objectiveName != null){
        Object cs = craftScoreboard.cast(scoreboard);
         ScoreboardNMS = ReflectionUtils.invoke("getHandle", cs);
         scoreboardObjective = ReflectionUtils.invoke("getObjective", ScoreboardNMS, objectiveName);
    }

}
项目:ProjectAres    文件:PlayerAppearanceChanger.java   
/**
 * Sets a prefix for a player's overhead name by adding them to a scoreboard team.
 * Don't use this if scoreboard teams are being used for any other purpose.
 */
private static void setOverheadNamePrefix(Player player, String prefix) {
    final Scoreboard scoreboard = player.getServer().getScoreboardManager().getMainScoreboard();
    prefix = prefix.substring(0, Math.min(prefix.length(), 14));

    Team team = scoreboard.getTeam(prefix);
    if(team == null) {
        team = scoreboard.registerNewTeam(prefix);
        team.setPrefix(prefix);
        team.setOption(Team.Option.COLLISION_RULE, Team.OptionStatus.NEVER);
    }
    team.addPlayer(player);
}
项目:KingdomFactions    文件:ScoreBoard.java   
public ScoreBoard(String name,  KingdomFactionsPlayer owner) {
    this.owner = owner;
    Scoreboard board = Bukkit.getScoreboardManager().getNewScoreboard();
    Objective objective = board.registerNewObjective("Scoreboard", "dummy");
    objective.setDisplaySlot(DisplaySlot.SIDEBAR);
    objective.setDisplayName(ChatColor.RED + "" + ChatColor.BOLD + name);
    this.name = name;
    this.board = board;
}
项目:Netherboard    文件:BPlayerBoard.java   
public BPlayerBoard(Player player, Scoreboard scoreboard, String name) {
    this.player = player;
    this.scoreboard = scoreboard;

    if(this.scoreboard == null) {
        Scoreboard sb = player.getScoreboard();

        if(sb == null || sb == Bukkit.getScoreboardManager().getMainScoreboard())
            sb = Bukkit.getScoreboardManager().getNewScoreboard();

        this.scoreboard = sb;
    }

    this.name = name;

    String subName = player.getName().length() <= 14
            ? player.getName()
            : player.getName().substring(0, 14);

    this.objective = this.scoreboard.getObjective("sb" + subName);
    this.buffer = this.scoreboard.getObjective("bf" + subName);

    if(this.objective == null)
        this.objective = this.scoreboard.registerNewObjective("sb" + subName, "dummy");
    if(this.buffer == null)
        this.buffer = this.scoreboard.registerNewObjective("bf" + subName, "dummy");

    this.objective.setDisplayName(name);
    sendObjective(this.objective, ObjectiveMode.CREATE);
    sendObjectiveDisplay(this.objective);

    this.buffer.setDisplayName(name);
    sendObjective(this.buffer, ObjectiveMode.CREATE);

    this.player.setScoreboard(this.scoreboard);
}
项目:Netherboard    文件:Netherboard.java   
/**
 * Creates a board to a player, using a predefined scoreboard.
 *
 * @param player        the player
 * @param scoreboard    the scoreboard to use
 * @param name          the name of the board
 * @return              the newly created board
 */
public BPlayerBoard createBoard(Player player, Scoreboard scoreboard, String name) {
    deleteBoard(player);

    BPlayerBoard board = new BPlayerBoard(player, scoreboard, name);

    boards.put(player, board);
    return board;
}
项目:FactionsXL    文件:FTeamWrapper.java   
private void add(FScoreboard fboard) {
    Scoreboard board = fboard.getScoreboard();
    Team team = board.registerNewTeam(teamName);
    teams.put(fboard, team);

    for (OfflinePlayer player : getPlayers()) {
        team.addEntry(player.getName());
    }

    updatePrefix(fboard);
}
项目:MockBukkit    文件:PlayerMock.java   
@Override
public void setScoreboard(Scoreboard scoreboard) throws IllegalArgumentException, IllegalStateException
{
    // TODO Auto-generated method stub
    throw new UnimplementedOperationException();

}
项目:mczone    文件:Sidebar.java   
public Sidebar(String title, Scoreboard scoreboard) {
    this.title = title;
    this.scoreboard = scoreboard;

    objective = scoreboard.registerNewObjective("test" + RandomUtil.between(1, 500), "dummy");
    objective.setDisplaySlot(DisplaySlot.SIDEBAR);
    objective.setDisplayName(Chat.colors(title));
}
项目:MCLibrary    文件:ScoreboardHolder.java   
public Scoreboard show(Iterable<? extends Player> players) {
    Scoreboard scoreboard = create();
    for (Player player : players) {
        if (player == null)
            continue;
        player.setScoreboard(scoreboard);
    }
    return scoreboard;
}
项目:BasicSurvivalPlus    文件:ScoreboardExample.java   
public void displayYourGameBoardWithoutScoreboardUtil(Player p)
{
    Scoreboard scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
    p.setScoreboard(scoreboard);

    Objective randomObjective = scoreboard.registerNewObjective("example", "dummy");
    randomObjective.setDisplayName("§c§lMy stats");
    randomObjective.setDisplaySlot(DisplaySlot.SIDEBAR);

    randomObjective.getScore(" ").setScore(15);
    randomObjective.getScore("Your kills: " + 30).setScore(14);
    randomObjective.getScore("Your deaths: " + 20).setScore(13);
    randomObjective.getScore("Your ration: " + (30d / 20d)).setScore(12);
    randomObjective.getScore("  ").setScore(11);
}
项目:AthenaGM    文件:ScoreboardModule.java   
/**
 * When a player changes team, make sure the scoreboard reflects it
 */
@EventHandler
public void onPlayerChangedTeam(PlayerChangedTeamEvent event) {
    Scoreboard board = boards.get(event.getTeam().getMatch());
    org.bukkit.scoreboard.Team sbTeam = board.getTeam(event.getTeam().getId());
    sbTeam.addPlayer(event.getPlayer());
}
项目:AthenaGM    文件:ScoreboardModule.java   
/**
 * Remove scoreboards from ended Matches
 */
private void clearUnusedScoreboards() {
    Set<Match> activeMatches = new HashSet<>();
    for (Arena arena : plugin.getArenaHandler().getArenas()) {
        activeMatches.add(arena.getMatch());
    }
    Iterator<Map.Entry<Match, Scoreboard>> iterator = boards.entrySet().iterator();
    while (iterator.hasNext()) {
        Map.Entry<Match, Scoreboard> entry = iterator.next();
        if (!activeMatches.contains(entry.getKey())) {
            iterator.remove();
        }
    }
}
项目:MinigameManager    文件:Minigame.java   
/**
 * Set the scoreboard for all the players.<br>
 * Equivalent to a PlayerConsumer iterating through all players and setting
 * their scoreboards.<br>
 * To do this for a single player, just use
 * {@code}player.setScoreboard(scoreboard);{@code}
 * 
 * @param scoreboard The scoreboard to set for all players
 */
public void setScoreboard(final Scoreboard scoreboard) {
    applyAll(new PlayerConsumer() {

        @Override
        public void apply(Player player) {
            player.setScoreboard(scoreboard);
        }

    });
}
项目:MinigameManager    文件:Minigame.java   
/**
 * Set scoreboards that can change per player
 * 
 * @param scoreboards The function to supply scoreboards
 */
public void setScoreboard(final Function<Player, Scoreboard> scoreboards) {
    applyAll(new PlayerConsumer() {
        @Override
        public void apply(Player player) {
            player.setScoreboard(scoreboards.apply(player));
        }
    });
}
项目:MinigameManager    文件:ScoreboardBuilder.java   
/**
 * Create an instance of the scoreboard builder
 * 
 * @param objective The objective name to use
 * @param displayName The text to appear above all scores on the sidebar
 */
public ScoreboardBuilder(String objective, String displayName) {
    Scoreboard s = Bukkit.getScoreboardManager().getNewScoreboard();
    s.registerNewObjective(objective, "dummy");
    Objective o = s.getObjective(objective);
    o.setDisplaySlot(DisplaySlot.SIDEBAR);
    o.setDisplayName(ChatColor.translateAlternateColorCodes('&', displayName));
    advanced = new ScoreboardHelper(s, o);
}
项目:Aero    文件:Colliding.java   
private void addToTeam(Player p) {
    Scoreboard s = p.getScoreboard() != null ? p.getScoreboard() : Bukkit.getScoreboardManager().getMainScoreboard();
    Team t = s.getTeam("AeroCollide");
    if(t == null) {
        s.registerNewTeam("AeroCollide");
        t = s.getTeam("AeroCollide");
        Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "scoreboard teams options AeroCollide collisionRule never");
    }
    t.addEntry(p.getName());
    p.setScoreboard(s);
}
项目:ThermosRebased    文件:CraftPlayer.java   
public void setScoreboard(Scoreboard scoreboard) {
    Validate.notNull(scoreboard, "Scoreboard cannot be null");
    net.minecraft.network.NetHandlerPlayServer playerConnection = getHandle().playerNetServerHandler;
    if (playerConnection == null) {
        throw new IllegalStateException("Cannot set scoreboard yet");
    }
    if (playerConnection.isDisconnected()) {
        // throw new IllegalStateException("Cannot set scoreboard for invalid CraftPlayer"); // Spigot - remove this as Mojang's semi asynchronous Netty implementation can lead to races
    }

    this.server.getScoreboardManager().setPlayerBoard(this, scoreboard);
}
项目:Skellett    文件:EffCreateNametag.java   
@Override
protected void execute(Event e) {
    Scoreboard board = null;
    if (player != null && player.getSingle(e).getScoreboard() != null) {
        board = player.getSingle(e).getScoreboard();
    }
    NametagManager.createNametag(nametag.getSingle(e), board);
}