Class CommandUtils
java.lang.Object
fr.hytale.loader.command.CommandUtils
Utility class for working with commands in HytaleLoader.
Provides helper methods to convert native Hytale command data to HytaleLoader API objects.
- Since:
- 1.0.3
- Version:
- 1.0.4
- Author:
- HytaleLoader
-
Method Summary
Modifier and TypeMethodDescriptionstatic PlayergetPlayer(com.hypixel.hytale.server.core.command.system.CommandContext context) Gets the command sender as a HytaleLoader Player.static booleanisPlayer(com.hypixel.hytale.server.core.command.system.CommandContext context) Checks if the command sender is a player.static PlayerrequirePlayer(com.hypixel.hytale.server.core.command.system.CommandContext context) Gets the command sender as a Player, or throws an exception.
-
Method Details
-
isPlayer
public static boolean isPlayer(@Nonnull com.hypixel.hytale.server.core.command.system.CommandContext context) Checks if the command sender is a player.- Parameters:
context- the command context- Returns:
- true if the sender is a player
-
getPlayer
@Nullable public static Player getPlayer(@Nonnull com.hypixel.hytale.server.core.command.system.CommandContext context) Gets the command sender as a HytaleLoader Player.Returns null if the sender is not a player (e.g., console).
- Parameters:
context- the command context- Returns:
- the Player wrapper, or null if sender is not a player
-
requirePlayer
@Nonnull public static Player requirePlayer(@Nonnull com.hypixel.hytale.server.core.command.system.CommandContext context) Gets the command sender as a Player, or throws an exception.- Parameters:
context- the command context- Returns:
- the Player wrapper
- Throws:
IllegalStateException- if the sender is not a player
-