mirror of
https://github.com/taoneill/war.git
synced 2024-11-23 18:55:28 +01:00
Server reload isn't broken anymore: now removing Spout widgets at Spout plugin disable-time, since Spout was already gone by the time War was getting disabled and tried to remove them.
This commit is contained in:
parent
1bae53670e
commit
589d197bf1
@ -61,6 +61,8 @@ public class War extends JavaPlugin {
|
||||
private WarPlayerListener playerListener = new WarPlayerListener();
|
||||
private WarEntityListener entityListener = new WarEntityListener();
|
||||
private WarBlockListener blockListener = new WarBlockListener();
|
||||
private WarServerListener pluginListener = new WarServerListener();
|
||||
|
||||
private WarCommandHandler commandHandler = new WarCommandHandler();
|
||||
private Logger logger;
|
||||
private PluginDescriptionFile desc = null;
|
||||
@ -158,6 +160,8 @@ public class War extends JavaPlugin {
|
||||
pm.registerEvent(Event.Type.BLOCK_PISTON_EXTEND, this.blockListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.BLOCK_PISTON_RETRACT, this.blockListener, Priority.Normal, this);
|
||||
|
||||
pm.registerEvent(Event.Type.PLUGIN_DISABLE, this.pluginListener, Priority.Normal, this);
|
||||
|
||||
if (this.isSpoutServer()) {
|
||||
pm.registerEvent(Event.Type.CUSTOM_EVENT, new WarSpoutListener(this), Priority.Low, this);
|
||||
}
|
||||
@ -265,15 +269,6 @@ public class War extends JavaPlugin {
|
||||
* Cleans up war
|
||||
*/
|
||||
public void unloadWar() {
|
||||
if (this.isSpoutServer()) {
|
||||
for (Player player : getServer().getOnlinePlayers()) {
|
||||
SpoutPlayer sp = (SpoutPlayer) player;
|
||||
if (sp.isSpoutCraftEnabled()) {
|
||||
sp.getMainScreen().removeWidgets(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Warzone warzone : this.warzones) {
|
||||
warzone.unload();
|
||||
}
|
||||
|
@ -0,0 +1,27 @@
|
||||
package bukkit.tommytony.war;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.server.PluginDisableEvent;
|
||||
import org.bukkit.event.server.ServerListener;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.getspout.spoutapi.player.SpoutPlayer;
|
||||
|
||||
public class WarServerListener extends ServerListener {
|
||||
|
||||
public void onPluginDisable(PluginDisableEvent event) {
|
||||
if (event.getPlugin() instanceof JavaPlugin) {
|
||||
JavaPlugin plugin = (JavaPlugin)event.getPlugin();
|
||||
|
||||
if (plugin.getDataFolder().getName().equals("Spout")) {
|
||||
if (War.war.isSpoutServer()) {
|
||||
for (Player player : War.war.getServer().getOnlinePlayers()) {
|
||||
SpoutPlayer sp = (SpoutPlayer) player;
|
||||
if (sp.isSpoutCraftEnabled()) {
|
||||
sp.getMainScreen().removeWidgets(War.war);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user