Attempt to fix IOOBException due getOfflinePlayer at server startup

This commit is contained in:
bm01 2013-02-09 15:16:57 +01:00
parent 317a39177b
commit b628b9eb4d
2 changed files with 16 additions and 1 deletions

View File

@ -52,6 +52,7 @@ import com.gmail.nossr50.skills.repair.RepairManagerFactory;
import com.gmail.nossr50.skills.repair.Repairable; import com.gmail.nossr50.skills.repair.Repairable;
import com.gmail.nossr50.skills.repair.config.RepairConfigManager; import com.gmail.nossr50.skills.repair.config.RepairConfigManager;
import com.gmail.nossr50.skills.runnables.BleedTimer; import com.gmail.nossr50.skills.runnables.BleedTimer;
import com.gmail.nossr50.skills.runnables.PartiesLoader;
import com.gmail.nossr50.skills.runnables.PartyAutoKick; import com.gmail.nossr50.skills.runnables.PartyAutoKick;
import com.gmail.nossr50.skills.runnables.SkillMonitor; import com.gmail.nossr50.skills.runnables.SkillMonitor;
import com.gmail.nossr50.spout.SpoutConfig; import com.gmail.nossr50.spout.SpoutConfig;
@ -206,7 +207,8 @@ public class mcMMO extends JavaPlugin {
TreasuresConfig.getInstance(); TreasuresConfig.getInstance();
HiddenConfig.getInstance(); HiddenConfig.getInstance();
AdvancedConfig.getInstance(); AdvancedConfig.getInstance();
PartyManager.loadParties();
List<Repairable> repairables = new ArrayList<Repairable>(); List<Repairable> repairables = new ArrayList<Repairable>();
@ -333,6 +335,9 @@ 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() {

View File

@ -0,0 +1,10 @@
package com.gmail.nossr50.skills.runnables;
import com.gmail.nossr50.party.PartyManager;
public class PartiesLoader implements Runnable {
@Override
public void run() {
PartyManager.loadParties();
}
}