mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 11:27:35 +01:00
#1067: Add method to get Advancement requirements
By: Nothixal <nothixal@gmail.com>
This commit is contained in:
parent
471ecd8e4a
commit
98f6ab9a04
@ -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.
|
||||
*
|
||||
|
@ -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();
|
||||
}
|
@ -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();
|
||||
}
|
Loading…
Reference in New Issue
Block a user