Klasse AdvancementRegisterBuilder<E extends org.bukkit.event.Event>
java.lang.Object
io.github.lambdaphoenix.advancementLib.AdvancementRegisterBuilder<E>
- Typparameter:
E- the event type
Fluent Builder for registering custom advancements in your plugin.
Allows you to specify all the details for your advancement, including the event, conditions, progress targets, and how criteria are granted.
Required parameters:
advancementKey(unique string identifier)eventType(class of the Bukkit event)
build().
Optional parameters:
condition- predicate for event acceptance (defaults to always true)playerExtractor- function to extract the player from the event (defaults toPlayerExtractor.getDefaultPlayerExtractor(Class, Logger)if available)increment- function to determine progress increment (ifnull, defaults to 1 per event; otherwise, uses the provided function)targetValue- required progress to complete (default: 1, must be at least 1)grantMode- how the advancement is granted (default:GrantMode.ALL_AT_ONCE)
Note: The PlayerExtractor utility provides default extractors for common Bukkit
events. For custom events, you may supply your own extractor.
- Seit:
- 0.2.0
- Version:
- 0.3.1
- Autor:
- lambdaphoenix
- Siehe auch:
-
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungStart building a new advancement.AdvancementRegisterBuilder(AdvancementAPI api, String advancementKey) Start building a new advancement with a specific key.AdvancementRegisterBuilder(AdvancementAPI api, String advancementKey, Class<E> eventType) Start building a new advancement with a specific key and event type. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungadvancementKey(String advancementKey) Sets the unique identifier for this advancement.voidbuild()Registers the advancement with the specified configuration.condition(BiPredicate<org.bukkit.entity.Player, E> condition) Sets the condition that must be true for the advancement to progress.Sets the event type that triggers this advancement.Sets how criteria are granted to the playerincrement(ToIntFunction<E> increment) Sets how much progress each event should add.playerExtractor(Function<E, org.bukkit.entity.Player> playerExtractor) Sets a custom function to extract the player from the event.targetValue(int targetValue) Sets how many times the event must occur before the advancement is granted.
-
Konstruktordetails
-
AdvancementRegisterBuilder
Start building a new advancement.- Parameter:
api- the AdvancementAPI instance; must not benull- Löst aus:
NullPointerException- ifapiisnull- Seit:
- 0.2.0
- Siehe auch:
-
AdvancementRegisterBuilder
Start building a new advancement with a specific key.- Parameter:
api- the AdvancementAPI instance; must not benulladvancementKey- the unique name for this advancement; must not benull- Seit:
- 0.2.0
- Siehe auch:
-
AdvancementRegisterBuilder
Start building a new advancement with a specific key and event type.- Parameter:
api- the AdvancementAPI instance; must not benulladvancementKey- the unique name for this advancement; must not benulleventType- the event type that triggers this advancement; must not benull- Seit:
- 0.2.0
- Siehe auch:
-
-
Methodendetails
-
advancementKey
Sets the unique identifier for this advancement.- Parameter:
advancementKey- the advancement name; must not benull- Gibt zurück:
- this builder
- Löst aus:
NullPointerException- ifadvancementKeyisnull- Seit:
- 0.2.0
-
eventType
Sets the event type that triggers this advancement.- Parameter:
eventType- the event class; must not benull- Gibt zurück:
- this builder
- Löst aus:
NullPointerException- ifeventTypeisnull- Seit:
- 0.2.0
- Siehe auch:
-
condition
Sets the condition that must be true for the advancement to progress.If not set, defaults to always
true.- Parameter:
condition- a predicate(player, event) -> trueif this event should count- Gibt zurück:
- this builder
- Seit:
- 0.2.0
- Siehe auch:
-
targetValue
Sets how many times the event must occur before the advancement is granted.Must be at least 1. Default is 1.
- Parameter:
targetValue- the number of times the event must occur- Gibt zurück:
- this builder
- Seit:
- 0.2.0
-
playerExtractor
public AdvancementRegisterBuilder<E> playerExtractor(Function<E, org.bukkit.entity.Player> playerExtractor) Sets a custom function to extract the player from the event.If not set, a default extractor will be used if available for the event type (see
PlayerExtractor.getDefaultPlayerExtractor(Class, Logger)).- Parameter:
playerExtractor- function to extract the player from the event- Gibt zurück:
- this builder
- Seit:
- 0.2.0
- Siehe auch:
-
grantMode
Sets how criteria are granted to the playerDefaults to
GrantMode.ALL_AT_ONCE.- Parameter:
grantMode- the grant mode; must not benull- Gibt zurück:
- this builder
- Löst aus:
NullPointerException- ifgrantModeisnull- Seit:
- 0.2.0
- Siehe auch:
-
increment
Sets how much progress each event should add.If not set, each event increases progress by 1.
- Parameter:
increment- function to determine progress increment- Gibt zurück:
- this builder
- Seit:
- 0.2.0
- Siehe auch:
-
build
public void build()Registers the advancement with the specified configuration.You must set both
advancementKeyandeventTypebefore calling this.- Löst aus:
IllegalArgumentException- if required fields are missing or invalid- Seit:
- 0.2.0
- Siehe auch:
-