Package emu.grasscutter.plugin.api
Class PlayerHook
java.lang.Object
emu.grasscutter.plugin.api.PlayerHook
Hooks into the
Player class, adding convenient ways to do certain things.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbroadcastPacketToWorld(BasePacket packet) Broadcasts the packet sent to all world players.voidchangeScenes(int sceneId) Sends a player to another scene.Gets the currently selected avatar.Gets the currently selected avatar in entity form.floatGets the currently selected avatar's max health.voidkick()Kicks a player from the server.voidreviveAvatar(Avatar avatar) Revives the specified avatar.voidsetHealth(float health) Set the currently equipped avatar's health.voidTeleports a player to a position.voidupdateFightProperty(FightProperty property) Broadcasts an avatar property notify to all world players.
-
Constructor Details
-
PlayerHook
Hooks into the player.- Parameters:
player- The player to hook into.
-
-
Method Details
-
kick
public void kick()Kicks a player from the server. TODO: Refactor to kick using a packet. -
changeScenes
public void changeScenes(int sceneId) Sends a player to another scene.- Parameters:
sceneId- The scene to send the player to.
-
updateFightProperty
Broadcasts an avatar property notify to all world players.- Parameters:
property- The property that was updated.
-
broadcastPacketToWorld
Broadcasts the packet sent to all world players.- Parameters:
packet- The packet to send.
-
setHealth
public void setHealth(float health) Set the currently equipped avatar's health.- Parameters:
health- The health to set the avatar to.
-
reviveAvatar
Revives the specified avatar.- Parameters:
avatar- The avatar to revive.
-
teleport
Teleports a player to a position. This will **not** transfer the player to another scene.- Parameters:
position- The position to teleport the player to.
-
getMaxHealth
public float getMaxHealth()Gets the currently selected avatar's max health.- Returns:
- The max health as a float.
-
getCurrentAvatarEntity
Gets the currently selected avatar in entity form.- Returns:
- The avatar as an
EntityAvatar.
-
getCurrentAvatar
Gets the currently selected avatar.- Returns:
- The avatar as an
Avatar.
-