Record Class Upgrade.Reactive

java.lang.Object
java.lang.Record
dev.kitteh.factions.upgrade.Upgrade.Reactive
Record Components:
name - simple name
nameComponent - decorated name
description - decorated description
detailsFunction - function converting upgrade settings to a decorated detail on a given level
maxLevel - max level configurable
variables - variables used
reactor - response to a faction changing upgrade level
All Implemented Interfaces:
Upgrade
Enclosing interface:
Upgrade

public static record Upgrade.Reactive(String name, net.kyori.adventure.text.Component nameComponent, net.kyori.adventure.text.Component description, BiFunction<UpgradeSettings,Integer,net.kyori.adventure.text.Component> detailsFunction, int maxLevel, Set<UpgradeVariable> variables, Upgrade.Reactor reactor) extends Record implements Upgrade
Optional helper record for creating a reactive upgrade.
  • Constructor Details

    • Reactive

      public Reactive(String name, net.kyori.adventure.text.Component nameComponent, net.kyori.adventure.text.Component description, BiFunction<UpgradeSettings,Integer,net.kyori.adventure.text.Component> detailsFunction, int maxLevel, Set<UpgradeVariable> variables, Upgrade.Reactor reactor)
      Creates an instance of a Reactive record class.
      Parameters:
      name - the value for the name record component
      nameComponent - the value for the nameComponent record component
      description - the value for the description record component
      detailsFunction - the value for the detailsFunction record component
      maxLevel - the value for the maxLevel record component
      variables - the value for the variables record component
      reactor - the value for the reactor record component
  • Method Details

    • details

      public net.kyori.adventure.text.Component details(UpgradeSettings settings, int level)
      Description copied from interface: Upgrade
      Gets details about a specific level of the upgrade, using available upgrade settings.
      Specified by:
      details in interface Upgrade
      Parameters:
      settings - upgrade settings
      level - level
      Returns:
      decorated details
    • onChange

      public void onChange(Faction faction, int oldLevel, int newLevel)
      Description copied from interface: Upgrade
      Called by the plugin when a faction changes level of this upgrade, potentially executing code.
      Specified by:
      onChange in interface Upgrade
      Parameters:
      faction - faction experiencing level change
      oldLevel - old level
      newLevel - new level
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • name

      public String name()
      Returns the value of the name record component.
      Specified by:
      name in interface Upgrade
      Returns:
      the value of the name record component
    • nameComponent

      public net.kyori.adventure.text.Component nameComponent()
      Returns the value of the nameComponent record component.
      Specified by:
      nameComponent in interface Upgrade
      Returns:
      the value of the nameComponent record component
    • description

      public net.kyori.adventure.text.Component description()
      Returns the value of the description record component.
      Specified by:
      description in interface Upgrade
      Returns:
      the value of the description record component
    • detailsFunction

      public BiFunction<UpgradeSettings,Integer,net.kyori.adventure.text.Component> detailsFunction()
      Returns the value of the detailsFunction record component.
      Returns:
      the value of the detailsFunction record component
    • maxLevel

      public int maxLevel()
      Returns the value of the maxLevel record component.
      Specified by:
      maxLevel in interface Upgrade
      Returns:
      the value of the maxLevel record component
    • variables

      public Set<UpgradeVariable> variables()
      Returns the value of the variables record component.
      Specified by:
      variables in interface Upgrade
      Returns:
      the value of the variables record component
    • reactor

      public Upgrade.Reactor reactor()
      Returns the value of the reactor record component.
      Returns:
      the value of the reactor record component