Merge git://github.com/taoneill/war

This commit is contained in:
TimWolla 2011-05-22 22:19:41 +02:00
commit 7cafc2dde5
8 changed files with 50 additions and 23 deletions

View File

@ -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;
}
}

View File

@ -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);

View File

@ -81,6 +81,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

View File

@ -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) {
}
}
}

View File

@ -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();
@ -249,12 +271,9 @@ public class ZoneLobby {
}
public void initialize() {
//changeWall(wall); // watch out! this resets+saves the lobby blocks
// 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);

View File

@ -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();

View File

@ -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:<big/flat/small> unbreakable:on nocreatures:on
- /savezone lifepool:8 teamsize:5 maxscore:7 autoassign:on outline:off ff:on blockheads:off spawnstyle:<big/flat/small> 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:<big/flat/small> unbreakable:on nocreatures:on
- /setzoneconfig lifepool:8 teamsize:5 maxscore:7 autoassign:on outline:off ff:on blockheads:off spawnstyle:<big/flat/small> 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:

View File

@ -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:<big/flat/small> unbreakable:on nocreatures:on
- /savezone lifepool:8 teamsize:5 maxscore:7 autoassign:on outline:off ff:on blockheads:off spawnstyle:<big/flat/small> 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:<big/flat/small> unbreakable:on nocreatures:on
- /setzoneconfig lifepool:8 teamsize:5 maxscore:7 autoassign:on outline:off ff:on blockheads:off spawnstyle:<big/flat/small> 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: