use of org.lanternpowered.server.game.registry.type.advancement.AdvancementRegistryModule in project LanternServer by LanternPowered.
the class LanternAdvancementTreeBuilder method rootAdvancement.
@Override
public AdvancementTree.Builder rootAdvancement(Advancement rootAdvancement) {
checkNotNull(rootAdvancement, "rootAdvancement");
final AdvancementRegistryModule registry = AdvancementRegistryModule.get();
checkState(rootAdvancement.equals(registry.getById(rootAdvancement.getId()).orElse(null)), "The root advancement must be registered.");
checkState(!rootAdvancement.getParent().isPresent(), "The root advancement cannot have a parent.");
checkState(rootAdvancement.getDisplayInfo().isPresent(), "The root advancement must have display info.");
checkState(!rootAdvancement.getTree().isPresent(), "The root advancement is already used by a different Advancement Tree.");
this.rootAdvancement = rootAdvancement;
return this;
}
use of org.lanternpowered.server.game.registry.type.advancement.AdvancementRegistryModule in project LanternServer by LanternPowered.
the class LanternPlayerAdvancements method init0.
private void init0() {
cleanup();
// Load all the advancements into this progress tracker
final AdvancementRegistryModule registryModule = AdvancementRegistryModule.get();
for (Advancement advancement : registryModule.getAll()) {
final LanternAdvancementProgress progress = get(advancement);
// Update the visibility
progress.dirtyVisibility = true;
this.dirtyProgress.add(progress);
}
}
Aggregations