Fixed improper link between lobby and warhub sign resetting. Little bugs.

This commit is contained in:
taoneill 2011-01-18 21:08:02 -05:00
parent ccedb36138
commit 55046e7895
4 changed files with 29 additions and 20 deletions

View File

@ -87,7 +87,7 @@ public class War extends JavaPlugin {
pm.registerEvent(Event.Type.PLAYER_LOGIN, playerListener, Priority.Normal, this);
pm.registerEvent(Event.Type.PLAYER_QUIT, playerListener, Priority.Normal, this);
pm.registerEvent(Event.Type.PLAYER_MOVE, playerListener, Priority.Normal, this);
pm.registerEvent(Event.Type.PLAYER_MOVE, playerListener, Priority.Highest, this);
pm.registerEvent(Event.Type.ENTITY_DAMAGEDBY_ENTITY, entityListener, Priority.Normal, this);
@ -193,7 +193,7 @@ public class War extends JavaPlugin {
if(!previousTeam.removePlayer(player.getName())){
warn("Could not remove player " + player.getName() + " from team " + previousTeam.getName());
}
previousTeam.resetSign();
}
// join new team
@ -723,20 +723,26 @@ public class War extends JavaPlugin {
// /setwarhub
else if(command.equals("setwarhub")) {
if(warHub != null) {
// reset existing hub
warHub.getVolume().resetBlocks();
warHub.setLocation(player.getLocation());
warHub.initialize();
} else {
warHub = new WarHub(this, player.getLocation());
warHub.initialize();
for(Warzone zone : warzones) {
zone.getLobby().getVolume().resetBlocks();
zone.getLobby().initialize();
if(warzones.size() > 0) {
if(warHub != null) {
// reset existing hub
warHub.getVolume().resetBlocks();
warHub.setLocation(player.getLocation());
warHub.initialize();
player.sendMessage(str("War hub moved."));
} else {
warHub = new WarHub(this, player.getLocation());
warHub.initialize();
for(Warzone zone : warzones) {
zone.getLobby().getVolume().resetBlocks();
zone.getLobby().initialize();
}
player.sendMessage(str("War hub created."));
}
WarMapper.save(this);
} else {
player.sendMessage(str("No warzones yet."));
}
WarMapper.save(this);
}
// /deletewarhub

View File

@ -148,7 +148,7 @@ public class WarEntityListener extends EntityListener {
&& attackerWarzone == defenderWarzone) {
// same team
if(attackerWarzone.getFriendlyFire()) {
a.sendMessage(war.str("Friendly fire!")); // if ff is on, let the attack go through
a.sendMessage(war.str("Friendly fire is on! Please, don't hurt your teammates.")); // if ff is on, let the attack go through
} else {
a.sendMessage(war.str("Your attack missed!"));
a.sendMessage(war.str("Your target is on your team."));
@ -156,6 +156,9 @@ public class WarEntityListener extends EntityListener {
}
} else if (attackerTeam == null && defenderTeam == null && !war.isPvpInZonesOnly()){
// let normal PVP through is its not turned off
} else if (attackerTeam == null && defenderTeam == null && war.isPvpInZonesOnly()) {
a.sendMessage("Global pvp is turned off. You can only attack other players in warzones. Try /warhub, /zones and /zone.");
event.setCancelled(true); // global pvp is off
} else {
a.sendMessage(war.str("Your attack missed!"));
if(attackerTeam == null) {

View File

@ -111,7 +111,7 @@ public class WarHub {
// Warzone signs
for(Warzone zone : war.getWarzones()) {
if(zone.ready()) {
war.getWarHub().resetZoneSign(zone);
this.resetZoneSign(zone);
}
}
}

View File

@ -510,10 +510,10 @@ public class ZoneLobby {
} else if(team.getMaterial() == TeamMaterials.TEAMGOLD) {
resetTeamGateSign(team, goldGate);
}
if(war.getWarHub() != null) {
war.getWarHub().resetZoneSign(warzone);
}
//
// if(war.getWarHub() != null) {
// war.getWarHub().resetZoneSign(warzone);
// }
}
private void resetTeamGateSign(Team team, Block gate) {