#1067: Add method to get Advancement requirements

By: Nothixal <nothixal@gmail.com>
This commit is contained in:
Bukkit/Spigot 2024-11-23 21:25:09 +11:00
parent 471ecd8e4a
commit 98f6ab9a04
3 changed files with 57 additions and 0 deletions

View File

@ -19,6 +19,14 @@ public interface Advancement extends Keyed {
@NotNull
Collection<String> getCriteria();
/**
* Returns the requirements for this advancement.
*
* @return an AdvancementRequirements object.
*/
@NotNull
AdvancementRequirements getRequirements();
/**
* Returns the display information for this advancement.
*

View File

@ -0,0 +1,23 @@
package org.bukkit.advancement;
import java.util.List;
import org.jetbrains.annotations.NotNull;
public interface AdvancementRequirement {
/**
* Get all required criteria.
*
* @return the list of required criteria for this requirement.
*/
@NotNull
List<String> getRequiredCriteria();
/**
* Check if the requirement is strict.
*
* @return true if requirement list contains one criteria, false if
* multiple.
*/
boolean isStrict();
}

View File

@ -0,0 +1,26 @@
package org.bukkit.advancement;
import java.util.List;
import org.jetbrains.annotations.NotNull;
/**
* The list of requirements for the advancement.
*
* Requirements are complimentary to criteria. They are just lists that contain
* more lists, which in turn contains strings that equal the names of the
* criteria. Ultimately defining the logic around how criteria are completed in
* order to grant the advancement.
*
* @see <a href=https://minecraft.wiki/w/Advancement_definition>Advancement Definition</a>
* @see <a href=https://www.minecraftforum.net/forums/minecraft-java-edition/redstone-discussion-and/commands-command-blocks-and/2809368-1-12-custom-advancements-aka-achievements#Requirements>Advancement Requirements</a>
*/
public interface AdvancementRequirements {
/**
* Get all the requirements present in this advancement.
*
* @return an unmodifiable copy of all requirements.
*/
@NotNull
List<AdvancementRequirement> getRequirements();
}