Interface JobType


public interface JobType
Represents a type of job that can be assigned to a job.

For all data saving and loading use JobTypeData class. Any type of data that is not in this class will not be saved after a server restart.

If you don't want to save some data, just use the transient keyword before the variable.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    fromJsonJobTypeData​(com.google.gson.JsonObject json)
    Sets the data of the job type from JSON format.
    Retrieves the description of the job type.
    org.bukkit.inventory.ItemStack
    Retrieves the icon of the job type that will be displayed for admins in the /jobs menu and when an admin is selecting what job type to assign to a job.
    com.google.gson.JsonObject
    Retrieves the data of the job type in JSON format.
    Retrieves the name of the job type.
    Should return just a new instance of the JobType.
    boolean
    Checks if the job type has an admin menu.
    boolean
    Checks if the job type has a boss menu.
    void
    Initializes the job type.
    void
    openAdminMenu​(org.bukkit.entity.Player player)
    Opens the admin menu for the JobType.
    void
    openBossMenu​(org.bukkit.entity.Player player)
    Opens the boss menu for the JobType.
    void
    Stops the job type.
  • Method Details

    • getName

      String getName()
      Retrieves the name of the job type.
      Returns:
      the name of the job type as a String.
    • getDescription

      String getDescription()
      Retrieves the description of the job type.
      Returns:
      the description of the job type as a String.
    • hasAdminMenu

      boolean hasAdminMenu()
      Checks if the job type has an admin menu.
      Returns:
      true if the job type has an admin menu, false otherwise
    • initialize

      void initialize()
      Initializes the job type.

      This is called when a job using this job type is ready to be initialized. This method should be used to set up any initial state or perform any necessary setup for the job type.

    • stop

      void stop()
      Stops the job type.
    • openAdminMenu

      void openAdminMenu(org.bukkit.entity.Player player)
      Opens the admin menu for the JobType.

      This method is used to open the admin menu for a specific JobType. The admin menu allows users with the appropriate privileges to perform administrative tasks related to the JobType, such as configuring settings, managing permissions, or performing other administrative actions.

      Parameters:
      player - the player to open the admin menu for.
    • hasBossMenu

      boolean hasBossMenu()
      Checks if the job type has a boss menu.
      Returns:
      true if the job type has a boss menu, false otherwise.
    • openBossMenu

      void openBossMenu(org.bukkit.entity.Player player)
      Opens the boss menu for the JobType.

      This method is used to open the boss menu for a specific JobType. The boss menu allows users with the appropriate privileges to perform boss-level tasks related to the JobType.

      Note: The boss menu is only available if the JobType has a boss menu.

      Parameters:
      player - the player to open the boss menu for.
    • getIcon

      @Nullable org.bukkit.inventory.ItemStack getIcon()
      Retrieves the icon of the job type that will be displayed for admins in the /jobs menu and when an admin is selecting what job type to assign to a job.

      Do not use colored glass as an icon, as clicking on it will not work in the /jobs menu.

      Returns:
      the icon of the job type as an ItemStack, or null if there is no icon.
    • getNewInstance

      JobType getNewInstance(Job job)
      Should return just a new instance of the JobType.

      This method is used when adding a jobType to the list of job types so that the jobType can be instantiated.

      Returns:
      a new instance of the JobType.
    • getJsonJobTypeData

      com.google.gson.JsonObject getJsonJobTypeData()
      Retrieves the data of the job type in JSON format.
      Returns:
      The data of the job type in JSON format.
    • fromJsonJobTypeData

      void fromJsonJobTypeData(com.google.gson.JsonObject json)
      Sets the data of the job type from JSON format.
      Parameters:
      json - The data of the job type in JSON format.