mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2025-02-23 02:52:38 +01:00
Refactor code
This commit is contained in:
parent
38a9463016
commit
5f8a5d37e4
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2016-2018 GeorgH93
|
||||
* Copyright (C) 2019 GeorgH93
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -25,6 +25,7 @@
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@ -33,12 +34,13 @@ public class ItemsCollector extends BukkitRunnable
|
||||
{
|
||||
private final Minepacks plugin;
|
||||
private final double radius;
|
||||
private final BukkitTask task;
|
||||
|
||||
public ItemsCollector(Minepacks plugin)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
this.radius = plugin.getConfiguration().getFullInvRadius();
|
||||
runTaskTimer(plugin, plugin.getConfiguration().getFullInvCheckInterval(), plugin.getConfiguration().getFullInvCheckInterval());
|
||||
task = runTaskTimer(plugin, plugin.getConfiguration().getFullInvCheckInterval(), plugin.getConfiguration().getFullInvCheckInterval());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -79,4 +81,9 @@ public void run()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void close()
|
||||
{
|
||||
task.cancel();
|
||||
}
|
||||
}
|
@ -200,13 +200,14 @@ private void load()
|
||||
|
||||
private void unload()
|
||||
{
|
||||
if(collector != null) collector.close();
|
||||
commandManager.close();
|
||||
if(collector != null) collector.cancel();
|
||||
if(database != null) database.close(); // Close the DB connection, we won't need them any longer
|
||||
HandlerList.unregisterAll(this); // Stop the listeners
|
||||
getServer().getScheduler().cancelTasks(this); // Kill all running task
|
||||
if(cooldownManager != null) cooldownManager.close();
|
||||
cooldownManager = null;
|
||||
getServer().getScheduler().cancelTasks(this); // Kill all running task
|
||||
}
|
||||
|
||||
public void reload()
|
||||
|
@ -1,2 +1,2 @@
|
||||
The munge-maven-plugin requiers a test source folder.
|
||||
The munge-maven-plugin requires a test source folder.
|
||||
There currently are no tests so this file is here instead.
|
Loading…
Reference in New Issue
Block a user