Skip to content

ScoreBoard Guides

Wenox edited this page Oct 24, 2025 · 1 revision

ScoreBoardManager

Overview

The ScoreBoardManager class manages player scoreboards in the SkyblockCore plugin. It provides static methods to create, update, and remove scoreboards for individual players using PocketMine-MP protocol packets.

Key Features

  • Create custom scoreboards with titles and display slots.
  • Set individual scoreboard entries with scores and messages.
  • Remove scoreboards from players.
  • Store and retrieve a global scoreboard string.
  • All operations are static and work with Biswajit\Core\Player instances.

Usage from Other Plugins

To use ScoreBoardManager from another plugin:

  1. Add dependency in your plugin.yml:

    depend: [SkyblockCore]
    
  2. Import the class:

    use Biswajit\Core\Managers\ScoreBoardManager;
    use Biswajit\Core\Player;
  3. Call static methods directly.

Important Notes

  • Player instances must be of type Biswajit\Core\Player.
  • Uses PocketMine-MP network packets for scoreboard management.
  • Scoreboards are displayed in the sidebar by default, but can be customized.
  • Each scoreboard entry requires a unique objective name.

Method Signatures

  • setScoreboard(string $scoreboard): void - Sets the global scoreboard string.
  • getScoreboard(): string - Returns the global scoreboard string.
  • setScoreboardEntry(Player $player, int $score, string $msg, string $objName): void - Sets a scoreboard entry for a player.
  • createScoreboard(Player $player, string $title, string $objName, string $slot = "sidebar", int $order = 0): void - Creates a new scoreboard for a player.
  • removeScoreboard(Player $player, string $objName): void - Removes a scoreboard from a player.

Method Examples

// Set global scoreboard
ScoreBoardManager::setScoreboard("My Custom Scoreboard");

// Get global scoreboard
$board = ScoreBoardManager::getScoreboard();

// Create a scoreboard for a player
ScoreBoardManager::createScoreboard($player, "Player Stats", "stats");

// Add entries to the scoreboard
ScoreBoardManager::setScoreboardEntry($player, 1, "Money: $100", "stats");
ScoreBoardManager::setScoreboardEntry($player, 2, "Level: 5", "stats");

// Remove the scoreboard
ScoreBoardManager::removeScoreboard($player, "stats");

Version Information

  • Package: Biswajit\Core\Managers
  • Author: Biswajit
  • Version: 1.0.0

Clone this wiki locally