Class ScenarioDescriptor

java.lang.Object
dev.itsharshxd.zentrix.api.scenario.ScenarioDescriptor

public final class ScenarioDescriptor extends Object
Everything Zentrix knows about a scenario before it ever runs: how to name it, how to show it, how it combines with other scenarios, and what it can be configured with.

A descriptor is immutable and is supplied once by Scenario.descriptor(). Built-in and third-party scenarios use exactly the same descriptor, so a registered addon scenario appears in the commands, GUIs, voting pools, automatic-selection pools, validation and API lookups on equal footing with the ones Zentrix ships.

There is no fixed category list. tags() is free-form and exists purely so a scenario can group or filter itself however its author likes.

Since:
1.6.0
  • Method Details

    • id

      @NotNull public @NotNull String id()
      The stable lower-case identifier used in configuration, commands and API lookups.
    • displayName

      @NotNull public @NotNull String displayName()
      The name shown to players and administrators.
    • description

      @NotNull public @NotNull List<String> description()
      The description lines shown in the GUIs.
    • announcement

      @NotNull public @NotNull List<String> announcement()
      The lines announced to a match once its players are in the arena.

      Zentrix sends one announcement per scenario a match runs, spaced out by the delay configured in scenarios.yml. A server owner may override these lines under scenarios.announcements.scenarios.<id> in the locale file, which is why this is only the wording the scenario itself suggests. An empty list falls back to the locale's shared announcement layout, built from displayName() and description().

      Lines carry the usual Zentrix formatting: &c and &#RRGGBB colors and <center>...</center> tags.

    • icon

      @NotNull public @NotNull org.bukkit.Material icon()
      The icon used wherever the scenario is listed.
    • version

      @NotNull public @NotNull String version()
      The scenario's own version string, for addon diagnostics.
    • authors

      @NotNull public @NotNull List<String> authors()
    • priority

      public int priority()
      The activation and hook order of this scenario.

      A higher priority activates earlier and sees gameplay hooks first, which is what makes a combination of scenarios deterministic. Scenarios sharing a priority are ordered by ID.

    • dependencies

      @NotNull public @NotNull Set<String> dependencies()
      IDs of scenarios that must be active alongside this one.
    • conflicts

      @NotNull public @NotNull Set<String> conflicts()
      IDs of scenarios that must never be active alongside this one.
    • capabilities

      @NotNull public @NotNull Set<ScenarioCapability> capabilities()
      The gameplay areas this scenario takes charge of.

      Anything declared here makes the scenario incompatible with every scenario that conflicts with the same capability, whether or not the two know about each other.

    • capabilityConflicts

      @NotNull public @NotNull Set<ScenarioCapability> capabilityConflicts()
      The gameplay areas this scenario cannot share a match with.

      Every scenario providing one of these conflicts with this one. Declaring the same capability in both sets forms a mutual-exclusion group: any two members conflict, and the group stays open to scenarios written later.

    • provides

      public boolean provides(@Nullable @Nullable ScenarioCapability capability)
      Whether this scenario declared it takes charge of a capability.
    • requiredPlugins

      @NotNull public @NotNull Set<String> requiredPlugins()
      Names of Bukkit plugins that must be enabled for this scenario to be selectable.
    • tags

      @NotNull public @NotNull Set<String> tags()
      Free-form labels; Zentrix imposes no category system of its own.
    • settings

      @NotNull public @NotNull Map<String,ScenarioSetting> settings()
      The scenario's configurable values, keyed by setting key, in declaration order.
    • setting

      @NotNull public Optional<ScenarioSetting> setting(@NotNull @NotNull String key)
    • votable

      public boolean votable()
      Whether players may vote for this scenario.
    • enabledByDefault

      public boolean enabledByDefault()
      Whether the scenario counts as enabled until an administrator says otherwise.

      Built-in scenarios ship enabled. A dynamically registered scenario normally leaves this false, so it stays inert until somebody configures it.

    • builder

      @NotNull public static @NotNull ScenarioDescriptor.Builder builder(@NotNull @NotNull String id)
    • toString

      public String toString()
      Overrides:
      toString in class Object