Klasse AdvancementAPI

java.lang.Object
io.github.lambdaphoenix.advancementLib.AdvancementAPI

public final class AdvancementAPI extends Object
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:
  • Konstruktordetails

    • AdvancementAPI

      public AdvancementAPI(org.bukkit.plugin.Plugin plugin)
      Creates a new AdvancementAPI instance for your plugin.
      Parameter:
      plugin - your plugin instance (not null)
      Löst aus:
      NullPointerException - if plugin is null
      Seit:
      0.1.0
      Siehe auch:
      • Plugin
  • Methodendetails

    • register

      public <E extends org.bukkit.event.Event> AdvancementRegisterBuilder<E> register(Class<E> eventType)
      Starts a new AdvancementRegisterBuilder for 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

      public int getProgress(String advancementKey, org.bukkit.entity.Player player)
      Gets the current progress towards an advancement for a specific player.
      Parameter:
      advancementKey - the namespaced key of the advancement
      player - the player to check progress for
      Gibt zurück:
      the number of times the condition has been met
      Seit:
      0.1.0
    • resetProgress

      public void resetProgress(String advancementKey, org.bukkit.entity.Player player)
      Resets the current progress for the specified advancement to the player.
      Parameter:
      advancementKey - the namespaced key of the advancement
      player - the player who should have their progress reset
      Seit:
      0.3.1
      Siehe auch:
      • Advancement
      • AdvancementProgress
    • resetAdvancement

      public void resetAdvancement(String advancementKey, org.bukkit.entity.Player player)
      Resets the player's advancement including all criteria.
      Parameter:
      advancementKey - the namespaced key of the advancement
      player - the player who should have their advancement reset
      Seit:
      0.3.1
      Siehe auch:
      • Advancement
      • AdvancementProgress