Load parties before trying to do anything with them

This commit is contained in:
bm01 2013-02-09 15:42:02 +01:00
parent d50123085f
commit 98bb865062

View File

@ -309,6 +309,9 @@ public class mcMMO extends JavaPlugin {
private void scheduleTasks() { private void scheduleTasks() {
BukkitScheduler scheduler = getServer().getScheduler(); BukkitScheduler scheduler = getServer().getScheduler();
// Parties are loaded at the end of first server tick otherwise Server.getOfflinePlayer throws an IndexOutOfBoundsException
scheduler.scheduleSyncDelayedTask(this, new PartiesLoader(), 0);
// Periodic save timer (Saves every 10 minutes by default) // Periodic save timer (Saves every 10 minutes by default)
scheduler.scheduleSyncRepeatingTask(this, new SaveTimer(), 0, Config.getInstance().getSaveInterval() * 1200L); scheduler.scheduleSyncRepeatingTask(this, new SaveTimer(), 0, Config.getInstance().getSaveInterval() * 1200L);
// Regen & Cooldown timer (Runs every second) // Regen & Cooldown timer (Runs every second)
@ -335,9 +338,6 @@ public class mcMMO extends JavaPlugin {
else if (kickInterval > 0) { else if (kickInterval > 0) {
scheduler.scheduleSyncRepeatingTask(this, new PartyAutoKick(), 0, kickInterval * 60L * 60L * 20L); scheduler.scheduleSyncRepeatingTask(this, new PartyAutoKick(), 0, kickInterval * 60L * 60L * 20L);
} }
// Parties are loaded at the end of first server tick otherwise Server.getOfflinePlayer throws an IndexOutOfBoundsException
scheduler.scheduleSyncDelayedTask(this, new PartiesLoader(), 0);
} }
private void setupMetrics() { private void setupMetrics() {