Don't create a task we'll possibly never run.

This commit is contained in:
GJ 2013-04-30 15:19:41 -04:00
parent 78eb7787e9
commit d85a6bec43

View File

@ -23,8 +23,6 @@ import com.gmail.nossr50.config.mods.CustomToolConfig;
import com.gmail.nossr50.config.spout.SpoutConfig; import com.gmail.nossr50.config.spout.SpoutConfig;
import com.gmail.nossr50.config.treasure.TreasureConfig; import com.gmail.nossr50.config.treasure.TreasureConfig;
import com.gmail.nossr50.database.DatabaseManager; import com.gmail.nossr50.database.DatabaseManager;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.AbilityType;
import com.gmail.nossr50.listeners.BlockListener; import com.gmail.nossr50.listeners.BlockListener;
import com.gmail.nossr50.listeners.EntityListener; import com.gmail.nossr50.listeners.EntityListener;
import com.gmail.nossr50.listeners.InventoryListener; import com.gmail.nossr50.listeners.InventoryListener;
@ -348,36 +346,29 @@ public class mcMMO extends JavaPlugin {
private void scheduleTasks() { private void scheduleTasks() {
// Periodic save timer (Saves every 10 minutes by default) // Periodic save timer (Saves every 10 minutes by default)
long saveIntervalTicks = Config.getInstance().getSaveInterval() * 1200; long saveIntervalTicks = Config.getInstance().getSaveInterval() * 1200;
new SaveTimerTask().runTaskTimer(this, saveIntervalTicks, saveIntervalTicks); new SaveTimerTask().runTaskTimer(this, saveIntervalTicks, saveIntervalTicks);
// Bleed timer (Runs every two seconds) // Bleed timer (Runs every two seconds)
new BleedTimerTask().runTaskTimer(this, 40, 40); new BleedTimerTask().runTaskTimer(this, 40, 40);
// Old & Powerless User remover // Old & Powerless User remover
int purgeInterval = Config.getInstance().getPurgeInterval(); long purgeIntervalTicks = Config.getInstance().getPurgeInterval() * 60 * 60 * 20;
UserPurgeTask userPurgeTask = new UserPurgeTask();
if (purgeInterval == 0) { if (purgeIntervalTicks == 0) {
userPurgeTask.runTaskLater(this, 40); new UserPurgeTask().runTaskLater(this, 40); // Start 2 seconds after startup.
} }
else if (purgeInterval > 0) { else if (purgeIntervalTicks > 0) {
long purgeIntervalTicks = purgeInterval * 60 * 60 * 20; new UserPurgeTask().runTaskTimer(this, purgeIntervalTicks, purgeIntervalTicks);
userPurgeTask.runTaskTimer(this, purgeIntervalTicks, purgeIntervalTicks);
} }
// Automatically remove old members from parties // Automatically remove old members from parties
long kickInterval = Config.getInstance().getAutoPartyKickInterval(); long kickIntervalTicks = Config.getInstance().getAutoPartyKickInterval() * 60 * 60 * 20;
PartyAutoKickTask partyAutoKickTask = new PartyAutoKickTask();
if (kickInterval == 0) { if (kickIntervalTicks == 0) {
partyAutoKickTask.runTaskLater(this, 40); // Start 2 seconds after startup. new PartyAutoKickTask().runTaskLater(this, 40); // Start 2 seconds after startup.
} }
else if (kickInterval > 0) { else if (kickIntervalTicks > 0) {
long kickIntervalTicks = kickInterval * 60 * 60 * 20; new PartyAutoKickTask().runTaskTimer(this, kickIntervalTicks, kickIntervalTicks);
partyAutoKickTask.runTaskTimer(this, kickIntervalTicks, kickIntervalTicks);
} }
} }
} }