mcMMO/src/main/java/com/gmail/nossr50/runnables/SpoutStart.java

46 lines
1.5 KiB
Java
Raw Normal View History

package com.gmail.nossr50.runnables;
import org.getspout.spoutapi.SpoutManager;
import org.getspout.spoutapi.event.spout.SpoutCraftEnableEvent;
import org.getspout.spoutapi.player.FileManager;
import org.getspout.spoutapi.player.SpoutPlayer;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.SpoutConfig;
import com.gmail.nossr50.spout.SpoutStuff;
public class SpoutStart implements Runnable{
private final mcMMO plugin;
2012-04-01 06:11:57 +02:00
public SpoutStart(final mcMMO plugin) {
2012-04-21 00:09:50 +02:00
this.plugin = plugin;
}
2012-04-01 06:11:57 +02:00
@Override
public void run() {
2012-04-21 00:09:50 +02:00
if (plugin.getServer().getPluginManager().getPlugin("Spout") != null) {
mcMMO.spoutEnabled = true;
}
else {
mcMMO.spoutEnabled = false;
}
2012-04-01 06:11:57 +02:00
//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
for (SpoutPlayer spoutPlayer : SpoutManager.getPlayerManager().getOnlinePlayers()) {
SpoutCraftEnableEvent spoutCraftEnableEvent = new SpoutCraftEnableEvent(spoutPlayer);
mcMMO.p.getServer().getPluginManager().callEvent(spoutCraftEnableEvent);
}
}
}
}