use event API for registration of Bukkit trees

This commit is contained in:
dfsek
2021-02-16 12:57:35 -07:00
parent 48296fb14a
commit 06cd1dc562
4 changed files with 26 additions and 20 deletions

View File

@@ -7,7 +7,6 @@ import com.dfsek.terra.api.platform.handle.WorldHandle;
import com.dfsek.terra.api.platform.world.World;
import com.dfsek.terra.config.PluginConfig;
import com.dfsek.terra.config.lang.Language;
import com.dfsek.terra.config.pack.ConfigPack;
import com.dfsek.terra.debug.DebugLogger;
import com.dfsek.terra.registry.ConfigRegistry;
import com.dfsek.terra.world.TerraWorld;
@@ -42,13 +41,6 @@ public interface TerraPlugin extends LoaderRegistrar {
String platformName();
default void packPreLoadCallback(ConfigPack pack) {
}
default void packPostLoadCallback(ConfigPack pack) {
}
DebugLogger getDebugLogger();

View File

@@ -198,7 +198,7 @@ public class ConfigPack implements LoaderRegistrar {
private void load(long start, TerraPlugin main) throws ConfigException {
main.getEventManager().callEvent(new ConfigPackPreLoadEvent(this));
main.packPreLoadCallback(this);
for(Map.Entry<String, Double> var : template.getVariables().entrySet()) {
varScope.create(var.getKey(), var.getValue());
}
@@ -230,7 +230,6 @@ public class ConfigPack implements LoaderRegistrar {
.open("structures/structures", ".yml").then(streams -> buildAll(new StructureFactory(), structureRegistry, abstractConfigLoader.load(streams, StructureTemplate::new), main)).close()
.open("flora", ".yml").then(streams -> buildAll(new FloraFactory(), floraRegistry, abstractConfigLoader.load(streams, FloraTemplate::new), main)).close()
.open("biomes", ".yml").then(streams -> buildAll(new BiomeFactory(this), biomeRegistry, abstractConfigLoader.load(streams, () -> new BiomeTemplate(this, main)), main)).close();
main.packPostLoadCallback(this);
main.getEventManager().callEvent(new ConfigPackPostLoadEvent(this));
LangUtil.log("config-pack.loaded", Level.INFO, template.getID(), String.valueOf((System.nanoTime() - start) / 1000000D), template.getAuthor(), template.getVersion());