Skip to main content

Documentation 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 fires two cancellable Bukkit events — SidebarShowEvent and AddMemberToTeamEvent — giving your plugin fine-grained control over scoreboard behavior.
Both events extend org.bukkit.event.Event and implement Cancellable. Register listeners the standard Bukkit way.

SidebarShowEvent

Package: org.velas.scoreboard.api.event Fired when a sidebar is about to be displayed to a player. Cancellable.
MethodReturnsDescription
getPlayer()PlayerThe player the sidebar is being shown to
getSidebar()SidebarThe sidebar being displayed
getReason()SidebarShowEvent.ReasonWhy the sidebar is being shown
isCancelled()booleanWhether the event is cancelled
setCancelled(boolean)voidCancel to prevent the sidebar from showing

SidebarShowEvent.Reason enum

ValueDescription
PLAYER_JOINSidebar shown automatically on player join
MANUALLYSidebar shown via explicit show() call
OTHEROther reason
@EventHandler
public void onSidebarShow(SidebarShowEvent event) {
    // Block sidebar display for players without permission
    if (!event.getPlayer().hasPermission("myplugin.sidebar.view")) {
        event.setCancelled(true);
        return;
    }
    // Log when sidebars are manually shown
    if (event.getReason() == SidebarShowEvent.Reason.MANUALLY) {
        getLogger().info("Sidebar manually shown to " + event.getPlayer().getName());
    }
}
Use event.getSidebar().isPlayerSidebar() or isSharedSidebar() to distinguish sidebar types inside SidebarShowEvent.

AddMemberToTeamEvent

Package: org.velas.scoreboard.api.event Fired when a player or entity is about to be added to a team. Cancellable.
MethodReturnsDescription
getUniqueIdOfMember()UUIDUUID of the player or entity being added
getTeam()TeamThe team being joined
getReason()AddMemberToTeamEvent.ReasonWhy the member is being added
isCancelled()booleanWhether the event is cancelled
setCancelled(boolean)voidCancel to prevent the member from being added

AddMemberToTeamEvent.Reason enum

ValueDescription
PLAYER_JOINPlayer added to team on server join
PLAYER_ADDPlayer added via team.addPlayer(Player)
ENTITY_ADDEntity added via team.addEntity(Entity)
OTHEROther reason
@EventHandler
public void onTeamAdd(AddMemberToTeamEvent event) {
    // Prevent programmatic additions to the "vip" team
    if ("vip".equals(event.getTeam().getName())
            && event.getReason() == AddMemberToTeamEvent.Reason.PLAYER_ADD) {
        // Only allow join-based additions
        event.setCancelled(true);
    }
}
Cancelling an event only prevents the current action — it does not remove the sidebar or team from existence.

Registering your listener

public class MyPlugin extends JavaPlugin implements Listener {
    @Override
    public void onEnable() {
        getServer().getPluginManager().registerEvents(this, this);
    }

    @EventHandler
    public void onSidebarShow(SidebarShowEvent event) {
        // handle event
    }

    @EventHandler
    public void onTeamAdd(AddMemberToTeamEvent event) {
        // handle event
    }
}