Interface HologramController


public interface HologramController
The HologramController is basically the brain of the hologram. It handles what exactly is supposed to happen when interacting the hologram and stores additional information that are needed to process those actions.

Storing informations is for instance required for the team selector. In this case it'll store the currently selected team. To read/write use serialize(JsonObject) or deserialize(JsonObject).

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    A controller might contain some properties of the hologram.
    void
    deserialize(com.google.gson.JsonObject json)
    Reads all the permanent data of this controller from a json object that was previously added with serialize(JsonObject).
    Returns the hologram to which this controller is (possibly) bound to.
    Returns the type of this controller.
    void
    Simulate as if a player would right-click on him
    boolean
    Returns if the controller is still bound to an existing hologram.
    void
    serialize(com.google.gson.JsonObject json)
    Puts all the permanent data of this controller into a json object.
  • Method Details

    • getType

      Returns the type of this controller.
      Returns:
      The type of the controller
    • getHologram

      HologramEntity getHologram()
      Returns the hologram to which this controller is (possibly) bound to.

      It's possible that the hologram has a new controller. Use isActive() to verify that this one is currently the active one.

      Returns:
      The hologram to which this controller instance is (possibly) bound to
    • isActive

      boolean isActive()
      Returns if the controller is still bound to an existing hologram.
      Returns:
      If it is still active
    • handleInteract

      void handleInteract(Player player)
      Simulate as if a player would right-click on him
      Parameters:
      player - The player who touched him
    • applyProperties

      void applyProperties()
      A controller might contain some properties of the hologram. Use this method to apply those properties, such as the display name, to the hologram.
    • serialize

      void serialize(com.google.gson.JsonObject json) throws Exception
      Puts all the permanent data of this controller into a json object.

      For instance this'd add the team of the teamselectstatue if the type is HologramControllerType.TEAM_SELECTOR

      Parameters:
      json - The json to which it shall be added to
      Throws:
      Exception - Errors that might occur during that
    • deserialize

      void deserialize(com.google.gson.JsonObject json) throws Exception
      Reads all the permanent data of this controller from a json object that was previously added with serialize(JsonObject).

      For instance this'd read and update the team of the teamselectstatue if the type is HologramControllerType.TEAM_SELECTOR

      Parameters:
      json - The json from which it shall be read from
      Throws:
      Exception - Errors that might occur during that