Fix late registration of join listener (#3360)

This commit is contained in:
Pablo Herrera 2023-06-19 17:02:05 +02:00 committed by GitHub
parent a817746edc
commit e32933ada9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -103,6 +103,12 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaPlatform<Player>
manager.init();
}
if (Via.getConfig().shouldRegisterUserConnectionOnJoin()) {
// When event priority ties, registration order is used.
// Must register without delay to ensure other plugins on lowest get the fix applied.
getServer().getPluginManager().registerEvents(new JoinListener(), this);
}
if (FOLIA) {
// Use Folia's RegionizedServerInitEvent to run code after the server has loaded
final Class<? extends Event> serverInitEventClass;

View File

@ -79,10 +79,6 @@ public class BukkitViaLoader implements ViaPlatformLoader {
public void load() {
registerListener(new UpdateListener());
if (Via.getConfig().shouldRegisterUserConnectionOnJoin()) {
registerListener(new JoinListener());
}
/* Base Protocol */
final ViaVersionPlugin plugin = (ViaVersionPlugin) Bukkit.getPluginManager().getPlugin("ViaVersion");