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.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import org.getspout.spoutapi.player.SpoutPlayer;
import com.nijiko.permissions.PermissionHandler;
import com.nijikokun.bukkit.Permissions.Permissions;
@ -61,7 +60,7 @@ 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 WarServerListener serverListener = new WarServerListener();
private WarCommandHandler commandHandler = new WarCommandHandler();
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_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()) {
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.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);
}
}
}
if (event.getPlugin().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);
}
}
}
}
}

View File

@ -119,7 +119,7 @@ public class WarSpoutListener extends SpoutListener {
private static void drawStats(SpoutPlayer sp, List<GenericLabel> lines) {
// remove old stats first
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) {

View File

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