mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-19 11:02:33 +00:00
Better handling of internal addon
This commit is contained in:
parent
8a61571ceb
commit
428bf341ef
@ -108,7 +108,7 @@ public abstract class AbstractPlatform implements Platform {
|
|||||||
return Collections.emptySet();
|
return Collections.emptySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void load() {
|
protected InternalAddon load() {
|
||||||
if(LOADED.get()) {
|
if(LOADED.get()) {
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
"Someone tried to initialize Terra, but Terra has already initialized. This is most likely due to a broken platform " +
|
"Someone tried to initialize Terra, but Terra has already initialized. This is most likely due to a broken platform " +
|
||||||
@ -159,6 +159,8 @@ public abstract class AbstractPlatform implements Platform {
|
|||||||
|
|
||||||
logger.info("Terra addons successfully loaded.");
|
logger.info("Terra addons successfully loaded.");
|
||||||
logger.info("Finished initialization.");
|
logger.info("Finished initialization.");
|
||||||
|
|
||||||
|
return internalAddon;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected InternalAddon loadAddons() {
|
protected InternalAddon loadAddons() {
|
||||||
|
@ -53,13 +53,6 @@ public class NMSPlatform extends PlatformImpl {
|
|||||||
public NMSPlatform(TerraBukkitPlugin plugin) {
|
public NMSPlatform(TerraBukkitPlugin plugin) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
|
|
||||||
// TODO: Check if there is a better way to handle InternalAddon
|
|
||||||
this.getEventManager().getHandler(FunctionalEventHandler.class)
|
|
||||||
.register(new InternalAddon(), PlatformInitializationEvent.class)
|
|
||||||
.priority(1)
|
|
||||||
.then(event -> AwfulBukkitHacks.registerBiomes(this.getRawConfigRegistry()))
|
|
||||||
.global();
|
|
||||||
|
|
||||||
Bukkit.getPluginManager().registerEvents(new NMSInjectListener(), plugin);
|
Bukkit.getPluginManager().registerEvents(new NMSInjectListener(), plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,6 +88,19 @@ public class NMSPlatform extends PlatformImpl {
|
|||||||
.registerLoader(VillagerType.class, VillagerTypeTemplate::new);
|
.registerLoader(VillagerType.class, VillagerTypeTemplate::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected InternalAddon load() {
|
||||||
|
InternalAddon internalAddon = super.load();
|
||||||
|
|
||||||
|
this.getEventManager().getHandler(FunctionalEventHandler.class)
|
||||||
|
.register(internalAddon, PlatformInitializationEvent.class)
|
||||||
|
.priority(1)
|
||||||
|
.then(event -> AwfulBukkitHacks.registerBiomes(this.getRawConfigRegistry()))
|
||||||
|
.global();
|
||||||
|
|
||||||
|
return internalAddon;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Iterable<BaseAddon> platformAddon() {
|
protected Iterable<BaseAddon> platformAddon() {
|
||||||
return List.of(new NMSAddon(this));
|
return List.of(new NMSAddon(this));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user