mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-01 23:47:50 +00:00
feat: support world unloading
This commit is contained in:
parent
144c932703
commit
16c951838b
@ -79,6 +79,6 @@ object Versions {
|
||||
}
|
||||
|
||||
object Allay {
|
||||
const val api = "1cb3bb69c6"
|
||||
const val api = "0114e0b290"
|
||||
}
|
||||
}
|
@ -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 class TerraAllayPlugin extends Plugin {
|
||||
pluginLogger.info("Terra started");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
Server.getInstance().getEventBus().registerListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReloadable() {
|
||||
return true;
|
||||
@ -59,4 +68,9 @@ public class TerraAllayPlugin extends Plugin {
|
||||
pluginLogger.error("Terra failed to reload.");
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onWorldUnload(WorldUnloadEvent event) {
|
||||
AllayPlatform.GENERATOR_WRAPPERS.removeIf(wrapper -> wrapper.getAllayWorldGenerator().getDimension().getWorld() == event.getWorld());
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user