public final class AdvancementManager
extends java.lang.Object
Constructor | Description |
---|---|
AdvancementManager(org.bukkit.entity.Player... players) |
Modifier and Type | Method | Description |
---|---|---|
void |
addAdvancement(Advancement... advancementsAdded) |
Adds advancements or updates one advancement
|
void |
addPlayer(org.bukkit.entity.Player player) |
Adds a player to the manager
|
void |
displayMessage(org.bukkit.entity.Player player,
Advancement advancement) |
Displays a message to all players in the manager
Note that this doesn't grant the advancement |
static AdvancementManager |
getAccessibleManager(java.lang.String name) |
Gets an accessible Advancement Manager by it's Name
|
static java.util.Collection<AdvancementManager> |
getAccessibleManagers() |
|
Advancement |
getAdvancement(NameKey name) |
|
java.util.ArrayList<Advancement> |
getAdvancements() |
|
java.util.ArrayList<Advancement> |
getAdvancements(java.lang.String namespace) |
|
int |
getCriteriaProgress(java.util.UUID uuid,
Advancement advancement) |
|
int |
getCriteriaProgress(org.bukkit.entity.Player player,
Advancement advancement) |
|
java.lang.String |
getCriterionKey() |
Get the key that is used for the Namespaced Key for criteria
|
java.lang.String |
getCriterionNamespace() |
Get the namespace that is used for the Namespaced Key for criteria
|
java.lang.String |
getCriterionPrefix() |
Get the prefix that is used for criteria
|
boolean |
getHiddenBoolean() |
Gets the boolean that is passed via the advancement packet when an advancement is hidden |
java.lang.String |
getName() |
Returns the Unique Name if AdvancementManager is accessible
|
static AdvancementManager |
getNewAdvancementManager(org.bukkit.entity.Player... players) |
Deprecated.
Use the AdvancementManager constructor instead of this method
|
java.util.ArrayList<org.bukkit.entity.Player> |
getPlayers() |
|
java.lang.String |
getProgressJSON(java.util.UUID uuid) |
|
java.lang.String |
getProgressJSON(java.util.UUID uuid,
java.lang.String namespace) |
|
java.lang.String |
getProgressJSON(org.bukkit.entity.Player player) |
|
java.lang.String |
getProgressJSON(org.bukkit.entity.Player player,
java.lang.String namespace) |
|
void |
grantAdvancement(java.util.UUID uuid,
Advancement advancement) |
Grants an advancement, also works with offline players
|
void |
grantAdvancement(org.bukkit.entity.Player player,
Advancement advancement) |
Grants an advancement
|
void |
grantCriteria(java.util.UUID uuid,
Advancement advancement,
java.lang.String... criteria) |
Grans criteria for an advancement, also works with offline players
|
void |
grantCriteria(org.bukkit.entity.Player player,
Advancement advancement,
java.lang.String... criteria) |
Grants criteria for an advancement
|
boolean |
isAnnounceAdvancementMessages() |
|
void |
loadCustomProgress(java.util.UUID uuid,
java.lang.String json) |
Deprecated.
|
void |
loadCustomProgress(java.util.UUID uuid,
java.lang.String json,
Advancement... advancementsLoaded) |
Deprecated.
|
void |
loadCustomProgress(java.util.UUID uuid,
java.lang.String json,
java.lang.String namespace) |
Deprecated.
|
void |
loadCustomProgress(org.bukkit.entity.Player player,
java.lang.String json) |
Loads the progress with a custom JSON String
|
void |
loadCustomProgress(org.bukkit.entity.Player player,
java.lang.String json,
Advancement... advancementsLoaded) |
Loads the progress with a custom JSON String
|
void |
loadCustomProgress(org.bukkit.entity.Player player,
java.lang.String json,
java.lang.String namespace) |
Loads the progress with a custom JSON String
|
void |
loadProgress(java.util.UUID uuid,
Advancement... advancementsLoaded) |
Deprecated.
|
void |
loadProgress(java.util.UUID uuid,
java.lang.String namespace) |
Deprecated.
|
void |
loadProgress(org.bukkit.entity.Player player,
Advancement... advancementsLoaded) |
Loads the progress
|
void |
loadProgress(org.bukkit.entity.Player player,
java.lang.String namespace) |
Loads the progress
|
void |
makeAccessible(java.lang.String name) |
Makes the AdvancementManager accessible
|
void |
removeAdvancement(Advancement... advancementsRemoved) |
Removes an advancement from the manager
|
void |
removePlayer(org.bukkit.entity.Player player) |
Removes a player from the manager
|
void |
resetAccessible() |
Resets Accessibility-Status and Name
|
void |
revokeAdvancement(java.util.UUID uuid,
Advancement advancement) |
Revokes an advancement, also works with offline players
|
void |
revokeAdvancement(org.bukkit.entity.Player player,
Advancement advancement) |
Revokes an advancement
|
void |
revokeCriteria(java.util.UUID uuid,
Advancement advancement,
java.lang.String... criteria) |
Revokes criteria for an advancement, also works with offline players
|
void |
revokeCriteria(org.bukkit.entity.Player player,
Advancement advancement,
java.lang.String... criteria) |
Revokes criteria for an advancement
|
void |
saveProgress(java.util.UUID uuid,
java.lang.String namespace) |
Saves the progress
|
void |
saveProgress(org.bukkit.entity.Player player,
java.lang.String namespace) |
Saves the progress
|
void |
setAnnounceAdvancementMessages(boolean announceAdvancementMessages) |
Changes if advancement messages will be shown by default in this manager
|
void |
setCriteriaProgress(java.util.UUID uuid,
Advancement advancement,
int progress) |
Sets the criteria progress for an advancement, also works for offline players
Might not work as expected when using features for experts Is the only method triggering CriteriaProgressChangeEvent |
void |
setCriteriaProgress(org.bukkit.entity.Player player,
Advancement advancement,
int progress) |
Sets the criteria progress for an advancement
Might not work as expected when using features for experts Is the only method triggering CriteriaProgressChangeEvent |
void |
setCriterionKey(java.lang.String criterionKey) |
Sets the key that is used for the Namespaced Key for criteria
Only works for advancements that have not generated their criteria yet (use this method before adding advancements to it) |
void |
setCriterionNamespace(java.lang.String criterionNamespace) |
Set the namespace that is used for the Namespaced Key for criteria
Only works for advancements that have not generated their criteria yet (use this method before adding advancements to it) |
void |
setCriterionPrefix(java.lang.String criterionPrefix) |
Set the prefix that is used for criteria
For legacy reasons, the default prefix is "criterion." as the advancement progress is stored by their criterion name, which consists of prefix + number To reduce packet size and thus increase the max criteria number that can be used, the prefix can be set to an empty String Only works for advancements that have not generated their criteria yet (use this method before adding advancements to it) |
void |
setHiddenBoolean(boolean hiddenBoolean) |
Sets the boolean that is passed via the advancement packet when an advancement is hidden
Default: false When set to true, hidden advancements that have not been granted yet, will have a line drawn to them even though they aren't displayed yet, when they should be visible (according to their AdvancementVisibility )Can be used to create an empty advancement tab where there are no advancements visible and no lines visible, when the tab only has a hidden advancement as a root |
void |
unloadProgress(java.util.UUID uuid) |
Unloads the progress for all advancements in the manager
Does not work for Online Players! |
void |
unloadProgress(java.util.UUID uuid,
Advancement... advancements) |
Unloads the progress for the given advancements
Does not work for Online Players! |
void |
unloadProgress(java.util.UUID uuid,
java.lang.String namespace) |
Unloads the progress for all advancements in the manager with a specified namespace
Does not work for Online Players! |
void |
update(org.bukkit.entity.Player player) |
Updates/Refreshes the player
|
void |
update(org.bukkit.entity.Player player,
NameKey tab) |
Updates/Refreshes the player
|
void |
updateAllPossiblyAffectedVisibilities(org.bukkit.entity.Player player,
Advancement from) |
Updates all possibly affected visibilities for all parents and childs
|
void |
updateProgress(org.bukkit.entity.Player player,
Advancement... advancementsUpdated) |
Updates advancement progress for a player
|
void |
updateVisibility(org.bukkit.entity.Player player,
Advancement advancement) |
Updates the visibility
|
public AdvancementManager(org.bukkit.entity.Player... players)
players
- All players that should be in the new manager from the start, can be changed at any timepublic static AdvancementManager getAccessibleManager(java.lang.String name)
name
- public static java.util.Collection<AdvancementManager> getAccessibleManagers()
public void setHiddenBoolean(boolean hiddenBoolean)
AdvancementVisibility
)hiddenBoolean
- The new hiddenBooleanpublic boolean getHiddenBoolean()
public void setCriterionPrefix(java.lang.String criterionPrefix)
criterionPrefix
- The new prefix that is used for criteriapublic java.lang.String getCriterionPrefix()
public void setCriterionNamespace(java.lang.String criterionNamespace)
criterionNamespace
- The new namespace that is used for the Namespaced Key for criteriapublic java.lang.String getCriterionNamespace()
public void setCriterionKey(java.lang.String criterionKey)
criterionKey
- The new key that is used for the Namespaced Key for criteriapublic java.lang.String getCriterionKey()
@Deprecated(since="1.13.10") public static AdvancementManager getNewAdvancementManager(org.bukkit.entity.Player... players)
players
- All players that should be in the new manager from the start, can be changed at any timepublic java.util.ArrayList<org.bukkit.entity.Player> getPlayers()
public void addPlayer(org.bukkit.entity.Player player)
player
- Player to addpublic void removePlayer(org.bukkit.entity.Player player)
player
- Player to removepublic void addAdvancement(Advancement... advancementsAdded)
advancementsAdded
- An array of all advancements that should be addedpublic void removeAdvancement(Advancement... advancementsRemoved)
advancementsRemoved
- An array of advancements that should be removedpublic void update(org.bukkit.entity.Player player)
player
- Player to updatepublic void update(org.bukkit.entity.Player player, NameKey tab)
player
- Player to updatetab
- Tab to updatepublic void updateProgress(org.bukkit.entity.Player player, Advancement... advancementsUpdated)
player
- Player to updateadvancementsUpdated
- An array of advancement to update progresspublic void updateAllPossiblyAffectedVisibilities(org.bukkit.entity.Player player, Advancement from)
player
- Player to updatefrom
- Advancement to check frompublic void updateVisibility(org.bukkit.entity.Player player, Advancement advancement)
player
- Player to updateadvancement
- Advancement to updatepublic java.util.ArrayList<Advancement> getAdvancements()
public java.util.ArrayList<Advancement> getAdvancements(java.lang.String namespace)
namespace
- Namespace to checkpublic Advancement getAdvancement(NameKey name)
name
- Name to checkpublic void displayMessage(org.bukkit.entity.Player player, Advancement advancement)
player
- Player which has received an advancementadvancement
- Advancement Player has receivedpublic boolean isAnnounceAdvancementMessages()
public void setAnnounceAdvancementMessages(boolean announceAdvancementMessages)
announceAdvancementMessages
- public void makeAccessible(java.lang.String name)
name
- Unique Name, case insensitivepublic void resetAccessible()
public java.lang.String getName()
public void grantAdvancement(org.bukkit.entity.Player player, Advancement advancement)
player
- Recieveradvancement
- Advancement to grantpublic void grantAdvancement(java.util.UUID uuid, Advancement advancement)
uuid
- Receiver UUIDadvancement
- Advancement to grantpublic void revokeAdvancement(org.bukkit.entity.Player player, Advancement advancement)
player
- Receiveradvancement
- Advancement to revokepublic void revokeAdvancement(java.util.UUID uuid, Advancement advancement)
uuid
- Receiver UUIDadvancement
- Advancement to revokepublic void grantCriteria(org.bukkit.entity.Player player, Advancement advancement, java.lang.String... criteria)
player
- Receiveradvancement
- criteria
- Array of criteria to grantpublic void grantCriteria(java.util.UUID uuid, Advancement advancement, java.lang.String... criteria)
uuid
- advancement
- criteria
- public void revokeCriteria(org.bukkit.entity.Player player, Advancement advancement, java.lang.String... criteria)
player
- Receiveradvancement
- criteria
- Array of criteria to revokepublic void revokeCriteria(java.util.UUID uuid, Advancement advancement, java.lang.String... criteria)
uuid
- Receiver UUIDadvancement
- criteria
- Array of criteria to revokepublic void setCriteriaProgress(org.bukkit.entity.Player player, Advancement advancement, int progress)
player
- Receiveradvancement
- progress
- public void setCriteriaProgress(java.util.UUID uuid, Advancement advancement, int progress)
uuid
- Receiver UUIDadvancement
- progress
- public int getCriteriaProgress(org.bukkit.entity.Player player, Advancement advancement)
player
- advancement
- public int getCriteriaProgress(java.util.UUID uuid, Advancement advancement)
uuid
- advancement
- public java.lang.String getProgressJSON(org.bukkit.entity.Player player)
player
- Player to checkpublic java.lang.String getProgressJSON(org.bukkit.entity.Player player, java.lang.String namespace)
player
- Player to checknamespace
- Namespace to checkpublic void saveProgress(org.bukkit.entity.Player player, java.lang.String namespace)
player
- Player to checknamespace
- Namespace to checkpublic void loadProgress(org.bukkit.entity.Player player, java.lang.String namespace)
player
- Player to checknamespace
- Namespace to checkpublic void loadProgress(org.bukkit.entity.Player player, Advancement... advancementsLoaded)
player
- Player to checkadvancementsLoaded
- Array of advancements to check, all advancements which arent in the same namespace as the first one will be ignoredpublic void loadCustomProgress(org.bukkit.entity.Player player, java.lang.String json, Advancement... advancementsLoaded)
player
- Player to checkjson
- JSON String to load fromadvancementsLoaded
- Array of advancements to checkpublic void loadCustomProgress(org.bukkit.entity.Player player, java.lang.String json)
player
- Player to checkjson
- JSON String to load frompublic void loadCustomProgress(org.bukkit.entity.Player player, java.lang.String json, java.lang.String namespace)
player
- Player to checkjson
- JSON String to load fromnamespace
- Namespace to checkpublic java.lang.String getProgressJSON(java.util.UUID uuid)
uuid
- Player UUID to checkpublic java.lang.String getProgressJSON(java.util.UUID uuid, java.lang.String namespace)
uuid
- Player UUID to checknamespace
- Namespace to checkpublic void saveProgress(java.util.UUID uuid, java.lang.String namespace)
uuid
- Player UUID to checknamespace
- Namespace to check@Deprecated public void loadProgress(java.util.UUID uuid, java.lang.String namespace)
uuid
- Player UUID to checknamespace
- Namespace to check@Deprecated public void loadProgress(java.util.UUID uuid, Advancement... advancementsLoaded)
uuid
- Player UUID to checkadvancementsLoaded
- Array of advancements to check, all advancements which arent in the same namespace as the first one will be ignored@Deprecated public void loadCustomProgress(java.util.UUID uuid, java.lang.String json, Advancement... advancementsLoaded)
uuid
- Player UUID to checkjson
- JSON String to load fromadvancementsLoaded
- Array of advancements to check@Deprecated public void loadCustomProgress(java.util.UUID uuid, java.lang.String json)
uuid
- Player UUID to checkjson
- JSON String to load from@Deprecated public void loadCustomProgress(java.util.UUID uuid, java.lang.String json, java.lang.String namespace)
uuid
- Player UUID to checkjson
- JSON String to load fromnamespace
- Namespace to checkpublic void unloadProgress(java.util.UUID uuid)
uuid
- Affected Player UUIDpublic void unloadProgress(java.util.UUID uuid, java.lang.String namespace)
uuid
- Affected Player UUIDnamespace
- Specific Namespacepublic void unloadProgress(java.util.UUID uuid, Advancement... advancements)
uuid
- Affected Player UUIDadvancements
- Specific Advancements