Datensatzklasse BossDefinition

java.lang.Object
java.lang.Record
de.delinkedde.mobarenareborn.boss.BossDefinition
Datensatzkomponenten:
id - the stable, normalised identifier
entityType - the underlying entity type to spawn
displayName - the MiniMessage name shown on the boss bar
healthMultiplier - the factor applied to the scaled mob health for this boss
damageMultiplier - the factor applied to the scaled mob damage for this boss
phases - the combat phases, ordered as configured

public record BossDefinition(@NotNull String id, @NotNull EntityType entityType, @NotNull String displayName, double healthMultiplier, double damageMultiplier, @NotNull List<BossPhase> phases, @Nullable String reward, @NotNull List<String> drops) extends Record
A data-driven boss definition loaded from bosses.yml.

A boss is a vanilla EntityType with multiplied health and damage and a list of health-gated phases. The phase that is active for a given remaining-health fraction is resolved by phaseFor(double).

  • Konstruktordetails

    • BossDefinition

      public BossDefinition(@NotNull @NotNull String id, @NotNull @NotNull EntityType entityType, @NotNull @NotNull String displayName, double healthMultiplier, double damageMultiplier, @NotNull @NotNull List<BossPhase> phases, @Nullable @Nullable String reward, @NotNull @NotNull List<String> drops)
      Canonical constructor; defensively copies the phase list.
      Parameter:
      id - the identifier
      entityType - the entity type
      displayName - the boss-bar name
      healthMultiplier - the health factor
      damageMultiplier - the damage factor
      phases - the phases
  • Methodendetails

    • phaseFor

      @NotNull public @NotNull Optional<BossPhase> phaseFor(double fraction)
      Resolves the phase active for the given remaining-health fraction.

      The active phase is the one with the smallest threshold that is still at or above the fraction (so the boss advances to the next phase as it loses health). When the fraction is above every threshold, the highest-threshold phase is returned.

      Parameter:
      fraction - the remaining-health fraction (0..1)
      Gibt zurück:
      the active phase, or empty if no phases are defined
    • fromSection

      @NotNull public static @NotNull BossDefinition fromSection(@NotNull @NotNull String id, @NotNull @NotNull ConfigurationSection section)
      Parses a boss definition from a configuration section.
      Parameter:
      id - the boss identifier (normalised to lower case)
      section - the configuration section
      Gibt zurück:
      the parsed definition
      Löst aus:
      IllegalArgumentException - if the entity type is invalid
    • toString

      public final String toString()
      Gibt eine Zeichenfolgendarstellung dieser Datensatzklasse zurück. Die Darstellung enthält den Namen der Klasse, gefolgt vom Namen und Wert jeder der Datensatzkomponenten.
      Angegeben von:
      toString in Klasse Record
      Gibt zurück:
      eine Zeichenfolgendarstellung dieses Objekts
    • hashCode

      public final int hashCode()
      Gibt einen Hashcodewert für diese Objekt zurück. Der Wert wird vom Hashcode jeder der Datensatzkomponenten abgeleitet.
      Angegeben von:
      hashCode in Klasse Record
      Gibt zurück:
      ein Hashcodewert für dieses Objekt
    • equals

      public final boolean equals(Object o)
      Gibt an, ob ein anderes Objekt diesem gleich ("equal to") ist. Die Objekte sind gleich, wenn das andere Objekt der gleichen Klasse angehört und alle Datensatzkomponenten gleich sind. Referenzkomponenten werden verglichen mit Objects::equals(Object,Object); primitive Komponenten werden verglichen mit "==".
      Angegeben von:
      equals in Klasse Record
      Parameter:
      o - das Objekt, mit dem verglichen wird
      Gibt zurück:
      true, wenn dieses Objekt gleich dem Argument o ist, andernfalls false.
    • id

      @NotNull public @NotNull String id()
      Gibt den Wert für die Datensatzkomponente id zurück.
      Gibt zurück:
      Wert der Datensatzkomponente id
    • entityType

      @NotNull public @NotNull EntityType entityType()
      Gibt den Wert für die Datensatzkomponente entityType zurück.
      Gibt zurück:
      Wert der Datensatzkomponente entityType
    • displayName

      @NotNull public @NotNull String displayName()
      Gibt den Wert für die Datensatzkomponente displayName zurück.
      Gibt zurück:
      Wert der Datensatzkomponente displayName
    • healthMultiplier

      public double healthMultiplier()
      Gibt den Wert für die Datensatzkomponente healthMultiplier zurück.
      Gibt zurück:
      Wert der Datensatzkomponente healthMultiplier
    • damageMultiplier

      public double damageMultiplier()
      Gibt den Wert für die Datensatzkomponente damageMultiplier zurück.
      Gibt zurück:
      Wert der Datensatzkomponente damageMultiplier
    • phases

      @NotNull public @NotNull List<BossPhase> phases()
      Gibt den Wert für die Datensatzkomponente phases zurück.
      Gibt zurück:
      Wert der Datensatzkomponente phases
    • reward

      @Nullable public @Nullable String reward()
      Gibt den Wert für die Datensatzkomponente reward zurück.
      Gibt zurück:
      Wert der Datensatzkomponente reward
    • drops

      @NotNull public @NotNull List<String> drops()
      Gibt den Wert für die Datensatzkomponente drops zurück.
      Gibt zurück:
      Wert der Datensatzkomponente drops