1
0
mirror of https://github.com/taoneill/war.git synced 2025-03-12 06:32:12 +01:00

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
war/src/main/java
bukkit/tommytony/war
com/tommytony/war

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

View File

@ -148,7 +148,7 @@ public class WarEntityListener extends EntityListener {
&& attackerWarzone == defenderWarzone) { && attackerWarzone == defenderWarzone) {
// same team // same team
if(attackerWarzone.getFriendlyFire()) { 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 { } else {
a.sendMessage(war.str("Your attack missed!")); a.sendMessage(war.str("Your attack missed!"));
a.sendMessage(war.str("Your target is on your team.")); 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()){ } else if (attackerTeam == null && defenderTeam == null && !war.isPvpInZonesOnly()){
// let normal PVP through is its not turned off // 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 { } else {
a.sendMessage(war.str("Your attack missed!")); a.sendMessage(war.str("Your attack missed!"));
if(attackerTeam == null) { if(attackerTeam == null) {

View File

@ -111,7 +111,7 @@ public class WarHub {
// Warzone signs // Warzone signs
for(Warzone zone : war.getWarzones()) { for(Warzone zone : war.getWarzones()) {
if(zone.ready()) { 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) { } else if(team.getMaterial() == TeamMaterials.TEAMGOLD) {
resetTeamGateSign(team, goldGate); resetTeamGateSign(team, goldGate);
} }
//
if(war.getWarHub() != null) { // if(war.getWarHub() != null) {
war.getWarHub().resetZoneSign(warzone); // war.getWarHub().resetZoneSign(warzone);
} // }
} }
private void resetTeamGateSign(Team team, Block gate) { private void resetTeamGateSign(Team team, Block gate) {