Java Code Examples for org.bukkit.Bukkit#getScoreboardManager()

The following examples show how to use org.bukkit.Bukkit#getScoreboardManager() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Game.java    From Survival-Games with GNU General Public License v3.0 5 votes vote down vote up
public void Scoreboard(Player player) {
       ScoreboardManager manager = Bukkit.getScoreboardManager();
       Scoreboard board = manager.getNewScoreboard();
       
       Objective objective = board.registerNewObjective("test", "dummy");
       objective.setDisplaySlot(DisplaySlot.SIDEBAR);
       objective.setDisplayName("Scoreboard");
       objective.getName();
       
       Score score = objective.getScore(ChatColor.GREEN + "Kills:"); //Get a fake offline player
       score.setScore(1);
}
 
Example 2
Source File: CustomScoreBoard.java    From CombatLogX with GNU General Public License v3.0 5 votes vote down vote up
public CustomScoreBoard(Notifier expansion, Player player) {
    this.expansion = Objects.requireNonNull(expansion, "expansion must not be null!");
    this.playerId = Objects.requireNonNull(player, "player must not be null!").getUniqueId();

    ScoreboardManager scoreboardManager = Bukkit.getScoreboardManager();
    this.scoreboard = Objects.requireNonNull(scoreboardManager, "Bukkit's Scoreboard Manager is not available yet!").getNewScoreboard();

    createObjective();
    initializeScoreboard();
}
 
Example 3
Source File: CustomScoreBoard.java    From CombatLogX with GNU General Public License v3.0 5 votes vote down vote up
public void disableScoreboard() {
    Player player = getPlayer();
    if(player == null) return;

    ScoreboardManager scoreboardManager = Bukkit.getScoreboardManager();
    if(scoreboardManager == null) throw new IllegalStateException("The scoreboard manager is null!");
    
    Scoreboard mainScoreboard = scoreboardManager.getMainScoreboard();
    player.setScoreboard(mainScoreboard);
}
 
Example 4
Source File: Core.java    From skRayFall with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Generates a new private scoreboard for the player when they join the server if
 * enableFastScoreboards is set to true.
 *
 * @param evt The Player Join Event
 */
@EventHandler
public void onJoinScoreboards(PlayerJoinEvent evt) {
    if (enableFastScoreboards) {
        Player player = evt.getPlayer();
        ScoreboardManager manager = Bukkit.getScoreboardManager();
        Scoreboard board = manager.getNewScoreboard();
        player.setScoreboard(board);
    }
}
 
Example 5
Source File: BedwarsRel.java    From BedwarsRel with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onEnable() {
  BedwarsRel.instance = this;

  if (this.getDescription().getVersion().contains("-SNAPSHOT")
      && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) {
    this.getServer().getConsoleSender().sendMessage(ChatWriter.pluginMessage(ChatColor.RED + "*** Warning, you are using a development build ***"));
    this.getServer().getConsoleSender().sendMessage(ChatWriter.pluginMessage(ChatColor.RED + "*** You will get NO support regarding this build ***"));
    this.getServer().getConsoleSender().sendMessage(ChatWriter.pluginMessage(ChatColor.RED + "*** Please download a stable build from https://github.com/BedwarsRel/BedwarsRel/releases ***"));
    this.getServer().getConsoleSender().sendMessage(ChatWriter.pluginMessage(ChatColor.RED + "*** Server will start in 10 seconds ***"));
    try {
      Thread.sleep(TimeUnit.SECONDS.toMillis(10));
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
  }

  this.registerBugsnag();

  // register classes
  this.registerConfigurationClasses();

  // save default config
  this.saveDefaultConfig();
  this.loadConfigInUTF();

  this.getConfig().options().copyDefaults(true);
  this.getConfig().options().copyHeader(true);

  this.craftbukkit = this.getCraftBukkit();
  this.minecraft = this.getMinecraftPackage();
  this.version = this.loadVersion();

  ConfigUpdater configUpdater = new ConfigUpdater();
  configUpdater.addConfigs();
  this.saveConfiguration();
  this.loadConfigInUTF();

  if (this.getBooleanConfig("send-error-data", true) && this.bugsnag != null) {
    this.enableBugsnag();
  } else {
    this.disableBugsnag();
  }

  this.loadShop();

  this.isSpigot = this.getIsSpigot();
  this.loadDatabase();

  this.registerCommands();
  this.registerListener();

  this.gameManager = new GameManager();

  // bungeecord
  if (BedwarsRel.getInstance().isBungee()) {
    this.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
  }

  this.loadStatistics();
  this.loadLocalization(this.getConfig().getString("locale"));

  this.checkUpdates();

  // Loading
  this.scoreboardManager = Bukkit.getScoreboardManager();
  this.gameManager.loadGames();
  this.startTimeListener();
  this.startMetricsIfEnabled();

  // holograms
  if (this.isHologramsEnabled()) {
    if (this.getServer().getPluginManager().isPluginEnabled("HologramAPI")) {
      this.holographicInteraction = new HologramAPIInteraction();
    } else if (this.getServer().getPluginManager().isPluginEnabled("HolographicDisplays")) {
      this.holographicInteraction = new HolographicDisplaysInteraction();
    }
    this.holographicInteraction.loadHolograms();
  }
}
 
Example 6
Source File: TeamManager.java    From skRayFall with GNU General Public License v3.0 4 votes vote down vote up
public TeamManager() {
    ScoreboardManager manager = Bukkit.getScoreboardManager();
    teamBoard = manager.getNewScoreboard();
}
 
Example 7
Source File: Scoreboards.java    From askyblock with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 
 */
private Scoreboards() {
    ScoreboardManager manager = Bukkit.getScoreboardManager();
    board = manager.getNewScoreboard();
}
 
Example 8
Source File: FlagScoreboard.java    From HeavySpleef with GNU General Public License v3.0 4 votes vote down vote up
public FlagScoreboard() {
	this.manager = Bukkit.getScoreboardManager();
	this.playersTracked = Lists.newArrayList();
}