Class PrivateGamesAPI
-
Method Summary
Modifier and TypeMethodDescriptionstatic PrivateGamesAPIget()Get the global instance of PrivateGamesAPI.@Nullable ArenaBuffStategetBuffState(Arena arena) Get the buff state for a specific arena.@Nullable PartiesHook.PartygetManagingParty(Arena arena) Get the party managing the private arena.booleanhasCreatePermission(Permissible player) Check if a player has permission to create private games.booleanhasPrivateModeEnabled(PlayerProperties playerProps) Check if a player has private mode enabled.voidhasPrivateModeEnabled(Player player, Consumer<Boolean> callback) Check if a player has private mode enabled.booleanisPrivateArena(Arena arena) Get whether the arena is set to private.booleanisPrivateArena(RemoteArena arena) Get whether the arena is set to private.voidsetPrivateArena(Arena arena, PartiesHook.Party party) Set an arena to private for a specific party.voidsetPrivateModeEnabled(PlayerProperties playerProps, boolean newState) Enable or disable private mode for a player.voidsetPrivateModeEnabled(Player player, boolean newState, @Nullable Runnable callback) Enable or disable private mode for a player.voidunsetPrivateArena(Arena arena) Unset the private status of an arena.
-
Method Details
-
isPrivateArena
Get whether the arena is set to private.A private arena only allows players from a specific party to join.
- Parameters:
arena- The arena to check- Returns:
trueif the arena is private,falseotherwise- See Also:
-
isPrivateArena
Get whether the arena is set to private.A private arena only allows players from a specific party to join.
Due to the nature of RemoteArenas, it may be slightly desynced compared to the local Arena instance (
isPrivateArena(Arena)).- Parameters:
arena- The arena to check- Returns:
trueif the arena is private,falseotherwise- See Also:
-
getManagingParty
Get the party managing the private arena.- Parameters:
arena- The arena to check- Returns:
- The managing party, or
nullif the arena is not private - See Also:
-
unsetPrivateArena
Unset the private status of an arena.With that, anyone can join the arena again and buff effects will be removed.
- Parameters:
arena- The arena to unset- See Also:
-
setPrivateArena
Set an arena to private for a specific party.Does not automatically kick players not part of the party.
- Parameters:
arena- The arena to setparty- The party allowed to join- See Also:
-
getBuffState
Get the buff state for a specific arena.- Parameters:
arena- The arena to get the buff state for- Returns:
- The arena buff state, or
nullif the arena is not private
-
hasPrivateModeEnabled
Check if a player has private mode enabled.May not be absolutely accurate in certain situations if player is not online, but should be fine for most use-cases.
- Parameters:
playerProps- The player properties to check- Returns:
trueif private mode is enabled,falseotherwise
-
hasPrivateModeEnabled
Check if a player has private mode enabled.Callback is executed on the server's main thread.
- Parameters:
player- The player to checkcallback- The callback to execute with the result
-
setPrivateModeEnabled
Enable or disable private mode for a player.hasPrivateModeEnabled(PlayerProperties)might returnfalseregardless it is enabled if the player does not have the permission (seehasCreatePermission(Permissible)).- Parameters:
playerProps- The player properties to setnewState-trueto enable,falseto disable
-
setPrivateModeEnabled
public void setPrivateModeEnabled(Player player, boolean newState, @Nullable @Nullable Runnable callback) Enable or disable private mode for a player.hasPrivateModeEnabled(Player, Consumer)might returnfalseregardless it is enabled if the player does not have the permission (seehasCreatePermission(Permissible)).Callback is executed on the server's main thread.
- Parameters:
player- The player to setnewState-trueto enable,falseto disablecallback- The callback to execute after setting (can benullif not needed)
-
hasCreatePermission
Check if a player has permission to create private games.- Parameters:
player- The player to check- Returns:
trueif the player has permission,falseotherwise
-
get
Get the global instance of PrivateGamesAPI.- Returns:
- The PrivateGamesAPI instance
-