Fixed War without Spout being broken. Made 'monument freed' notification use owner team wool block.

This commit is contained in:
taoneill 2012-01-09 23:44:40 -05:00
parent 25bbf5b185
commit 38c91b5623
4 changed files with 21 additions and 11 deletions

View File

@ -90,7 +90,7 @@ public class War extends JavaPlugin {
private final WarConfigBag warConfig = new WarConfigBag();
private final WarzoneConfigBag warzoneDefaultConfig = new WarzoneConfigBag();
private final TeamConfigBag teamDefaultConfig = new TeamConfigBag();
private SpoutMessenger spoutMessenger = new SpoutMessenger();
private SpoutMessenger spoutMessenger = null;
public War() {
super();
@ -128,6 +128,7 @@ public class War extends JavaPlugin {
try {
Class.forName("org.getspout.spoutapi.player.SpoutPlayer");
isSpoutServer = true;
spoutMessenger = new SpoutMessenger();
} catch (ClassNotFoundException e) {
isSpoutServer = false;
}
@ -264,8 +265,10 @@ public class War extends JavaPlugin {
HelmetProtectionTask helmetProtectionTask = new HelmetProtectionTask();
this.getServer().getScheduler().scheduleSyncRepeatingTask(this, helmetProtectionTask, 250, 100);
SpoutFadeOutMessageJob fadeOutMessagesTask = new SpoutFadeOutMessageJob();
this.getServer().getScheduler().scheduleSyncRepeatingTask(this, fadeOutMessagesTask, 100, 100);
if (this.isSpoutServer) {
SpoutFadeOutMessageJob fadeOutMessagesTask = new SpoutFadeOutMessageJob();
this.getServer().getScheduler().scheduleSyncRepeatingTask(this, fadeOutMessagesTask, 100, 100);
}
this.log("War v" + this.desc.getVersion() + " is on.", Level.INFO);
}

View File

@ -212,6 +212,7 @@ public class WarBlockListener extends BlockListener {
Monument monument = warzone.getMonumentFromCenterBlock(block);
if (monument.hasOwner()) {
List<Team> teams = warzone.getTeams();
Team ownerTeam = monument.getOwnerTeam();
if (War.war.isSpoutServer()) {
for (Player p : team.getPlayers()) {
SpoutPlayer sp = SpoutManager.getPlayer(p);
@ -219,14 +220,14 @@ public class WarBlockListener extends BlockListener {
sp.sendNotification(
SpoutMessenger.cleanForNotification("Monument " + ChatColor.WHITE + monument.getName()),
SpoutMessenger.cleanForNotification(ChatColor.YELLOW + "freed by " + team.getKind().getColor() + player.getName() + ChatColor.YELLOW + "!"),
Material.OBSIDIAN,
(short)0,
ownerTeam.getKind().getMaterial(),
ownerTeam.getKind().getData(),
5000);
}
}
}
for (Team t : teams) {
t.teamcast("Team " + monument.getOwnerTeam().getName() + " loses control of monument " + monument.getName());
t.teamcast("Team " + ownerTeam.getName() + " loses control of monument " + monument.getName());
}
monument.uncapture();
}

View File

@ -364,10 +364,14 @@ public class Team {
public void teamcast(String message, boolean isNotification) {
for (Player player : this.players) {
SpoutPlayer sp = SpoutManager.getPlayer(player);
if (sp.isSpoutCraftEnabled() && isNotification) {
// team notifications go to the top left for Spout players to lessen War spam in chat box
War.war.getSpoutMessenger().msg(sp, message);
if (War.war.isSpoutServer()) {
SpoutPlayer sp = SpoutManager.getPlayer(player);
if (sp.isSpoutCraftEnabled() && isNotification) {
// team notifications go to the top left for Spout players to lessen War spam in chat box
War.war.getSpoutMessenger().msg(sp, message);
} else {
War.war.msg(player, message);
}
} else {
War.war.msg(player, message);
}

View File

@ -860,7 +860,9 @@ public class Warzone {
player.setRemainingAir(300);
// To hide stats
War.war.getSpoutMessenger().updateStats(player);
if (War.war.isSpoutServer()) {
War.war.getSpoutMessenger().updateStats(player);
}
War.war.msg(player, "Your inventory is being restored.");
if (War.war.getWarHub() != null) {