Fix memory leak

This commit is contained in:
ceze88 2023-01-25 15:50:41 +01:00
parent f4a7eaac7a
commit efde51034d
3 changed files with 7 additions and 2 deletions

View File

@ -116,6 +116,7 @@ public class UltimateStacker extends SongodaPlugin {
@Override
public void onPluginEnable() {
// Run Songoda Updater
Async.start();
SongodaCore.registerPlugin(this, 16, CompatibleMaterial.IRON_INGOT);
// Setup Config
Settings.setupConfig();

View File

@ -130,9 +130,9 @@ public class EntityStack extends ColdEntityStack {
}
event.getDrops().clear();
plugin.getEntityStackManager().removeStack(event.getEntity());
if (killed.getKiller() == null) return;
plugin.addExp(killed.getKiller(), this);
plugin.getEntityStackManager().removeStack(event.getEntity());
}
private void handleSingleStackDeath(LivingEntity killed, List<Drop> drops, int droppedExp, EntityDeathEvent event) {

View File

@ -5,7 +5,11 @@ import java.util.concurrent.Executors;
public class Async {
private static ExecutorService executor = Executors.newFixedThreadPool(10);
private static ExecutorService executor;
public static void start() {
executor = Executors.newFixedThreadPool(5);
}
public static void run(Runnable runnable) {
executor.execute(runnable);