Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pl3xMapEnabledEvent gets called too early #23

Closed
gjorgdy opened this issue Feb 4, 2024 · 1 comment
Closed

Pl3xMapEnabledEvent gets called too early #23

gjorgdy opened this issue Feb 4, 2024 · 1 comment

Comments

@gjorgdy
Copy link

gjorgdy commented Feb 4, 2024

I'm trying to load in markers on start with this event, but when the event is called. The WorldRegistry (Pl3xMap.api().getWorldRegistry()) is still empty. Meaning I can't make a layer and thus not register markers.

Main class;

@Override
public void onInitializeServer() {
	ServerLifecycleEvents.SERVER_STARTING.register(server -> {
		SERVER = server;
		Pl3xMap.api().getEventRegistry().register(new Pl3xMapStart());
	});
}

Event;

private static class Pl3xMapStart implements EventListener {
	@EventHandler
	public void onEnable(Pl3xMapEnabledEvent event) {
			// initialize manager
			MARKER_MANAGER.loadLodestones(); // this creates markers and tries to register them
		}
	}
}```
@granny
Copy link
Owner

granny commented Feb 4, 2024

WorldLoadedEvent and WorldUnloadedEvent Pl3xMap events exist for this reason. You can register/unregister your layers through those events.

@granny granny closed this as completed Feb 4, 2024
@granny granny closed this as not planned Won't fix, can't repro, duplicate, stale Feb 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants