Klasse AdvancementAPI
java.lang.Object
io.github.lambdaphoenix.advancementLib.AdvancementAPI
API for registering and tracking custom or vanilla advancements in your plugin.
Use this API to define custom triggers and conditions for granting advancements to players. All registration must go through the builder pattern.
Example usage:
AdvancementAPI api = new AdvancementAPI(plugin);
api.register(PlayerInteractEvent.class)
.advancementKey("minecraft:adventure/trade")
.condition((player, event) -> event.getAction() == Action.RIGHT_CLICK_BLOCK)
.targetValue(5)
.playerExtractor(event -> event.getPlayer())
.build();
- Seit:
- 0.1.0
- Version:
- 0.3.1
- Autor:
- lambdaphoenix
- Siehe auch:
-
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungAdvancementAPI(org.bukkit.plugin.Plugin plugin) Creates a new AdvancementAPI instance for your plugin. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungintgetProgress(String advancementKey, org.bukkit.entity.Player player) Gets the current progress towards an advancement for a specific player.<E extends org.bukkit.event.Event>
AdvancementRegisterBuilder<E> Starts a newAdvancementRegisterBuilderfor the given event type.voidresetAdvancement(String advancementKey, org.bukkit.entity.Player player) Resets the player's advancement including all criteria.voidresetProgress(String advancementKey, org.bukkit.entity.Player player) Resets the current progress for the specified advancement to the player.
-
Konstruktordetails
-
AdvancementAPI
public AdvancementAPI(org.bukkit.plugin.Plugin plugin) Creates a new AdvancementAPI instance for your plugin.- Parameter:
plugin- your plugin instance (notnull)- Löst aus:
NullPointerException- if plugin isnull- Seit:
- 0.1.0
- Siehe auch:
-
-
Methodendetails
-
register
public <E extends org.bukkit.event.Event> AdvancementRegisterBuilder<E> register(Class<E> eventType) Starts a newAdvancementRegisterBuilderfor the given event type.This is the only supported way to register advancements.
- Typparameter:
E- the event type- Parameter:
eventType- the Bukkit event class to listen for- Gibt zurück:
- a new builder instance
- Seit:
- 0.2.0
- Siehe auch:
-
getProgress
Gets the current progress towards an advancement for a specific player.- Parameter:
advancementKey- the namespaced key of the advancementplayer- the player to check progress for- Gibt zurück:
- the number of times the condition has been met
- Seit:
- 0.1.0
-
resetProgress
Resets the current progress for the specified advancement to the player.- Parameter:
advancementKey- the namespaced key of the advancementplayer- the player who should have their progress reset- Seit:
- 0.3.1
- Siehe auch:
-
resetAdvancement
Resets the player's advancement including all criteria.- Parameter:
advancementKey- the namespaced key of the advancementplayer- the player who should have their advancement reset- Seit:
- 0.3.1
- Siehe auch:
-