Event and implement Cancellable; register your listener the standard Bukkit way.
SidebarShowEvent
SidebarShowEvent fires when a sidebar is about to be shown to a player. Cancelling it prevents the sidebar from appearing.
| Method | Description |
|---|---|
getPlayer() | The player about to see the sidebar. |
getSidebar() | The Sidebar being shown. |
getReason() | Why the sidebar is being shown: PLAYER_JOIN, MANUALLY, or OTHER. |
setCancelled(true) | Prevents the sidebar from being displayed. |
getSidebar().isPlayerSidebar() or getSidebar().isSharedSidebar() to determine which type is being shown before acting on it.
AddMemberToTeamEvent
AddMemberToTeamEvent fires when a player or entity is about to be added to a team. Cancelling it prevents the member from being added.
| Method | Description |
|---|---|
getUniqueIdOfMember() | UUID of the player or entity being added. |
getTeam() | The Team they are being added to. |
getReason() | Why the member is being added: PLAYER_JOIN, PLAYER_ADD, ENTITY_ADD, or OTHER. |
setCancelled(true) | Prevents the member from joining the team. |