Simple question: can I unlaod a class without restarting the server, and how? Loading a class: Code: public void onEnable() { Bukkit.getPluginManager().registerEvents(new Spawner(), this); } Any help is awesome, thanks
Meatiex If you're looking to get rid of the instance, you could unregister the listener you created via these methods: https://forums.bukkit.org/threads/unregistering-of-events.60817/ Once there is no longer a reference to your Spawner object, it will be automatically collected. If you're wishing to actually unload the class, i.e. completely unload everything associated with the class (the bytecode and static objects), you would actually have to null reference the class loaded that loaded it, way more trouble than whatever you're doing is worth: http://stackoverflow.com/questions/148681/unloading-classes-in-java
I have some code that makes it so you can push players, it lags a lot with a lot of people online, I want to unlaod the class when more than 30 people are online. I could make a if statement and a boolean, but that would still have slightly more lag than unloading it. I'll try to unload it with the link provided by mythbusterma, thanks
This is sorta a dum question, but how would I define listener? Code:java Plugin plugin = plugin; HandlerList.unregisterAll(listiner); // unregister listener from any events it is registered for PlayerMoveEvent.getHandlerList().unregister(plugin); // unregister listeners owned by plugin from PlayerMoveEvent
Meatiex Give it your best shot. This is very basic coding skills. You should know how to create variables and assign values to them.