Class CommandUtil
java.lang.Object
org.geysermc.floodgate.core.platform.command.CommandUtil
An interface used across all Floodgate platforms to simple stuff in commands like kicking players
and sending player messages independent of the Floodgate platform implementation.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.geysermc.api.GeyserApiBaseprotected final LanguageManager -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCommandUtil(LanguageManager manager, org.geysermc.api.GeyserApiBase api) -
Method Summary
Modifier and TypeMethodDescriptionprotected ObjectapplyPlayerTypeFilter(Object player, PlayerType filter, Object fallback) protected abstract Collection<?>getOnlinePlayersWithPermission(String permission) Get all online players with the given permission.@NonNull Collection<String>getOnlineUsernames(@NonNull PlayerType limitTo) abstract ObjectgetPlayerByUsername(@NonNull String username) getPlayerByUsername(@NonNull String username, PlayerType limitTo) abstract ObjectgetPlayerByUuid(@NonNull UUID uuid) getPlayerByUuid(@NonNull UUID uuid, PlayerType limitTo) @Nullable ProfileAudiencegetProfileAudience(@NonNull Object source, boolean allowOffline) Get a ProfileAudience from a source.abstract @NonNull UserAudiencegetUserAudience(@NonNull Object source) protected abstract StringgetUsernameFromSource(@NonNull Object source) protected abstract UUIDgetUuidFromSource(@NonNull Object source) abstract booleanhasPermission(Object player, String permission) Checks if the given player has the given permission.abstract voidkickPlayer(Object player, String message) Kicks the given player using the given message as the kick reason.booleanremovePlayerFromWhitelist(long xuid, String username) Removes the given Bedrock player from the whitelist.booleanremovePlayerFromWhitelist(UUID uuid, String username) Removes the given Bedrock player from the whitelist.abstract voidsendMessage(Object target, String message) Sends a raw message to the specified target, no matter what platform Floodgate is running on.translateMessage(String locale, TranslatableMessage message, Object... args) booleanwhitelistPlayer(long xuid, String username) Whitelist the given Bedrock player.booleanwhitelistPlayer(UUID uuid, String username) Whitelist the given Bedrock player.
-
Field Details
-
manager
-
api
protected final org.geysermc.api.GeyserApiBase api
-
-
Constructor Details
-
CommandUtil
-
-
Method Details
-
getUserAudience
-
getProfileAudience
Get a ProfileAudience from a source. The source should be a platform-specific player instance when the player is online, and the username / uuid of the requested player when offline.- Parameters:
source- source to create a ProfileAudience fromallowOffline- if offline players are allowed- Returns:
- a ProfileAudience unless allowOffline is false and the player isn't online
-
getUsernameFromSource
-
getUuidFromSource
-
getOnlinePlayers
-
getOnlineUsernames
-
getPlayerByUuid
- Parameters:
uuid-- Returns:
-
getPlayerByUuid
-
getPlayerByUsername
-
getPlayerByUsername
-
applyPlayerTypeFilter
-
hasPermission
Checks if the given player has the given permission.- Parameters:
player- the player to checkpermission- the permission to check- Returns:
- true or false depending on if the player has the permission
-
getOnlinePlayersWithPermission
Get all online players with the given permission.- Parameters:
permission- the permission to check- Returns:
- a list of online players that have the given permission
-
sendMessage
Sends a raw message to the specified target, no matter what platform Floodgate is running on.- Parameters:
target- the player that should receive the messagemessage- the message
-
kickPlayer
Kicks the given player using the given message as the kick reason.- Parameters:
player- the player that should be kickedmessage- the command message
-
translateMessage
-
whitelistPlayer
Whitelist the given Bedrock player.- Parameters:
xuid- the xuid of the username to be whitelistedusername- the username to be whitelisted- Returns:
- true if the player has been whitelisted, false if the player was already whitelisted. Defaults to false when this platform doesn't support whitelisting.
-
whitelistPlayer
Whitelist the given Bedrock player.- Parameters:
uuid- the UUID of the username to be whitelistedusername- the username to be whitelisted- Returns:
- true if the player has been whitelisted, false if the player was already whitelisted. Defaults to false when this platform doesn't support whitelisting.
-
removePlayerFromWhitelist
Removes the given Bedrock player from the whitelist.- Parameters:
xuid- the xuid of the username to be removed from the whitelistusername- the username to be removed from the whitelist- Returns:
- true if the player has been removed from the whitelist, false if the player wasn't whitelisted. Defaults to false when this platform doesn't support whitelisting.
-
removePlayerFromWhitelist
Removes the given Bedrock player from the whitelist.- Parameters:
uuid- the UUID of the username to be removed from the whitelistusername- the username to be removed from the whitelist- Returns:
- true if the player has been removed from the whitelist, false if the player wasn't whitelisted. Defaults to false when this platform doesn't support whitelisting.
-