Class PlayerHook

java.lang.Object
emu.grasscutter.plugin.api.PlayerHook

public final class PlayerHook extends Object
Hooks into the Player class, adding convenient ways to do certain things.
  • Constructor Details

    • PlayerHook

      public PlayerHook(Player player)
      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

      public void updateFightProperty(FightProperty property)
      Broadcasts an avatar property notify to all world players.
      Parameters:
      property - The property that was updated.
    • broadcastPacketToWorld

      public void broadcastPacketToWorld(BasePacket packet)
      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

      public void reviveAvatar(Avatar avatar)
      Revives the specified avatar.
      Parameters:
      avatar - The avatar to revive.
    • teleport

      public void teleport(Position position)
      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

      public EntityAvatar getCurrentAvatarEntity()
      Gets the currently selected avatar in entity form.
      Returns:
      The avatar as an EntityAvatar.
    • getCurrentAvatar

      public Avatar getCurrentAvatar()
      Gets the currently selected avatar.
      Returns:
      The avatar as an Avatar.