CA Update 1.6 - Huge Update to Advancement Visibility
In this update, a huge overhaul to Advancement Visibility (before: boolean hidden) has been done. You can now use one of the pre-made Visibilties (ALWAYS, PARENT_GRANTED, VANILLA, HIDDEN) or create custom visibilities that can rely on any code you have in your plugin.
The following changes have been done:
- Added abstract class
AdvancementVisibility, which you can create a new instance of and override the isVisible(Player player, Advancement advancement) method to create custom visibilities.
- All current constructors of AdvancementDisplay are now
Deprecated and will be removed in a version in the near future. the new constructors are almost the same as the old ones but they don't allow a boolean for hidden anymore but an AdvancementVisibility to set when it should be visible. For the time being, hidden=true will set it to AdvancementVisibility.HIDDEN and hidden=false will set it to AdvancementVisibility.ALWAYS (same behavior as in previous versions)
- Added
AdvancementManager#updateAllPossiblyAffectedVisibilities(Player player, Advancement from) which will update all parents, their parents and all childs and their childs (etc...) if their isVisible changed
- Added
AdvancementManager#updateVisibility(Player player, Advancement advancement) which updates the visibility of the selected advancement
- Added Methods to Advancement regarding parents and children
- Changed some Methods that still used MinecraftKey to use NameKey instead
NOTE: These Changes also affect the JSON-saving/loading of advancements, so if you use file-based advancement loading, have a look on the main page to see how you have to create them now