Interface IElevatorSetting<T>
-
- Type Parameters:
T- the value type for this setting (e.g., Boolean, String, Integer)
- All Known Subinterfaces:
IBuilderElevatorSetting<T>,IElevatorActionSetting<T>
public interface IElevatorSetting<T>Represents a configurable setting that may apply globally to anIElevatorTypeand optionally be overridden perIElevator.Global vs individual values
- Global value: derived from the owning
IElevatorType(seegetGlobalValue(IElevatorType)). - Individual value: when supported, stored on the elevator's backing block via a persistent datastore
and read via
getIndividualValue(IElevator).
Global-only behavior: A setting is treated as global-only when either:
- the elevator type disables the setting by name via config, or
canBeEditedIndividually(IElevator)returns false.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @NotNull IElevatorSetting<T>addAction(@NotNull java.lang.String action, @NotNull java.lang.String description)Adds an informational UI action line to this setting's icon/lore.booleancanBeEditedIndividually(@NotNull IElevator elevator)Returns whether this setting supports per-elevator (individual) editing for the given elevator.voidclickGlobal(@NotNull org.bukkit.entity.Player player, @NotNull IElevatorType elevatorType, @NotNull java.lang.Runnable returnMethod, @NotNull org.bukkit.event.inventory.InventoryClickEvent clickEvent)Handles a click on this setting in a "global" context.voidclickIndividual(@NotNull org.bukkit.entity.Player player, @NotNull IElevator elevator, @NotNull java.lang.Runnable returnMethod, @NotNull org.bukkit.event.inventory.InventoryClickEvent clickEvent)Handles a click on this setting in an "individual" context.@NotNull org.bukkit.inventory.ItemStackcreateIcon(@NotNull java.lang.Object value, boolean global)Creates an icon representing this setting and its current value for UI display.TgetGlobalValue(@NotNull IElevatorType elevatorType)Returns the global value of this setting for the given elevator type.TgetIndividualValue(@NotNull IElevator elevator)Returns the resolved value of this setting for a specific elevator.@NotNull org.bukkit.plugin.java.JavaPlugingetPlugin()Returns the plugin that provided/owns this setting.@NotNull java.lang.StringgetSettingName()Returns the internal setting name/key (server-wide).booleanisSettingGlobalOnly(@NotNull IElevator elevator)Returns whether this setting is forced to be global-only for the given elevator.voidonClickGlobal(@NotNull org.bukkit.entity.Player player, @NotNull IElevatorType elevatorType, @NotNull java.lang.Runnable returnMethod, @NotNull org.bukkit.event.inventory.InventoryClickEvent clickEvent, T currentValue)Called when the setting is clicked in a global context, with the current global value already provided.voidonClickIndividual(@NotNull org.bukkit.entity.Player player, @NotNull IElevator elevator, @NotNull java.lang.Runnable returnMethod, @NotNull org.bukkit.event.inventory.InventoryClickEvent clickEvent, T currentValue)Called when the setting is clicked in an individual context, with the current individual value already provided.voidsetIndividualValue(@NotNull IElevator elevator, T value)Sets the per-elevator override value for this setting.
-
-
-
Method Detail
-
addAction
@NotNull @NotNull IElevatorSetting<T> addAction(@NotNull @NotNull java.lang.String action, @NotNull @NotNull java.lang.String description)
Adds an informational UI action line to this setting's icon/lore.This does not change the setting value; it only affects the generated icon lore.
- Parameters:
action- non-null action label (e.g., "LEFT-CLICK")description- non-null action description- Returns:
- this setting instance (for chaining)
- Throws:
java.lang.NullPointerException- if any argument isnull
-
isSettingGlobalOnly
boolean isSettingGlobalOnly(@NotNull @NotNull IElevator elevator)Returns whether this setting is forced to be global-only for the given elevator.This is typically true when the elevator type has disabled this setting by name or when individual editing is not supported for the elevator/context.
- Parameters:
elevator- non-null elevator context- Returns:
- true if individual overrides are not allowed; otherwise false
- Throws:
java.lang.NullPointerException- ifelevatorisnull
-
canBeEditedIndividually
boolean canBeEditedIndividually(@NotNull @NotNull IElevator elevator)Returns whether this setting supports per-elevator (individual) editing for the given elevator.If this returns false, the setting is effectively global-only for that elevator.
- Parameters:
elevator- non-null elevator context- Returns:
- true if per-elevator editing is supported; otherwise false
- Throws:
java.lang.NullPointerException- ifelevatorisnull
-
createIcon
@NotNull @NotNull org.bukkit.inventory.ItemStack createIcon(@NotNull @NotNull java.lang.Object value, boolean global)Creates an icon representing this setting and its current value for UI display.Contract:
valuemust be non-null.- Parameters:
value- non-null current value (global or individual)global- whether the icon represents the global value or an individual value- Returns:
- a non-null item stack icon (typically a clone of an internal template)
- Throws:
java.lang.NullPointerException- ifvalueisnull
-
clickGlobal
void clickGlobal(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull IElevatorType elevatorType, @NotNull @NotNull java.lang.Runnable returnMethod, @NotNull @NotNull org.bukkit.event.inventory.InventoryClickEvent clickEvent)Handles a click on this setting in a "global" context.This convenience method typically calls
getGlobalValue(IElevatorType)and then delegates toonClickGlobal(Player, IElevatorType, Runnable, InventoryClickEvent, Object).- Parameters:
player- non-null clicking playerelevatorType- non-null elevator type being editedreturnMethod- non-null callback to return to the previous UIclickEvent- non-null inventory click event
-
clickIndividual
void clickIndividual(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull IElevator elevator, @NotNull @NotNull java.lang.Runnable returnMethod, @NotNull @NotNull org.bukkit.event.inventory.InventoryClickEvent clickEvent)Handles a click on this setting in an "individual" context.This convenience method typically calls
getIndividualValue(IElevator)and then delegates toonClickIndividual(Player, IElevator, Runnable, InventoryClickEvent, Object).- Parameters:
player- non-null clicking playerelevator- non-null elevator being editedreturnMethod- non-null callback to return to the previous UIclickEvent- non-null inventory click event
-
onClickGlobal
void onClickGlobal(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull IElevatorType elevatorType, @NotNull @NotNull java.lang.Runnable returnMethod, @NotNull @NotNull org.bukkit.event.inventory.InventoryClickEvent clickEvent, @NotNull T currentValue)Called when the setting is clicked in a global context, with the current global value already provided.- Parameters:
player- non-null clicking playerelevatorType- non-null elevator type being editedreturnMethod- non-null callback to return to the previous UIclickEvent- non-null inventory click eventcurrentValue- current global value
-
onClickIndividual
void onClickIndividual(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull IElevator elevator, @NotNull @NotNull java.lang.Runnable returnMethod, @NotNull @NotNull org.bukkit.event.inventory.InventoryClickEvent clickEvent, @NotNull T currentValue)Called when the setting is clicked in an individual context, with the current individual value already provided.- Parameters:
player- non-null clicking playerelevator- non-null elevator being editedreturnMethod- non-null callback to return to the previous UIclickEvent- non-null inventory click eventcurrentValue- current individual value
-
getGlobalValue
@NotNull T getGlobalValue(@NotNull @NotNull IElevatorType elevatorType)
Returns the global value of this setting for the given elevator type.- Parameters:
elevatorType- non-null elevator type context- Returns:
- the global value (implementations should not return
nullunless explicitly documented)
-
getIndividualValue
@NotNull T getIndividualValue(@NotNull @NotNull IElevator elevator)
Returns the resolved value of this setting for a specific elevator.If individual editing is supported and a datastore is configured, implementations typically read the stored override from the elevator's persistent data container; otherwise the global value is returned.
- Parameters:
elevator- non-null elevator context- Returns:
- the resolved value (typically non-null)
-
setIndividualValue
void setIndividualValue(@NotNull @NotNull IElevator elevator, @NotNull T value)Sets the per-elevator override value for this setting.Side effects: Implementations will write to the elevator's persistent data container and update the backing block state.
Optimization behavior: Implementations may remove the stored override when
valueequals the current global value.- Parameters:
elevator- non-null elevator to modifyvalue- new value to store (may be treated as "remove override" when equal to global)- Throws:
java.lang.RuntimeException- if this setting does not support individual overrides (e.g., datastore not configured)
-
getSettingName
@NotNull @NotNull java.lang.String getSettingName()
Returns the internal setting name/key (server-wide).- Returns:
- the non-null setting name
-
getPlugin
@NotNull @NotNull org.bukkit.plugin.java.JavaPlugin getPlugin()
Returns the plugin that provided/owns this setting.- Returns:
- the non-null plugin
-
-