Interface PlayerClass


public interface PlayerClass
Read-only view of a player class configuration.

A player class defines starting equipment and passive abilities that players can select before or during a game. Classes differ by their kits, abilities, and playstyles.

Example


 ClassService classService = ZentrixProvider.get().getClassService();

 // Get a class
 Optional<PlayerClass> warrior = classService.getClass("warrior");
 warrior.ifPresent(pc -> {
     String name = pc.getDisplayName();
     String desc = pc.getDescription();
     Material icon = pc.getIconMaterial();

     player.sendMessage("Class: " + name);
     player.sendMessage("Description: " + desc);
 });
 
Since:
1.0.0
  • Method Details

    • isEnabled

      default boolean isEnabled()
    • getGuiSlot

      default int getGuiSlot()
      GUI slot, or -1 when no explicit slot is configured.
    • getRequiredPermission

      @Nullable default @Nullable String getRequiredPermission()
    • requiresPermission

      default boolean requiresPermission()
    • canSelect

      default boolean canSelect(@NotNull @NotNull org.bukkit.entity.Player player)
    • getNoPermissionItem

      @Nullable default @Nullable org.bukkit.inventory.ItemStack getNoPermissionItem()
      Locked GUI icon, or null when the normal icon should be used.
    • getAbilityParameters

      @NotNull default @NotNull Map<String,Object> getAbilityParameters()
    • getType

      @NotNull @NotNull String getType()
      Gets the unique type identifier for this class.

      This is the internal name used to identify the class (e.g., "WARRIOR", "ARCHER", "MINER").

      Returns:
      The class type identifier (never null)
    • getDisplayName

      @NotNull @NotNull String getDisplayName()
      Gets the display name of this class.

      This is the formatted name shown in GUIs and messages, including color codes.

      Returns:
      The display name (never null)
    • getDescription

      @NotNull @NotNull String getDescription()
      Gets the description of this class.

      A brief explanation of what this class does and its playstyle.

      Returns:
      The description (never null)
    • getIconMaterial

      @NotNull @NotNull org.bukkit.Material getIconMaterial()
      Gets the icon material for this class.

      This material is used to represent the class in selection GUIs.

      Returns:
      The icon material (never null)
    • getIconItem

      @NotNull @NotNull org.bukkit.inventory.ItemStack getIconItem()
      Gets a clone of the icon ItemStack used in GUIs.

      This may be a custom item with special display properties. Returns a clone to prevent modification of the original.

      Returns:
      A clone of the icon ItemStack (never null)
    • getLore

      @NotNull @NotNull List<String> getLore()
      Gets the lore lines displayed in the class selection GUI.

      These lines provide additional information about the class, such as ability details and kit contents.

      Returns:
      An unmodifiable list of lore lines (never null, may be empty)
    • getKitItems

      @NotNull @NotNull List<org.bukkit.inventory.ItemStack> getKitItems()
      Gets clones of the kit items provided by this class.

      These items are given to the player when the game starts if they have this class selected. Returns clones to prevent modification of the original items.

      Returns:
      An unmodifiable list of kit item clones (never null, may be empty)
    • getKitItemCount

      default int getKitItemCount()
      Gets the number of items in this class's kit.
      Returns:
      The kit item count
    • hasAbility

      boolean hasAbility()
      Checks if this class has a passive ability.
      Returns:
      true if an ability is configured
    • getAbilityType

      @Nullable @Nullable String getAbilityType()
      Gets the ability type for this class.

      This is the type the class's ability resolves to - one of ClassAbilities.TYPES - with legacy names already resolved to the ability Zentrix runs, so a class configured with ORE_DOUBLE_DROP reports ClassAbilities.AUTO_SMELT. Returns null if the class has no ability configured or its configured type is not recognized; see getDeclaredAbilityType() for what was configured.

      Returns:
      The ability type, or null if none
    • getDeclaredAbilityType

      @Nullable default @Nullable String getDeclaredAbilityType()
      Gets the ability type exactly as content/classes.yml declares it, before legacy names are resolved.
      Returns:
      The declared ability type, or null when none is declared
      Since:
      1.8.0
    • hasUnrecognizedAbility

      default boolean hasUnrecognizedAbility()
      Whether the class declares an ability type Zentrix does not recognize.

      An unrecognized type is reported rather than hidden: getAbilityType() is null for it, while getDeclaredAbilityType() still shows what was configured.

      Returns:
      true when a declared ability type is not recognized
      Since:
      1.8.0
    • getAbilityDescription

      @NotNull @NotNull String getAbilityDescription()
      Gets a description of the class's passive ability.

      Describes the mechanic Zentrix actually runs for the resolved getAbilityType(). Returns an empty string if no ability is configured or it is not recognized.

      Returns:
      The ability description (never null)
    • hasKitItems

      default boolean hasKitItems()
      Checks if this class has any kit items.
      Returns:
      true if the class provides kit items
    • hasLore

      default boolean hasLore()
      Checks if this class has lore configured.
      Returns:
      true if lore lines are configured