From ad854047864d85600c79a3be6bfc6ad4b60140ff Mon Sep 17 00:00:00 2001 From: taoneill Date: Sun, 22 May 2011 13:59:53 -0400 Subject: [PATCH] Oops. This is War v1.5.1. You can create zones now, at least. --- .../main/java/bukkit/tommytony/war/War.java | 4 +- .../tommytony/war/WarBlockListener.java | 4 +- .../tommytony/war/WarEntityListener.java | 3 ++ .../main/java/com/tommytony/war/Warzone.java | 5 +++ .../java/com/tommytony/war/ZoneLobby.java | 43 +++++++++++++------ .../java/com/tommytony/war/ZoneSetter.java | 2 +- war/src/main/java/plugin.yml | 6 +-- war/target/classes/plugin.yml | 6 +-- 8 files changed, 50 insertions(+), 23 deletions(-) diff --git a/war/src/main/java/bukkit/tommytony/war/War.java b/war/src/main/java/bukkit/tommytony/war/War.java index 0a6a6c2..c4b86e0 100644 --- a/war/src/main/java/bukkit/tommytony/war/War.java +++ b/war/src/main/java/bukkit/tommytony/war/War.java @@ -152,7 +152,7 @@ public class War extends JavaPlugin { pm.registerEvent(Event.Type.PLAYER_INTERACT, playerListener, Priority.Normal, this); pm.registerEvent(Event.Type.ENTITY_EXPLODE, entityListener, Priority.Normal, this); - pm.registerEvent(Event.Type.ENTITY_DEATH, entityListener, Priority.Normal, this); + //pm.registerEvent(Event.Type.ENTITY_DEATH, entityListener, Priority.Normal, this); pm.registerEvent(Event.Type.ENTITY_DAMAGE, entityListener, Priority.Normal, this); pm.registerEvent(Event.Type.ENTITY_COMBUST, entityListener, Priority.Normal, this); pm.registerEvent(Event.Type.CREATURE_SPAWN, entityListener, Priority.Normal, this); @@ -1280,7 +1280,7 @@ public class War extends JavaPlugin { public Warzone matchWarzone(String warzoneSubString) { for(Warzone warzone : warzones) { - if(warzone.getName().toLowerCase().contains(warzoneSubString.toLowerCase())) { + if(warzone.getName().toLowerCase().startsWith(warzoneSubString.toLowerCase())) { return warzone; } } diff --git a/war/src/main/java/bukkit/tommytony/war/WarBlockListener.java b/war/src/main/java/bukkit/tommytony/war/WarBlockListener.java index 527f316..f78f601 100644 --- a/war/src/main/java/bukkit/tommytony/war/WarBlockListener.java +++ b/war/src/main/java/bukkit/tommytony/war/WarBlockListener.java @@ -63,7 +63,7 @@ public class WarBlockListener extends BlockListener { } // protect warzone lobbies for(Warzone wz: war.getWarzones()) { - if(wz.getLobby() != null && wz.getLobby().getVolume().contains(block)) { + if(wz.getLobby() != null && wz.getLobby().getVolume() != null && wz.getLobby().getVolume().contains(block)) { war.badMsg(player, "Can't build here."); event.setCancelled(true); return; @@ -204,7 +204,7 @@ public class WarBlockListener extends BlockListener { // protect warzone lobbies if(block != null) { for(Warzone zone: war.getWarzones()) { - if(zone.getLobby() != null && + if(zone.getLobby() != null && zone.getLobby().getVolume() != null && zone.getLobby().getVolume().contains(block)) { war.badMsg(player, "Can't destroy this."); event.setCancelled(true); diff --git a/war/src/main/java/bukkit/tommytony/war/WarEntityListener.java b/war/src/main/java/bukkit/tommytony/war/WarEntityListener.java index 7150b62..cad3dec 100644 --- a/war/src/main/java/bukkit/tommytony/war/WarEntityListener.java +++ b/war/src/main/java/bukkit/tommytony/war/WarEntityListener.java @@ -80,6 +80,9 @@ public class WarEntityListener extends EntityListener { // Detect death, prevent it and respawn the player if(event.getDamage() >= d.getHealth()) { defenderWarzone.handleDeath(d); + if(war.getServer().getPluginManager().getPlugin("HeroicDeath") != null) { + + } event.setCancelled(true); } } else if (attackerTeam != null && defenderTeam != null diff --git a/war/src/main/java/com/tommytony/war/Warzone.java b/war/src/main/java/com/tommytony/war/Warzone.java index d2e8a99..d4feb4b 100644 --- a/war/src/main/java/com/tommytony/war/Warzone.java +++ b/war/src/main/java/com/tommytony/war/Warzone.java @@ -12,6 +12,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; +import org.bukkit.plugin.Plugin; import bukkit.tommytony.war.War; @@ -811,6 +812,10 @@ public class Warzone { } } playerTeam.resetSign(); + Plugin heroicDeath = war.getServer().getPluginManager().getPlugin("HeroicDeath"); + if(heroicDeath != null) { + + } } } diff --git a/war/src/main/java/com/tommytony/war/ZoneLobby.java b/war/src/main/java/com/tommytony/war/ZoneLobby.java index 52fb9c7..088c46f 100644 --- a/war/src/main/java/com/tommytony/war/ZoneLobby.java +++ b/war/src/main/java/com/tommytony/war/ZoneLobby.java @@ -53,7 +53,7 @@ public class ZoneLobby { if(lobbyHalfSide < 7) { lobbyHalfSide = 7; } - this.wall = wall; + this.setWall(wall); } /** @@ -110,10 +110,20 @@ public class ZoneLobby { */ public void setLocation(Location playerLocation) { createVolumeOrReset(); + + // Lobby orientation + int yaw = 0; + if(playerLocation.getYaw() >= 0){ + yaw = (int)(playerLocation.getYaw() % 360); + } else { + yaw = (int)(360 + (playerLocation.getYaw() % 360)); + } BlockFace facing = null; BlockFace opposite = null; - float yaw = playerLocation.getYaw(); - if(yaw >= 45 && yaw < 135) { + if((yaw >= 0 && yaw < 45) || (yaw >= 315 && yaw <= 360)) { + facing = BlockFace.WEST; + opposite = BlockFace.EAST; + } else if(yaw >= 45 && yaw < 135) { facing = BlockFace.NORTH; opposite = BlockFace.SOUTH; } else if(yaw >= 135 && yaw < 225) { @@ -122,10 +132,22 @@ public class ZoneLobby { } else if(yaw >= 225 && yaw < 315) { facing = BlockFace.SOUTH; opposite = BlockFace.NORTH; - } else if(yaw >= 315 || yaw < 45) { - facing = BlockFace.WEST; - opposite = BlockFace.EAST; - } + } + +// float yaw = playerLocation.getYaw() % 360; +// if(yaw >= 45 && yaw < 135) { +// facing = BlockFace.NORTH; +// opposite = BlockFace.SOUTH; +// } else if(yaw >= 135 && yaw < 225) { +// facing = BlockFace.EAST; +// opposite = BlockFace.WEST; +// } else if(yaw >= 225 && yaw < 315) { +// facing = BlockFace.SOUTH; +// opposite = BlockFace.NORTH; +// } else if(yaw >= 315 || yaw < 45) { +// facing = BlockFace.WEST; +// opposite = BlockFace.EAST; +// } this.wall = opposite; // a player facing south places a lobby that looks just like a lobby stuck to the north wall ZoneVolume zoneVolume = warzone.getVolume(); @@ -248,13 +270,10 @@ public class ZoneLobby { } } - public void initialize() { - //changeWall(wall); // watch out! this resets+saves the lobby blocks - + public void initialize() { // maybe the number of teams change, now reset the gate positions - setGatePositions(BlockInfo.getBlock(warzone.getWorld(), lobbyMiddleWallBlock)); - if(lobbyMiddleWallBlock != null && volume != null /*&& volume.isSaved()*/) { + setGatePositions(BlockInfo.getBlock(warzone.getWorld(), lobbyMiddleWallBlock)); // flatten the area (set all but floor to air, then replace any floor air blocks with glass) this.volume.clearBlocksThatDontFloat(); this.volume.setToMaterial(Material.AIR); diff --git a/war/src/main/java/com/tommytony/war/ZoneSetter.java b/war/src/main/java/com/tommytony/war/ZoneSetter.java index ccf61b9..26aa9bd 100644 --- a/war/src/main/java/com/tommytony/war/ZoneSetter.java +++ b/war/src/main/java/com/tommytony/war/ZoneSetter.java @@ -162,7 +162,7 @@ public class ZoneSetter { private void resetWarzone(Warzone warzone, StringBuilder msgString) { if(warzone.getVolume().isSaved()) { war.msg(player, "Resetting " + warzone.getName() + " blocks."); - if(warzone.getLobby() != null) { + if(warzone.getLobby() != null && warzone.getLobby().getVolume() != null) { warzone.getLobby().getVolume().resetBlocks(); } int reset = warzone.getVolume().resetBlocks(); diff --git a/war/src/main/java/plugin.yml b/war/src/main/java/plugin.yml index 297e343..1f41a35 100644 --- a/war/src/main/java/plugin.yml +++ b/war/src/main/java/plugin.yml @@ -1,5 +1,5 @@ name: War -version: 1.5 (MacArthur) +version: 1.5.1 (MacArthur) description: Lets you create TDM and CTF (warzones) for a more structured PVP experience. author: tommytony website: war.tommytony.com @@ -68,7 +68,7 @@ commands: usage: - Must be standing in warzone or lobby - /savezone => Basic save - - /savezone lifepool:8 teamsize:5 maxscore:7 autoassign:on outline:off ff:on blockheads:off spawnstyle: unbreakable:on nocreatures:on + - /savezone lifepool:8 teamsize:5 maxscore:7 autoassign:on outline:off ff:on blockheads:off spawnstyle: unbreakable:on nocreatures:on disabled:on - /savezone loadout:default => sets the respawn inventory to your current items - /savezone reward:default => sets the winner's reward to your current items setzonelobby: @@ -115,7 +115,7 @@ commands: description: (War) Use named parameters to change the configuration of the warzone. Resets blocks like /nextbattle. Does not save zone blocks like /savezone. usage: - Must be standing in warzone or lobby. - - /setzoneconfig lifepool:8 teamsize:5 maxscore:7 autoassign:on outline:off ff:on blockheads:off spawnstyle: unbreakable:on nocreatures:on + - /setzoneconfig lifepool:8 teamsize:5 maxscore:7 autoassign:on outline:off ff:on blockheads:off spawnstyle: unbreakable:on nocreatures:on disabled:on - /setzoneconfig loadout:default => sets the respawn inventory to your current items - /setzoneconfig reward:default => sets the winner's reward to your current items zonecfg: diff --git a/war/target/classes/plugin.yml b/war/target/classes/plugin.yml index 297e343..1f41a35 100644 --- a/war/target/classes/plugin.yml +++ b/war/target/classes/plugin.yml @@ -1,5 +1,5 @@ name: War -version: 1.5 (MacArthur) +version: 1.5.1 (MacArthur) description: Lets you create TDM and CTF (warzones) for a more structured PVP experience. author: tommytony website: war.tommytony.com @@ -68,7 +68,7 @@ commands: usage: - Must be standing in warzone or lobby - /savezone => Basic save - - /savezone lifepool:8 teamsize:5 maxscore:7 autoassign:on outline:off ff:on blockheads:off spawnstyle: unbreakable:on nocreatures:on + - /savezone lifepool:8 teamsize:5 maxscore:7 autoassign:on outline:off ff:on blockheads:off spawnstyle: unbreakable:on nocreatures:on disabled:on - /savezone loadout:default => sets the respawn inventory to your current items - /savezone reward:default => sets the winner's reward to your current items setzonelobby: @@ -115,7 +115,7 @@ commands: description: (War) Use named parameters to change the configuration of the warzone. Resets blocks like /nextbattle. Does not save zone blocks like /savezone. usage: - Must be standing in warzone or lobby. - - /setzoneconfig lifepool:8 teamsize:5 maxscore:7 autoassign:on outline:off ff:on blockheads:off spawnstyle: unbreakable:on nocreatures:on + - /setzoneconfig lifepool:8 teamsize:5 maxscore:7 autoassign:on outline:off ff:on blockheads:off spawnstyle: unbreakable:on nocreatures:on disabled:on - /setzoneconfig loadout:default => sets the respawn inventory to your current items - /setzoneconfig reward:default => sets the winner's reward to your current items zonecfg: