Cleared team color in Spout player name display when leaving warzone.

This commit is contained in:
taoneill 2012-01-07 12:30:03 -05:00
parent 589d197bf1
commit 6eeb5be673
4 changed files with 12 additions and 17 deletions

View File

@ -22,7 +22,6 @@ import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.getspout.spoutapi.player.SpoutPlayer;
import com.nijiko.permissions.PermissionHandler; import com.nijiko.permissions.PermissionHandler;
import com.nijikokun.bukkit.Permissions.Permissions; import com.nijikokun.bukkit.Permissions.Permissions;
@ -61,7 +60,7 @@ public class War extends JavaPlugin {
private WarPlayerListener playerListener = new WarPlayerListener(); private WarPlayerListener playerListener = new WarPlayerListener();
private WarEntityListener entityListener = new WarEntityListener(); private WarEntityListener entityListener = new WarEntityListener();
private WarBlockListener blockListener = new WarBlockListener(); private WarBlockListener blockListener = new WarBlockListener();
private WarServerListener pluginListener = new WarServerListener(); private WarServerListener serverListener = new WarServerListener();
private WarCommandHandler commandHandler = new WarCommandHandler(); private WarCommandHandler commandHandler = new WarCommandHandler();
private Logger logger; private Logger logger;
@ -160,7 +159,7 @@ public class War extends JavaPlugin {
pm.registerEvent(Event.Type.BLOCK_PISTON_EXTEND, this.blockListener, Priority.Normal, this); 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.BLOCK_PISTON_RETRACT, this.blockListener, Priority.Normal, this);
pm.registerEvent(Event.Type.PLUGIN_DISABLE, this.pluginListener, Priority.Normal, this); pm.registerEvent(Event.Type.PLUGIN_DISABLE, this.serverListener, Priority.Normal, this);
if (this.isSpoutServer()) { if (this.isSpoutServer()) {
pm.registerEvent(Event.Type.CUSTOM_EVENT, new WarSpoutListener(this), Priority.Low, this); pm.registerEvent(Event.Type.CUSTOM_EVENT, new WarSpoutListener(this), Priority.Low, this);

View File

@ -3,24 +3,19 @@ package bukkit.tommytony.war;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.server.PluginDisableEvent; import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.event.server.ServerListener; import org.bukkit.event.server.ServerListener;
import org.bukkit.plugin.java.JavaPlugin;
import org.getspout.spoutapi.player.SpoutPlayer; import org.getspout.spoutapi.player.SpoutPlayer;
public class WarServerListener extends ServerListener { public class WarServerListener extends ServerListener {
public void onPluginDisable(PluginDisableEvent event) { public void onPluginDisable(PluginDisableEvent event) {
if (event.getPlugin() instanceof JavaPlugin) { if (event.getPlugin().getDataFolder().getName().equals("Spout")) {
JavaPlugin plugin = (JavaPlugin)event.getPlugin(); if (War.war.isSpoutServer()) {
for (Player player : War.war.getServer().getOnlinePlayers()) {
if (plugin.getDataFolder().getName().equals("Spout")) { SpoutPlayer sp = (SpoutPlayer) player;
if (War.war.isSpoutServer()) { if (sp.isSpoutCraftEnabled()) {
for (Player player : War.war.getServer().getOnlinePlayers()) { sp.getMainScreen().removeWidgets(War.war);
SpoutPlayer sp = (SpoutPlayer) player; }
if (sp.isSpoutCraftEnabled()) { }
sp.getMainScreen().removeWidgets(War.war);
}
}
}
} }
} }
} }

View File

@ -119,7 +119,7 @@ public class WarSpoutListener extends SpoutListener {
private static void drawStats(SpoutPlayer sp, List<GenericLabel> lines) { private static void drawStats(SpoutPlayer sp, List<GenericLabel> lines) {
// remove old stats first // remove old stats first
removeStats(sp); removeStats(sp);
for (GenericLabel l : lines) sp.getMainScreen().attachWidget(plugin,l.copy()); for (GenericLabel l : lines) sp.getMainScreen().attachWidget(plugin, l.copy());
} }
public static void removeStats(SpoutPlayer sp) { public static void removeStats(SpoutPlayer sp) {

View File

@ -833,6 +833,7 @@ public class Warzone {
SpoutPlayer sp = (SpoutPlayer) player; SpoutPlayer sp = (SpoutPlayer) player;
if (sp.isSpoutCraftEnabled()) { if (sp.isSpoutCraftEnabled()) {
WarSpoutListener.removeStats(sp); WarSpoutListener.removeStats(sp);
sp.setTitle(ChatColor.WHITE + player.getName());
} }
sp.resetTitle(); sp.resetTitle();
} }