This example demonstrates how to build a dynamic sidebar that continuously displays a player’s current coordinates in real time. Using theDocumentation Index
Fetch the complete documentation index at: https://velas.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Velaboard API, a personal scoreboard is created for each player when they join the server, and its content is updated at regular intervals to reflect changes in their position. As the player moves through the world, their X, Y, and Z values are refreshed on the Sidebar, providing a live and responsive coordinates display. This showcases how the API can be used to handle per-player scoreboards, respond to events like player joins, and efficiently update information without recreating the entire scoreboard.
🔗 Useful Links
- 📖 Documentation: Link
- 📚 API Reference: Link
- 🧩Download Coordinates Sidebar Plugin(this): Link
- 🧩 Download Velaboard Plugin: Coming-Soon
Overview
- Create individual player sidebars
- Update sidebar content in real-time
- Display player coordinates (X, Y, Z)
- Handle player join events
- Update coordinates of players on sidebar
Result
Players see a scoreboard showing their current coordinates:.png?fit=max&auto=format&n=uAALIUzH04TUwoB4&q=85&s=53683d277cc06cb0c605f1fab351678a)
Step-by-Step Guide: Creating a Coordinates Sidebar
Step-1: Create the Main Plugin Class
Step-2: Create the Listener
Step-3: Add this in your plugin.yml
Check Installation for more information.
🔑 Key Components
1. Scoreboard Creation:
When the plugin is enabled, theonEnable() lifecycle method is invoked. During this phase, the plugin attempts to verify whether the ScoreboardAPI has been properly initialized.
This check is performed inside a try-catch block to safely handle any unexpected errors like ClassNotFoundException that may occur during the verification process.
- If the API is confirmed to be initialized (
API_INITIALIZED == true), the plugin proceeds to register its event listeners using Bukkit’s plugin manager. - The
Listenerclass is registered to handle events during runtime.
2. Scoreboard Creation:
At the time of event listener registration, theListener instance is created, and during its construction, the Scoreboard is conditionally instantiated and stored for later use.\
When the plugin is enabled, the following line is executed inside onEnable() method:
Scoreboard is created and stored in the instance field scoreboard for Later Use in Events.
3. Sidebar Setup:
A playerSidebar is created with a title, if the players is not associated with any sidebar in the scoreboard.
4. Real-Time Updates:
Updates content of thesidebar whenever the player moves.
5. Line Management:
For creating/updatinglines in the Sidebar , use sidebar.setLine("text") .
Exception .
🤔 FAQs
1. Do I need to manually add players to the scoreboard when they join the server?
No, it is not always necessary to manually add players to the scoreboard on every join event. In this system, players only need to be added to a scoreboard when required (for example, when creating or assigning a new scoreboard). There is no need to repeatedly add the player each time they join. Unlike traditional Bukkit scoreboards, this implementation handles player–scoreboard association internally. If a player was previously associated with a scoreboard, it will be automatically restored or maintained, eliminating the need for redundant additions during the join event.2. Do I need to manually add or show the sidebar to a player when they join the server?
No, you do not need to manually add or show the sidebar when a player joins the server. Similar to scoreboards, sidebars are automatically restored. If a player is already associated with a sidebar in the scoreboard they belong to, it will be automatically displayed when they join. 🔹 Controlling Auto-Display on Join If you want to prevent the sidebar from showing automatically on player join, you can listen to theSidebarShowEvent and cancel it when the reason is PLAYER_JOIN.
Example:
📋 Requirements
1. Dependencies
The latest dependency configuration is maintained here. Please refer to it for up-to-date details.2. Server Requirements
- ✅ Minecraft 1.20-1.21.11
- ✅ Spigot/Paper server
- ✅ Velaboard plugin installed
🚀 Usage
Install the Plugin
- Compile your plugin:
mvn clean package - Place JAR in server’s
plugins/folder - Restart server
- Players see coordinates on join! ✅
How the Scoreboard Object Works in VelaBoard
All you need you know
Sidebar and its Types
PlayerSidebar vs SharedSidebar