Improve softreload

This commit is contained in:
2025-10-30 16:29:57 +01:00
parent 6d8c765483
commit 62c41cdda8
2 changed files with 19 additions and 0 deletions
@@ -45,6 +45,7 @@ import de.steamwar.velocitycore.commands.ServerSwitchCommand;
import de.steamwar.velocitycore.commands.TeamCommand;
import de.steamwar.velocitycore.discord.DiscordBot;
import de.steamwar.velocitycore.discord.DiscordConfig;
import de.steamwar.velocitycore.listeners.BasicListener;
import de.steamwar.velocitycore.listeners.PollSystem;
import lombok.Getter;
import lombok.NonNull;
@@ -171,6 +172,16 @@ public class VelocityCore implements ReloadablePlugin {
((PacketHandler) any).register();
}
}
@Override
protected void unlinkObject(Object any) {
if (any instanceof PacketHandler) {
((PacketHandler) any).unregister();
}
if (any instanceof BasicListener) {
VelocityCore.getProxy().getEventManager().unregisterListener(instance, any);
}
}
};
try {
linker.link();