Fixed Spout not being able to precache our resources properly, and

therefore making our XP bars fail. Fixes #587
This commit is contained in:
GJ
2013-01-30 00:08:19 -05:00
parent 74d9fa422f
commit bfa29cbf02
4 changed files with 25 additions and 20 deletions

View File

@ -1,35 +1,16 @@
package com.gmail.nossr50.spout;
import org.getspout.spoutapi.SpoutManager;
import org.getspout.spoutapi.player.FileManager;
import com.gmail.nossr50.mcMMO;
public class SpoutStart implements Runnable{
private final mcMMO plugin;
public SpoutStart(final mcMMO plugin) {
this.plugin = plugin;
}
@Override
public void run() {
if (plugin.getServer().getPluginManager().getPlugin("Spout") != null) {
mcMMO.spoutEnabled = true;
}
else {
mcMMO.spoutEnabled = false;
}
//Spout Stuff
if (mcMMO.spoutEnabled) {
SpoutConfig.getInstance();
SpoutStuff.setupSpoutConfigs();
SpoutStuff.registerCustomEvent();
SpoutStuff.extractFiles(); //Extract source materials
FileManager FM = SpoutManager.getFileManager();
FM.addToPreLoginCache(plugin, SpoutStuff.getFiles());
//Handle spout players after a /reload
SpoutStuff.reloadSpoutPlayers();

View File

@ -16,6 +16,7 @@ import org.bukkit.entity.Player;
import org.getspout.spoutapi.SpoutManager;
import org.getspout.spoutapi.event.spout.SpoutCraftEnableEvent;
import org.getspout.spoutapi.keyboard.Keyboard;
import org.getspout.spoutapi.player.FileManager;
import org.getspout.spoutapi.player.SpoutPlayer;
import com.gmail.nossr50.mcMMO;
@ -592,4 +593,22 @@ public class SpoutStuff {
mcMMO.p.getServer().getPluginManager().callEvent(spoutCraftEnableEvent);
}
}
public static void setSpoutEnabled() {
if (plugin.getServer().getPluginManager().getPlugin("Spout") != null) {
mcMMO.spoutEnabled = true;
}
else {
mcMMO.spoutEnabled = false;
}
}
public static void preCacheFiles() {
if (mcMMO.spoutEnabled) {
extractFiles(); //Extract source materials
FileManager FM = SpoutManager.getFileManager();
FM.addToPreLoginCache(plugin, getFiles());
}
}
}