Class BaseAdvancement
java.lang.Object
com.fren_gor.ultimateAdvancementAPI.advancement.Advancement
com.fren_gor.ultimateAdvancementAPI.advancement.BaseAdvancement
- Direct Known Subclasses:
AbstractMultiParentsAdvancement
,AbstractMultiTasksAdvancement
,FakeAdvancement
,TaskAdvancement
BaseAdvancement directly extends Advancement. It represents an advancement with a parent advancement.
-
Field Summary
Modifier and TypeFieldDescriptionprotected final @NotNull Advancement
The advancement parent of the advancement.Fields inherited from class com.fren_gor.ultimateAdvancementAPI.advancement.Advancement
advancementTab, display, key, maxProgression
-
Constructor Summary
ConstructorDescriptionBaseAdvancement
(@NotNull String key, @NotNull AdvancementDisplay display, @NotNull Advancement parent) Creates a newBaseAdvancement
with a maximum progression of1
.BaseAdvancement
(@NotNull String key, @NotNull AdvancementDisplay display, @NotNull Advancement parent, @Range(from=1, to=Integer.MAX_VALUE) int maxProgression) Creates a newBaseAdvancement
. -
Method Summary
Modifier and TypeMethodDescriptionReturns the NMS wrapper of this advancement.Gets the parent of the advancement.void
Validate the advancement after it has been registered by the advancement tab.Methods inherited from class com.fren_gor.ultimateAdvancementAPI.advancement.Advancement
displayToastToPlayer, equals, getAdvancementTab, getAnnounceMessage, getDisplay, getKey, getMaxProgression, getProgression, getProgression, getProgression, giveReward, grant, grant, handlePlayer, hashCode, incrementProgression, incrementProgression, incrementProgression, incrementProgression, incrementProgression, incrementProgression, incrementProgression, incrementProgression, incrementProgression, isGranted, isGranted, isGranted, isValid, isVisible, isVisible, isVisible, onDispose, onGrant, onRegister, onUpdate, registerEvent, registerEvent, revoke, setProgression, setProgression, setProgression, setProgression, setProgression, toString
-
Field Details
-
parent
The advancement parent of the advancement.The advancement is visually linked with the parent in the advancement GUI.
-
-
Constructor Details
-
BaseAdvancement
public BaseAdvancement(@NotNull @NotNull String key, @NotNull @NotNull AdvancementDisplay display, @NotNull @NotNull Advancement parent) Creates a newBaseAdvancement
with a maximum progression of1
.The tab of this advancement will be the parent one.
- Parameters:
key
- The unique key of the advancement. It must be unique among the other advancements of the tab.display
- The display information of this advancement.parent
- The parent of this advancement.
-
BaseAdvancement
public BaseAdvancement(@NotNull @NotNull String key, @NotNull @NotNull AdvancementDisplay display, @NotNull @NotNull Advancement parent, @Range(from=1, to=Integer.MAX_VALUE) int maxProgression) Creates a newBaseAdvancement
.The tab of this advancement will be the parent one.
- Parameters:
key
- The unique key of the advancement. It must be unique among the other advancements of the tab.display
- The display information of this advancement.parent
- The parent of this advancement.maxProgression
- The maximum advancement progression.
-
-
Method Details
-
validateRegister
Validate the advancement after it has been registered by the advancement tab. If the validation fails, aInvalidAdvancementException
should be thrown.For example,
BaseAdvancement
overrides this method to make sure it and its parent belongs to the same tab.Note that every method of
AdvancementTab
is available, since this method is called after every advancement has been registered and the tab has already been initialised.- Overrides:
validateRegister
in classAdvancement
- Throws:
InvalidAdvancementException
- If the validation fails.
-
getNMSWrapper
Returns the NMS wrapper of this advancement. Should craft the NMS wrapper once and returns it henceforth.- Specified by:
getNMSWrapper
in classAdvancement
- Returns:
- The NMS wrapper of this advancement.
-
getParent
Gets the parent of the advancement.- Returns:
- The parent of the advancement.
-