diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index 7ddbe4e32..e0c342bea 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -79,6 +79,6 @@ object Versions { } object Allay { - const val api = "1cb3bb69c6" + const val api = "0114e0b290" } } \ No newline at end of file diff --git a/platforms/allay/src/main/java/com/dfsek/terra/allay/TerraAllayPlugin.java b/platforms/allay/src/main/java/com/dfsek/terra/allay/TerraAllayPlugin.java index 330d6c377..b1bcc7eab 100644 --- a/platforms/allay/src/main/java/com/dfsek/terra/allay/TerraAllayPlugin.java +++ b/platforms/allay/src/main/java/com/dfsek/terra/allay/TerraAllayPlugin.java @@ -1,11 +1,15 @@ package com.dfsek.terra.allay; +import org.allaymc.api.eventbus.EventHandler; +import org.allaymc.api.eventbus.event.world.WorldUnloadEvent; import org.allaymc.api.plugin.Plugin; import org.allaymc.api.registry.Registries; +import org.allaymc.api.server.Server; import com.dfsek.terra.allay.generator.AllayGeneratorWrapper; import com.dfsek.terra.api.event.events.platform.PlatformInitializationEvent; + /** * @author daoge_cmd */ @@ -46,6 +50,11 @@ public void onLoad() { pluginLogger.info("Terra started"); } + @Override + public void onEnable() { + Server.getInstance().getEventBus().registerListener(this); + } + @Override public boolean isReloadable() { return true; @@ -59,4 +68,9 @@ public void reload() { pluginLogger.error("Terra failed to reload."); } } + + @EventHandler + private void onWorldUnload(WorldUnloadEvent event) { + AllayPlatform.GENERATOR_WRAPPERS.removeIf(wrapper -> wrapper.getAllayWorldGenerator().getDimension().getWorld() == event.getWorld()); + } }