2012-03-30 03:44:30 +02:00
|
|
|
package com.gmail.nossr50.runnables;
|
|
|
|
|
|
|
|
import org.getspout.spoutapi.SpoutManager;
|
2012-06-28 06:50:47 +02:00
|
|
|
import org.getspout.spoutapi.event.spout.SpoutCraftEnableEvent;
|
2012-03-30 03:44:30 +02:00
|
|
|
import org.getspout.spoutapi.player.FileManager;
|
2012-06-28 06:50:47 +02:00
|
|
|
import org.getspout.spoutapi.player.SpoutPlayer;
|
2012-03-30 03:44:30 +02:00
|
|
|
|
2012-06-07 00:02:22 +02:00
|
|
|
import com.gmail.nossr50.mcMMO;
|
2012-05-23 16:50:47 +02:00
|
|
|
import com.gmail.nossr50.config.SpoutConfig;
|
2012-03-30 03:44:30 +02:00
|
|
|
import com.gmail.nossr50.spout.SpoutStuff;
|
|
|
|
|
|
|
|
public class SpoutStart implements Runnable{
|
2012-06-07 00:02:22 +02:00
|
|
|
private final mcMMO plugin;
|
2012-04-01 06:11:57 +02:00
|
|
|
|
2012-06-07 00:02:22 +02:00
|
|
|
public SpoutStart(final mcMMO plugin) {
|
2012-04-21 00:09:50 +02:00
|
|
|
this.plugin = plugin;
|
2012-03-30 03:44:30 +02:00
|
|
|
}
|
2012-04-01 06:11:57 +02:00
|
|
|
|
2012-03-30 03:44:30 +02:00
|
|
|
@Override
|
|
|
|
public void run() {
|
2012-04-21 00:09:50 +02:00
|
|
|
if (plugin.getServer().getPluginManager().getPlugin("Spout") != null) {
|
2012-06-07 00:02:22 +02:00
|
|
|
mcMMO.spoutEnabled = true;
|
2012-03-30 03:44:30 +02:00
|
|
|
}
|
|
|
|
else {
|
2012-06-07 00:02:22 +02:00
|
|
|
mcMMO.spoutEnabled = false;
|
2012-03-30 03:44:30 +02:00
|
|
|
}
|
2012-04-01 06:11:57 +02:00
|
|
|
|
2012-03-30 03:44:30 +02:00
|
|
|
//Spout Stuff
|
2012-06-07 00:02:22 +02:00
|
|
|
if (mcMMO.spoutEnabled) {
|
2012-05-24 06:18:43 +02:00
|
|
|
SpoutConfig.getInstance();
|
2012-03-30 03:44:30 +02:00
|
|
|
SpoutStuff.setupSpoutConfigs();
|
|
|
|
SpoutStuff.registerCustomEvent();
|
|
|
|
SpoutStuff.extractFiles(); //Extract source materials
|
|
|
|
|
|
|
|
FileManager FM = SpoutManager.getFileManager();
|
|
|
|
FM.addToPreLoginCache(plugin, SpoutStuff.getFiles());
|
2012-06-28 06:50:47 +02:00
|
|
|
|
|
|
|
//Handle spout players after a /reload
|
|
|
|
for (SpoutPlayer spoutPlayer : SpoutManager.getPlayerManager().getOnlinePlayers()) {
|
|
|
|
SpoutCraftEnableEvent spoutCraftEnableEvent = new SpoutCraftEnableEvent(spoutPlayer);
|
|
|
|
mcMMO.p.getServer().getPluginManager().callEvent(spoutCraftEnableEvent);
|
|
|
|
}
|
2012-03-30 03:44:30 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|