org.bukkit.Server.getScoreboardManager()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(164)

本文整理了Java中org.bukkit.Server.getScoreboardManager()方法的一些代码示例,展示了Server.getScoreboardManager()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Server.getScoreboardManager()方法的具体详情如下:
包路径:org.bukkit.Server
类名称:Server
方法名:getScoreboardManager

Server.getScoreboardManager介绍

[英]Gets the instance of the scoreboard manager.

This will only exist after the first world has loaded.
[中]获取记分板管理器的实例。
这只有在第一世界加载后才会存在。

代码示例

代码示例来源:origin: Bukkit/Bukkit

/**
 * @see Server#getScoreboardManager()
 */
public static ScoreboardManager getScoreboardManager() {
  return server.getScoreboardManager();
}

代码示例来源:origin: SpigotMC/Spigot-API

/**
 * @see Server#getScoreboardManager()
 */
public static ScoreboardManager getScoreboardManager() {
  return server.getScoreboardManager();
}

代码示例来源:origin: EngineHub/CommandHelper

@Override
public MCScoreboard getMainScoreboard() {
  return new BukkitMCScoreboard(s.getScoreboardManager().getMainScoreboard());
}

代码示例来源:origin: EngineHub/CommandHelper

@Override
public MCScoreboard getNewScoreboard() {
  return new BukkitMCScoreboard(s.getScoreboardManager().getNewScoreboard());
}

代码示例来源:origin: Dytanic/CloudNet

private void initScoreboard(Player all)
{
  if (all.getScoreboard() == null) all.setScoreboard(all.getServer().getScoreboardManager().getNewScoreboard());
}

代码示例来源:origin: eccentricdevotion/TARDIS

public TARDISArtronIndicator(TARDIS plugin) {
  this.plugin = plugin;
  manager = plugin.getServer().getScoreboardManager();
  fc = plugin.getArtronConfig().getInt("full_charge");
  filter = Material.valueOf(plugin.getRecipesConfig().getString("shaped.Perception Filter.result"));
}

代码示例来源:origin: eccentricdevotion/TARDIS

public void createPerceptionFilter() {
  Scoreboard board = plugin.getServer().getScoreboardManager().getMainScoreboard();
  perceptionFilter = board.getTeam("PerceptionFilter");
  if (perceptionFilter == null) {
    perceptionFilter = board.registerNewTeam("PerceptionFilter");
    perceptionFilter.setCanSeeFriendlyInvisibles(true);
    plugin.getServer().getOnlinePlayers().forEach((olp) -> perceptionFilter.addEntry(olp.getName()));
  }
}

代码示例来源:origin: AddstarMC/Minigames

/**
 * Removes a player from the team.
 * @param player - The player to remove.
 */
public void removePlayer(MinigamePlayer player){
  players.remove(player);
  Scoreboard board =  mgm.getScoreboardManager();
  String color =  getColor().toString().toLowerCase();
  board.getTeam(color).removeEntry(player.getDisplayName(mgm.usePlayerDisplayNames()));
  player.getPlayer().setScoreboard(Minigames.getPlugin().getServer().getScoreboardManager().getMainScoreboard());
}

代码示例来源:origin: mcMMO-Dev/mcMMO

/**
 * Gets or creates the power level objective on the main targetBoard.
 * <p/>
 * If power levels are disabled, the objective is deleted and null is
 * returned.
 *
 * @return the main targetBoard objective, or null if disabled
 */
public static Objective getPowerLevelObjective() {
  if (!Config.getInstance().getPowerLevelTagsEnabled()) {
    Objective objective = mcMMO.p.getServer().getScoreboardManager().getMainScoreboard().getObjective(POWER_OBJECTIVE);
    if (objective != null) {
      objective.unregister();
      mcMMO.p.debug("Removed leftover targetBoard objects from Power Level Tags.");
    }
    return null;
  }
  Objective powerObjective = mcMMO.p.getServer().getScoreboardManager().getMainScoreboard().getObjective(POWER_OBJECTIVE);
  if (powerObjective == null) {
    powerObjective = mcMMO.p.getServer().getScoreboardManager().getMainScoreboard().registerNewObjective(POWER_OBJECTIVE, "dummy");
    powerObjective.setDisplayName(TAG_POWER_LEVEL);
    powerObjective.setDisplaySlot(DisplaySlot.BELOW_NAME);
  }
  return powerObjective;
}

代码示例来源:origin: mcMMO-Dev/mcMMO

/**
 * Set the old targetBoard, for use in reverting.
 */
public void setOldScoreboard() {
  Player player = mcMMO.p.getServer().getPlayerExact(playerName);
  if (player == null) {
    ScoreboardManager.cleanup(this);
    return;
  }
  Scoreboard oldBoard = player.getScoreboard();
  if (oldBoard == scoreboard) { // Already displaying it
    if (this.oldBoard == null) {
      // (Shouldn't happen) Use failsafe value - we're already displaying our board, but we don't have the one we should revert to
      this.oldBoard = mcMMO.p.getServer().getScoreboardManager().getMainScoreboard();
    }
  }
  else {
    this.oldBoard = oldBoard;
  }
}

代码示例来源:origin: mcMMO-Dev/mcMMO

public static ScoreboardWrapper create(Player player) {
  //Call our custom event
  McMMOScoreboardMakeboardEvent event = new McMMOScoreboardMakeboardEvent(mcMMO.p.getServer().getScoreboardManager().getNewScoreboard(), player.getScoreboard(), player, ScoreboardEventReason.CREATING_NEW_SCOREBOARD);
  player.getServer().getPluginManager().callEvent(event);
  //Use the values from the event
  return new ScoreboardWrapper(event.getTargetPlayer(), event.getTargetBoard());
}

代码示例来源:origin: eccentricdevotion/TARDIS

public static void removePerceptionFilter() {
  Scoreboard board = Bukkit.getServer().getScoreboardManager().getMainScoreboard();
  Team perceptionFilter = board.getTeam("PerceptionFilter");
  if (perceptionFilter != null) {
    for (OfflinePlayer olp : Bukkit.getServer().getOfflinePlayers()) {
      if (olp != null) {
        String entry = olp.getName();
        if (perceptionFilter.hasEntry(entry)) {
          perceptionFilter.removeEntry(entry);
        }
      }
    }
    perceptionFilter.unregister();
  }
}

代码示例来源:origin: AddstarMC/Minigames

player.setScoreboard(player.getServer().getScoreboardManager().getMainScoreboard());

相关文章

Server类方法