Search in sources :

Example 1 with AdvancementRegistryModule

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;
}
Also used : AdvancementRegistryModule(org.lanternpowered.server.game.registry.type.advancement.AdvancementRegistryModule)

Example 2 with AdvancementRegistryModule

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);
    }
}
Also used : Advancement(org.spongepowered.api.advancement.Advancement) AdvancementRegistryModule(org.lanternpowered.server.game.registry.type.advancement.AdvancementRegistryModule)

Aggregations

AdvancementRegistryModule (org.lanternpowered.server.game.registry.type.advancement.AdvancementRegistryModule)2 Advancement (org.spongepowered.api.advancement.Advancement)1