Updated to new craftbukkit build. is that 48?

This commit is contained in:
taoneill 2011-01-16 00:15:16 -05:00
parent 567718662a
commit 05d5a8d8be
17 changed files with 276 additions and 281 deletions

View File

@ -3,6 +3,7 @@ package bukkit.tommytony.war;
import org.bukkit.*;
import org.bukkit.event.Event;
import org.bukkit.event.Event.Priority;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.PluginLoader;
import org.bukkit.plugin.PluginManager;
@ -75,10 +76,10 @@ public class War extends JavaPlugin {
pm.registerEvent(Event.Type.BLOCK_DAMAGED, blockListener, Priority.Normal, this); // BROKEN
// Load files from disk or create them (using these defaults)
this.defaultLoadout.put(0, new ItemStack(Material.STONE_SWORD));
this.defaultLoadout.put(1, new ItemStack(Material.BOW));
this.defaultLoadout.put(0, new ItemStack(Material.STONE_SWORD, 1, (byte) 8));
this.defaultLoadout.put(1, new ItemStack(Material.BOW, 1, (byte) 8));
this.defaultLoadout.put(2, new ItemStack(Material.ARROW, 7));
this.defaultLoadout.put(3, new ItemStack(Material.IRON_PICKAXE));
this.defaultLoadout.put(3, new ItemStack(Material.IRON_PICKAXE, 1, (byte) 8));
this.defaultLifepool = 7;
this.defaultFriendlyFire = false;
this.defaultAutoAssignOnly = false;

View File

@ -2,12 +2,12 @@ package bukkit.tommytony.war;
import java.util.List;
import org.bukkit.Block;
import org.bukkit.BlockDamageLevel;
import org.bukkit.Player;
import org.bukkit.event.block.BlockDamagedEvent;
import org.bukkit.block.Block;
import org.bukkit.block.BlockDamageLevel;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.block.BlockListener;
import org.bukkit.event.block.BlockPlacedEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import com.tommytony.war.Monument;
import com.tommytony.war.Team;
@ -26,7 +26,7 @@ public class WarBlockListener extends BlockListener {
this.war = war;
}
public void onBlockPlaced(BlockPlacedEvent event) {
public void onBlockPlace(BlockPlaceEvent event) {
Player player = event.getPlayer();
Block block = event.getBlock();
if(player != null) {
@ -65,7 +65,7 @@ public class WarBlockListener extends BlockListener {
}
}
public void onBlockDamaged(BlockDamagedEvent event) {
public void onBlockDamage(BlockDamageEvent event) {
Player player = event.getPlayer();
Block block = event.getBlock();
if(player != null && block != null && event.getDamageLevel() == BlockDamageLevel.BROKEN) {

View File

@ -1,14 +1,8 @@
package bukkit.tommytony.war;
import java.util.List;
import java.util.logging.Level;
import org.bukkit.Entity;
import org.bukkit.Player;
import org.bukkit.event.entity.EntityDamagedByBlockEvent;
import org.bukkit.event.entity.EntityDamagedByEntityEvent;
import org.bukkit.event.entity.EntityDamagedEvent;
import org.bukkit.event.entity.EntityDamagedEvent.DamageCause;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityListener;
import com.tommytony.war.Team;
@ -71,7 +65,7 @@ public class WarEntityListener extends EntityListener {
//
// }
public void onEntityDamagedByEntity(EntityDamagedByEntityEvent event) {
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
// BUKKIT !!
Entity attacker = event.getDamager();
Entity defender = event.getEntity();
@ -87,12 +81,12 @@ public class WarEntityListener extends EntityListener {
if(attackerTeam != null && defenderTeam != null
&& attackerTeam != defenderTeam
&& attackerWarzone == defenderWarzone) {
// A real attack: handle death scenario.
if(event.getDamage() >= d.getHealth()) {
// Player died
handleDeath(d);
event.setCancelled(true); // Don't let the killing blow fall down.
}
// A real attack: handle death scenario. ==> NOT: now handled in player move.. but spammy
// if(event.getDamage() >= d.getHealth()) {
// // Player died
// handleDeath(d);
// event.setCancelled(true); // Don't let the killing blow fall down.
// }
} else if (attackerTeam != null && defenderTeam != null
&& attackerTeam == defenderTeam
&& attackerWarzone == defenderWarzone) {

View File

@ -3,10 +3,10 @@ import java.util.List;
import java.util.Random;
import java.util.logging.Level;
import org.bukkit.BlockFace;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Player;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerEvent;
import org.bukkit.event.player.PlayerListener;
@ -348,16 +348,16 @@ public class WarPlayerListener extends PlayerListener {
BlockFace wall = null;
String wallStr = "";
if(arguments[0].equals("north") || arguments[0].equals("n")) {
wall = BlockFace.North;
wall = BlockFace.NORTH;
wallStr = "north";
} else if(arguments[0].equals("east") || arguments[0].equals("e")) {
wall = BlockFace.East;
wall = BlockFace.EAST;
wallStr = "east";
} else if(arguments[0].equals("south") || arguments[0].equals("s")) {
wall = BlockFace.South;
wall = BlockFace.SOUTH;
wallStr = "south";
} else if(arguments[0].equals("west") || arguments[0].equals("w")) {
wall = BlockFace.West;
wall = BlockFace.WEST;
wallStr = "west";
}
if(lobby != null) {
@ -365,7 +365,7 @@ public class WarPlayerListener extends PlayerListener {
lobby.getVolume().resetBlocks();
lobby.changeWall(wall);
lobby.initialize();
player.sendMessage(war.str("Warzone lobby moved to " + wallStr + "side of zone."));
player.sendMessage(war.str("Warzone lobby moved to " + wallStr + " side of zone."));
} else {
// new lobby
lobby = new ZoneLobby(war, warzone, wall);
@ -398,7 +398,7 @@ public class WarPlayerListener extends PlayerListener {
int savedBlocks = warzone.saveState();
if(warzone.getLobby() == null) {
// Set default lobby on south side
lobby = new ZoneLobby(war, warzone, BlockFace.South);
lobby = new ZoneLobby(war, warzone, BlockFace.SOUTH);
warzone.setLobby(lobby);
lobby.initialize();
player.sendMessage(war.str("Default lobby created on south side of zone."));

View File

@ -3,12 +3,12 @@ package com.tommytony.war;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Block;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Player;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.block.Sign;
import org.bukkit.entity.Player;
import bukkit.tommytony.war.War;

View File

@ -25,13 +25,13 @@ public class TeamMaterials {
}
public static String teamMaterialToString(Material material) {
if(material.getID() == TEAMDIAMOND.getID()) {
if(material.getId() == TEAMDIAMOND.getId()) {
return "diamond";
}
if(material.getID() == TEAMIRON.getID()) {
if(material.getId() == TEAMIRON.getId()) {
return "iron";
}
if(material.getID() == TEAMGOLD.getID()) {
if(material.getId() == TEAMGOLD.getId()) {
return "gold";
}
return null;

View File

@ -3,10 +3,10 @@ package com.tommytony.war;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Block;
import org.bukkit.BlockFace;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import bukkit.tommytony.war.War;
@ -65,24 +65,24 @@ public class WarHub {
int hubHeigth = 4;
Block locationBlock = location.getWorld().getBlockAt(location.getBlockX(), location.getBlockY(), location.getBlockZ());
volume.setCornerOne(locationBlock.getFace(BlockFace.South, halfHubWidth).getFace(BlockFace.Down));
volume.setCornerTwo(locationBlock.getFace(BlockFace.North, halfHubWidth).getFace(BlockFace.West, hubDepth).getFace(BlockFace.North, hubHeigth));
volume.setCornerOne(locationBlock.getFace(BlockFace.SOUTH, halfHubWidth).getFace(BlockFace.DOWN));
volume.setCornerTwo(locationBlock.getFace(BlockFace.NORTH, halfHubWidth).getFace(BlockFace.WEST, hubDepth).getFace(BlockFace.NORTH, hubHeigth));
volume.saveBlocks();
// draw gates
Block currentGateBlock = locationBlock.getFace(BlockFace.South, halfHubWidth - 2).getFace(BlockFace.West, hubDepth);
Block currentGateBlock = locationBlock.getFace(BlockFace.SOUTH, halfHubWidth - 2).getFace(BlockFace.WEST, hubDepth);
for(Warzone zone : war.getWarzones()) { // gonna use the index to find it again
zoneGateBlocks.add(currentGateBlock);
currentGateBlock.setType(Material.PORTAL);
currentGateBlock.getFace(BlockFace.Up).setType(Material.PORTAL);
currentGateBlock.getFace(BlockFace.South).setType(Material.OBSIDIAN);
currentGateBlock.getFace(BlockFace.North).getFace(BlockFace.Up).setType(Material.OBSIDIAN);
currentGateBlock.getFace(BlockFace.South).getFace(BlockFace.Up).getFace(BlockFace.Up).setType(Material.OBSIDIAN);
currentGateBlock.getFace(BlockFace.North).setType(Material.OBSIDIAN);
currentGateBlock.getFace(BlockFace.South).getFace(BlockFace.Up).setType(Material.OBSIDIAN);
currentGateBlock.getFace(BlockFace.North).getFace(BlockFace.Up).getFace(BlockFace.Up).setType(Material.OBSIDIAN);
currentGateBlock.getFace(BlockFace.Up).getFace(BlockFace.Up).setType(Material.OBSIDIAN);
currentGateBlock = currentGateBlock.getFace(BlockFace.North, 4);
currentGateBlock.getFace(BlockFace.UP).setType(Material.PORTAL);
currentGateBlock.getFace(BlockFace.SOUTH).setType(Material.OBSIDIAN);
currentGateBlock.getFace(BlockFace.NORTH).getFace(BlockFace.UP).setType(Material.OBSIDIAN);
currentGateBlock.getFace(BlockFace.SOUTH).getFace(BlockFace.UP).getFace(BlockFace.UP).setType(Material.OBSIDIAN);
currentGateBlock.getFace(BlockFace.NORTH).setType(Material.OBSIDIAN);
currentGateBlock.getFace(BlockFace.SOUTH).getFace(BlockFace.UP).setType(Material.OBSIDIAN);
currentGateBlock.getFace(BlockFace.NORTH).getFace(BlockFace.UP).getFace(BlockFace.UP).setType(Material.OBSIDIAN);
currentGateBlock.getFace(BlockFace.UP).getFace(BlockFace.UP).setType(Material.OBSIDIAN);
currentGateBlock = currentGateBlock.getFace(BlockFace.NORTH, 4);
}
}
}

View File

@ -3,15 +3,15 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.bukkit.Block;
import org.bukkit.BlockFace;
import org.bukkit.ItemStack;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Player;
import org.bukkit.PlayerInventory;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import bukkit.tommytony.war.War;
@ -108,11 +108,11 @@ public class Warzone {
Block topNWBlock = this.world.getBlockAt(this.northwest.getBlockX(), newHighest, this.northwest.getBlockZ());
originalNorthwestBlocks = new Material[3];
originalNorthwestBlocks[0] = topNWBlock.getType(); // save blocks for reset
originalNorthwestBlocks[1] = topNWBlock.getFace(BlockFace.East).getType();
originalNorthwestBlocks[2] = topNWBlock.getFace(BlockFace.South).getType();
originalNorthwestBlocks[1] = topNWBlock.getFace(BlockFace.EAST).getType();
originalNorthwestBlocks[2] = topNWBlock.getFace(BlockFace.SOUTH).getType();
topNWBlock.setType(Material.GLASS);
topNWBlock.getFace(BlockFace.East).setType(Material.GLASS);
topNWBlock.getFace(BlockFace.South).setType(Material.GLASS);
topNWBlock.getFace(BlockFace.EAST).setType(Material.GLASS);
topNWBlock.getFace(BlockFace.SOUTH).setType(Material.GLASS);
}
private void resetNorthwestCursorBlocks() {
@ -121,8 +121,8 @@ public class Warzone {
int highest = this.world.getHighestBlockYAt(this.northwest.getBlockX(), this.northwest.getBlockZ()) - 1;
Block oldTopNWBlock = this.world.getBlockAt(this.northwest.getBlockX(), highest, this.northwest.getBlockZ());
oldTopNWBlock.setType(originalNorthwestBlocks[0]);
oldTopNWBlock.getFace(BlockFace.East).setType(originalNorthwestBlocks[1]);
oldTopNWBlock.getFace(BlockFace.South).setType(originalNorthwestBlocks[2]);
oldTopNWBlock.getFace(BlockFace.EAST).setType(originalNorthwestBlocks[1]);
oldTopNWBlock.getFace(BlockFace.SOUTH).setType(originalNorthwestBlocks[2]);
}
}
@ -142,11 +142,11 @@ public class Warzone {
Block topSEBlock = this.world.getBlockAt(this.southeast.getBlockX(), newHighest, this.southeast.getBlockZ());
originalSoutheastBlocks = new Material[3];
originalSoutheastBlocks[0] = topSEBlock.getType(); // save block for reset
originalSoutheastBlocks[1] = topSEBlock.getFace(BlockFace.West).getType();
originalSoutheastBlocks[2] = topSEBlock.getFace(BlockFace.North).getType();
originalSoutheastBlocks[1] = topSEBlock.getFace(BlockFace.WEST).getType();
originalSoutheastBlocks[2] = topSEBlock.getFace(BlockFace.NORTH).getType();
topSEBlock.setType(Material.GLASS);
topSEBlock.getFace(BlockFace.West).setType(Material.GLASS);
topSEBlock.getFace(BlockFace.North).setType(Material.GLASS);
topSEBlock.getFace(BlockFace.WEST).setType(Material.GLASS);
topSEBlock.getFace(BlockFace.NORTH).setType(Material.GLASS);
}
private void resetSoutheastCursorBlocks() {
@ -155,8 +155,8 @@ public class Warzone {
int highest = this.world.getHighestBlockYAt(this.southeast.getBlockX(), this.southeast.getBlockZ()) - 1;
Block oldTopSEBlock = this.world.getBlockAt(this.southeast.getBlockX(), highest, this.southeast.getBlockZ());
oldTopSEBlock.setType(originalSoutheastBlocks[0]);
oldTopSEBlock.getFace(BlockFace.West).setType(originalSoutheastBlocks[1]);
oldTopSEBlock.getFace(BlockFace.North).setType(originalSoutheastBlocks[2]);
oldTopSEBlock.getFace(BlockFace.WEST).setType(originalSoutheastBlocks[1]);
oldTopSEBlock.getFace(BlockFace.NORTH).setType(originalSoutheastBlocks[2]);
}
}
@ -175,10 +175,10 @@ public class Warzone {
public int saveState() {
if(ready()){
// removed everything to keep save clean
volume.resetWallBlocks(BlockFace.East);
volume.resetWallBlocks(BlockFace.West);
volume.resetWallBlocks(BlockFace.North);
volume.resetWallBlocks(BlockFace.South);
volume.resetWallBlocks(BlockFace.EAST);
volume.resetWallBlocks(BlockFace.WEST);
volume.resetWallBlocks(BlockFace.NORTH);
volume.resetWallBlocks(BlockFace.SOUTH);
for(Team team : teams) {
team.getVolume().resetBlocks();
@ -238,10 +238,10 @@ public class Warzone {
private void initZone() {
// add wall outlines
if(drawZoneOutline) {
addZoneOutline(BlockFace.North);
addZoneOutline(BlockFace.East);
addZoneOutline(BlockFace.South);
addZoneOutline(BlockFace.West);
addZoneOutline(BlockFace.NORTH);
addZoneOutline(BlockFace.EAST);
addZoneOutline(BlockFace.SOUTH);
addZoneOutline(BlockFace.WEST);
}
// reset monuments
@ -266,19 +266,19 @@ public class Warzone {
Block nw = world.getBlockAt(volume.getMinX(), c2maxY, volume.getMaxZ());
Block se = world.getBlockAt(volume.getMaxX(), c2maxY, volume.getMinZ());
Block lastBlock = null;
if(BlockFace.North == wall) {
if(BlockFace.NORTH == wall) {
for(int z = volume.getMinZ(); z < volume.getMaxZ(); z++) {
lastBlock = highestBlockToGlass(ne.getX(), z, lastBlock);
}
} else if (BlockFace.East == wall) {
} else if (BlockFace.EAST == wall) {
for(int x = volume.getMinX(); x < volume.getMaxX(); x++) {
lastBlock = highestBlockToGlass(x, ne.getZ(), lastBlock);
}
} else if (BlockFace.South == wall) {
} else if (BlockFace.SOUTH == wall) {
for(int z = volume.getMinZ(); z < volume.getMaxZ(); z++) {
lastBlock = highestBlockToGlass(se.getX(), z, lastBlock);
}
} else if (BlockFace.West == wall) {
} else if (BlockFace.WEST == wall) {
for(int x = volume.getMinX(); x < volume.getMaxX(); x++) {
lastBlock = highestBlockToGlass(x, nw.getZ(), lastBlock);
}
@ -290,15 +290,15 @@ public class Warzone {
Block block = world.getBlockAt(x, highest -1 , z);
if(block.getType() == Material.LEAVES) { // top of tree, lets find some dirt/ground
Block over = block.getFace(BlockFace.Down);
Block under = over.getFace(BlockFace.Down);
Block over = block.getFace(BlockFace.DOWN);
Block under = over.getFace(BlockFace.DOWN);
int treeHeight = 0;
while(!((over.getType() == Material.AIR && under.getType() != Material.AIR && under.getType() != Material.LEAVES)
|| (over.getType() == Material.LEAVES && under.getType() != Material.LEAVES && under.getType() != Material.AIR)
|| (over.getType() == Material.WOOD && under.getType() != Material.WOOD && under.getType() != Material.AIR))
&& treeHeight < 40) {
over = under;
under = over.getFace(BlockFace.Down);
under = over.getFace(BlockFace.DOWN);
treeHeight++;
}
block = under; // found the ground
@ -309,16 +309,16 @@ public class Warzone {
if(lastBlock != null) {
// link the new block and the old vertically if there's a big drop or rise
if(block.getY() - lastBlock.getY() > 1) { // new block too high
Block under = block.getFace(BlockFace.Down);
Block under = block.getFace(BlockFace.DOWN);
while(under.getY() != lastBlock.getY() - 1) {
under.setType(Material.GLASS);
under = under.getFace(BlockFace.Down);
under = under.getFace(BlockFace.DOWN);
}
} else if (lastBlock.getY() - block.getY() > 1) { // new block too low
Block over = block.getFace(BlockFace.Up);
Block over = block.getFace(BlockFace.UP);
while(over.getY() != lastBlock.getY() + 1) {
over.setType(Material.GLASS);
over = over.getFace(BlockFace.Up);
over = over.getFace(BlockFace.UP);
}
}
}
@ -537,7 +537,7 @@ public class Warzone {
public Team getTeamByMaterial(Material material) {
for(Team t : teams) {
if(t.getMaterial().getID() == material.getID()) {
if(t.getMaterial().getId() == material.getId()) {
return t;
}
}
@ -610,28 +610,28 @@ public class Warzone {
&& latestPlayerLocation.getBlockX() <= southeast.getBlockX()
&& latestPlayerLocation.getBlockX() >= northwest.getBlockX()) {
// near east wall
walls.add(BlockFace.East);
walls.add(BlockFace.EAST);
}
if (Math.abs(southeast.getBlockX() - latestPlayerLocation.getBlockX()) < minSafeDistanceFromWall
&& latestPlayerLocation.getBlockZ() <= northwest.getBlockZ()
&& latestPlayerLocation.getBlockZ() >= southeast.getBlockZ()) {
// near south wall
walls.add(BlockFace.South);
walls.add(BlockFace.SOUTH);
}
if (Math.abs(northwest.getBlockX() - latestPlayerLocation.getBlockX()) < minSafeDistanceFromWall
&& latestPlayerLocation.getBlockZ() <= northwest.getBlockZ()
&& latestPlayerLocation.getBlockZ() >= southeast.getBlockZ()) {
// near north wall
walls.add(BlockFace.North);
walls.add(BlockFace.NORTH);
}
if (Math.abs(northwest.getBlockZ() - latestPlayerLocation.getBlockZ()) < minSafeDistanceFromWall
&& latestPlayerLocation.getBlockX() <= southeast.getBlockX()
&& latestPlayerLocation.getBlockX() >= northwest.getBlockX()) {
// near west wall
walls.add(BlockFace.West);
walls.add(BlockFace.WEST);
}
return walls;
}

View File

@ -1,9 +1,9 @@
package com.tommytony.war;
import org.bukkit.Block;
import org.bukkit.BlockFace;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import bukkit.tommytony.war.War;
@ -54,14 +54,14 @@ public class ZoneLobby {
this.wall = wall;
this.setVolume(volume);
// we're setting the zoneVolume directly, so we need to figure out the lobbyMiddleWallBlock on our own
if(wall == BlockFace.North) {
lobbyMiddleWallBlock = volume.getCornerOne().getFace(BlockFace.Up).getFace(BlockFace.East, lobbyHalfSide);
} else if (wall == BlockFace.East){
lobbyMiddleWallBlock = volume.getCornerOne().getFace(BlockFace.Up).getFace(BlockFace.South, lobbyHalfSide);
} else if (wall == BlockFace.South){
lobbyMiddleWallBlock = volume.getCornerOne().getFace(BlockFace.Up).getFace(BlockFace.West, lobbyHalfSide);
} else if (wall == BlockFace.West){
lobbyMiddleWallBlock = volume.getCornerOne().getFace(BlockFace.Up).getFace(BlockFace.North, lobbyHalfSide);
if(wall == BlockFace.NORTH) {
lobbyMiddleWallBlock = volume.getCornerOne().getFace(BlockFace.UP).getFace(BlockFace.EAST, lobbyHalfSide);
} else if (wall == BlockFace.EAST){
lobbyMiddleWallBlock = volume.getCornerOne().getFace(BlockFace.UP).getFace(BlockFace.SOUTH, lobbyHalfSide);
} else if (wall == BlockFace.SOUTH){
lobbyMiddleWallBlock = volume.getCornerOne().getFace(BlockFace.UP).getFace(BlockFace.WEST, lobbyHalfSide);
} else if (wall == BlockFace.WEST){
lobbyMiddleWallBlock = volume.getCornerOne().getFace(BlockFace.UP).getFace(BlockFace.NORTH, lobbyHalfSide);
}
}
@ -82,7 +82,7 @@ public class ZoneLobby {
Block corner1 = null;
Block corner2 = null;
if(wall == BlockFace.North) {
if(wall == BlockFace.NORTH) {
int wallStart = zoneVolume.getMinZ();
int wallEnd = zoneVolume.getMaxZ();
int x = zoneVolume.getMinX();
@ -93,7 +93,7 @@ public class ZoneLobby {
corner1 = warzone.getWorld().getBlockAt(x, highestNonAirBlockAtCenter, wallCenterPos + lobbyHalfSide);
corner2 = warzone.getWorld().getBlockAt(x - lobbyDepth,
highestNonAirBlockAtCenter + 1 + lobbyHeight, wallCenterPos - lobbyHalfSide);
} else if (wall == BlockFace.East){
} else if (wall == BlockFace.EAST){
int wallStart = zoneVolume.getMinX();
int wallEnd = zoneVolume.getMaxX();
int z = zoneVolume.getMinZ();
@ -104,7 +104,7 @@ public class ZoneLobby {
corner1 = warzone.getWorld().getBlockAt(wallCenterPos - lobbyHalfSide, highestNonAirBlockAtCenter, z);
corner2 = warzone.getWorld().getBlockAt(wallCenterPos + lobbyHalfSide,
highestNonAirBlockAtCenter + 1 + lobbyHeight, z - lobbyDepth);
} else if (wall == BlockFace.South){
} else if (wall == BlockFace.SOUTH){
int wallStart = zoneVolume.getMinZ();
int wallEnd = zoneVolume.getMaxZ();
int x = zoneVolume.getMaxX();
@ -115,7 +115,7 @@ public class ZoneLobby {
corner1 = warzone.getWorld().getBlockAt(x, highestNonAirBlockAtCenter, wallCenterPos - lobbyHalfSide);
corner2 = warzone.getWorld().getBlockAt(x + lobbyDepth,
highestNonAirBlockAtCenter + 1 + lobbyHeight, wallCenterPos + lobbyHalfSide);
} else if (wall == BlockFace.West){
} else if (wall == BlockFace.WEST){
int wallStart = zoneVolume.getMinX();
int wallEnd = zoneVolume.getMaxX();
int z = zoneVolume.getMaxZ();
@ -144,7 +144,7 @@ public class ZoneLobby {
if(lobbyMiddleWallBlock != null && volume != null && volume.isSaved()) {
// flatten the area (set all but floor to air, then replace any floor air blocks with glass)
this.volume.setToMaterial(Material.AIR);
this.volume.setFaceMaterial(BlockFace.Down, Material.GLASS); // beautiful
this.volume.setFaceMaterial(BlockFace.DOWN, Material.GLASS); // beautiful
// add war hub link gate
if(war.getWarHub() != null) {
@ -168,18 +168,18 @@ public class ZoneLobby {
private void setGatePositions(Block lobbyMiddleWallBlock) {
BlockFace leftSide = null; // look at the zone
BlockFace rightSide = null;
if(wall == BlockFace.North) {
leftSide = BlockFace.East;
rightSide = BlockFace.West;
} else if(wall == BlockFace.East) {
leftSide = BlockFace.South;
rightSide = BlockFace.North;
} else if(wall == BlockFace.South) {
leftSide = BlockFace.West;
rightSide = BlockFace.East;
} else if(wall == BlockFace.West) {
leftSide = BlockFace.North;
rightSide = BlockFace.South;
if(wall == BlockFace.NORTH) {
leftSide = BlockFace.EAST;
rightSide = BlockFace.WEST;
} else if(wall == BlockFace.EAST) {
leftSide = BlockFace.SOUTH;
rightSide = BlockFace.NORTH;
} else if(wall == BlockFace.SOUTH) {
leftSide = BlockFace.WEST;
rightSide = BlockFace.EAST;
} else if(wall == BlockFace.WEST) {
leftSide = BlockFace.NORTH;
rightSide = BlockFace.SOUTH;
}
if(warzone.getAutoAssignOnly()){
autoAssignGate = lobbyMiddleWallBlock;
@ -219,28 +219,28 @@ public class ZoneLobby {
if(block != null) {
BlockFace leftSide = null; // look at the zone
BlockFace rightSide = null;
if(wall == BlockFace.North) {
leftSide = BlockFace.East;
rightSide = BlockFace.West;
} else if(wall == BlockFace.East) {
leftSide = BlockFace.South;
rightSide = BlockFace.North;
} else if(wall == BlockFace.South) {
leftSide = BlockFace.West;
rightSide = BlockFace.East;
} else if(wall == BlockFace.West) {
leftSide = BlockFace.North;
rightSide = BlockFace.South;
if(wall == BlockFace.NORTH) {
leftSide = BlockFace.EAST;
rightSide = BlockFace.WEST;
} else if(wall == BlockFace.EAST) {
leftSide = BlockFace.SOUTH;
rightSide = BlockFace.NORTH;
} else if(wall == BlockFace.SOUTH) {
leftSide = BlockFace.WEST;
rightSide = BlockFace.EAST;
} else if(wall == BlockFace.WEST) {
leftSide = BlockFace.NORTH;
rightSide = BlockFace.SOUTH;
}
block.setType(Material.PORTAL);
block.getFace(BlockFace.Up).setType(Material.PORTAL);
block.getFace(BlockFace.UP).setType(Material.PORTAL);
block.getFace(leftSide).setType(teamMaterial);
block.getFace(rightSide).getFace(BlockFace.Up).setType(teamMaterial);
block.getFace(leftSide).getFace(BlockFace.Up).getFace(BlockFace.Up).setType(teamMaterial);
block.getFace(rightSide).getFace(BlockFace.UP).setType(teamMaterial);
block.getFace(leftSide).getFace(BlockFace.UP).getFace(BlockFace.UP).setType(teamMaterial);
block.getFace(rightSide).setType(teamMaterial);
block.getFace(leftSide).getFace(BlockFace.Up).setType(teamMaterial);
block.getFace(rightSide).getFace(BlockFace.Up).getFace(BlockFace.Up).setType(teamMaterial);
block.getFace(BlockFace.Up).getFace(BlockFace.Up).setType(teamMaterial);
block.getFace(leftSide).getFace(BlockFace.UP).setType(teamMaterial);
block.getFace(rightSide).getFace(BlockFace.UP).getFace(BlockFace.UP).setType(teamMaterial);
block.getFace(BlockFace.UP).getFace(BlockFace.UP).setType(teamMaterial);
}
}
@ -248,56 +248,56 @@ public class ZoneLobby {
if(autoAssignGate != null) {
BlockFace leftSide = null; // look at the zone
BlockFace rightSide = null;
if(wall == BlockFace.North) {
leftSide = BlockFace.East;
rightSide = BlockFace.West;
} else if(wall == BlockFace.East) {
leftSide = BlockFace.South;
rightSide = BlockFace.North;
} else if(wall == BlockFace.South) {
leftSide = BlockFace.West;
rightSide = BlockFace.East;
} else if(wall == BlockFace.West) {
leftSide = BlockFace.North;
rightSide = BlockFace.South;
if(wall == BlockFace.NORTH) {
leftSide = BlockFace.EAST;
rightSide = BlockFace.WEST;
} else if(wall == BlockFace.EAST) {
leftSide = BlockFace.SOUTH;
rightSide = BlockFace.NORTH;
} else if(wall == BlockFace.SOUTH) {
leftSide = BlockFace.WEST;
rightSide = BlockFace.EAST;
} else if(wall == BlockFace.WEST) {
leftSide = BlockFace.NORTH;
rightSide = BlockFace.SOUTH;
}
Team diamondTeam = warzone.getTeamByMaterial(TeamMaterials.TEAMDIAMOND);
Team ironTeam = warzone.getTeamByMaterial(TeamMaterials.TEAMIRON);
Team goldTeam = warzone.getTeamByMaterial(TeamMaterials.TEAMGOLD);
autoAssignGate.setType(Material.PORTAL);
autoAssignGate.getFace(BlockFace.Up).setType(Material.PORTAL);
autoAssignGate.getFace(BlockFace.UP).setType(Material.PORTAL);
if(diamondTeam != null && ironTeam != null && goldTeam != null) {
autoAssignGate.getFace(leftSide).setType(TeamMaterials.TEAMDIAMOND);
autoAssignGate.getFace(leftSide).getFace(BlockFace.Up).setType(TeamMaterials.TEAMIRON);
autoAssignGate.getFace(leftSide).getFace(BlockFace.Up).getFace(BlockFace.Up).setType(TeamMaterials.TEAMGOLD);
autoAssignGate.getFace(rightSide).getFace(BlockFace.Up).setType(TeamMaterials.TEAMDIAMOND);
autoAssignGate.getFace(rightSide).getFace(BlockFace.Up).getFace(BlockFace.Up).setType(TeamMaterials.TEAMIRON);
autoAssignGate.getFace(rightSide).getFace(BlockFace.Up).setType(TeamMaterials.TEAMGOLD);
autoAssignGate.getFace(leftSide).getFace(BlockFace.UP).setType(TeamMaterials.TEAMIRON);
autoAssignGate.getFace(leftSide).getFace(BlockFace.UP).getFace(BlockFace.UP).setType(TeamMaterials.TEAMGOLD);
autoAssignGate.getFace(rightSide).getFace(BlockFace.UP).setType(TeamMaterials.TEAMDIAMOND);
autoAssignGate.getFace(rightSide).getFace(BlockFace.UP).getFace(BlockFace.UP).setType(TeamMaterials.TEAMIRON);
autoAssignGate.getFace(rightSide).getFace(BlockFace.UP).setType(TeamMaterials.TEAMGOLD);
autoAssignGate.getFace(rightSide).setType(TeamMaterials.TEAMDIAMOND);
} else if (diamondTeam != null && ironTeam != null) {
autoAssignGate.getFace(leftSide).setType(TeamMaterials.TEAMDIAMOND);
autoAssignGate.getFace(leftSide).getFace(BlockFace.Up).setType(TeamMaterials.TEAMIRON);
autoAssignGate.getFace(leftSide).getFace(BlockFace.Up).getFace(BlockFace.Up).setType(TeamMaterials.TEAMDIAMOND);
autoAssignGate.getFace(rightSide).getFace(BlockFace.Up).setType(TeamMaterials.TEAMIRON);
autoAssignGate.getFace(rightSide).getFace(BlockFace.Up).getFace(BlockFace.Up).setType(TeamMaterials.TEAMDIAMOND);
autoAssignGate.getFace(rightSide).getFace(BlockFace.Up).setType(TeamMaterials.TEAMIRON);
autoAssignGate.getFace(leftSide).getFace(BlockFace.UP).setType(TeamMaterials.TEAMIRON);
autoAssignGate.getFace(leftSide).getFace(BlockFace.UP).getFace(BlockFace.UP).setType(TeamMaterials.TEAMDIAMOND);
autoAssignGate.getFace(rightSide).getFace(BlockFace.UP).setType(TeamMaterials.TEAMIRON);
autoAssignGate.getFace(rightSide).getFace(BlockFace.UP).getFace(BlockFace.UP).setType(TeamMaterials.TEAMDIAMOND);
autoAssignGate.getFace(rightSide).getFace(BlockFace.UP).setType(TeamMaterials.TEAMIRON);
autoAssignGate.getFace(rightSide).setType(TeamMaterials.TEAMDIAMOND);
} else if (ironTeam != null && goldTeam != null) {
autoAssignGate.getFace(leftSide).setType(TeamMaterials.TEAMIRON);
autoAssignGate.getFace(leftSide).getFace(BlockFace.Up).setType(TeamMaterials.TEAMGOLD);
autoAssignGate.getFace(leftSide).getFace(BlockFace.Up).getFace(BlockFace.Up).setType(TeamMaterials.TEAMIRON);
autoAssignGate.getFace(rightSide).getFace(BlockFace.Up).setType(TeamMaterials.TEAMGOLD);
autoAssignGate.getFace(rightSide).getFace(BlockFace.Up).getFace(BlockFace.Up).setType(TeamMaterials.TEAMIRON);
autoAssignGate.getFace(rightSide).getFace(BlockFace.Up).setType(TeamMaterials.TEAMGOLD);
autoAssignGate.getFace(leftSide).getFace(BlockFace.UP).setType(TeamMaterials.TEAMGOLD);
autoAssignGate.getFace(leftSide).getFace(BlockFace.UP).getFace(BlockFace.UP).setType(TeamMaterials.TEAMIRON);
autoAssignGate.getFace(rightSide).getFace(BlockFace.UP).setType(TeamMaterials.TEAMGOLD);
autoAssignGate.getFace(rightSide).getFace(BlockFace.UP).getFace(BlockFace.UP).setType(TeamMaterials.TEAMIRON);
autoAssignGate.getFace(rightSide).getFace(BlockFace.UP).setType(TeamMaterials.TEAMGOLD);
autoAssignGate.getFace(rightSide).setType(TeamMaterials.TEAMIRON);
} else if (diamondTeam != null && goldTeam != null) {
autoAssignGate.getFace(leftSide).setType(TeamMaterials.TEAMDIAMOND);
autoAssignGate.getFace(leftSide).getFace(BlockFace.Up).setType(TeamMaterials.TEAMGOLD);
autoAssignGate.getFace(leftSide).getFace(BlockFace.Up).getFace(BlockFace.Up).setType(TeamMaterials.TEAMDIAMOND);
autoAssignGate.getFace(rightSide).getFace(BlockFace.Up).setType(TeamMaterials.TEAMGOLD);
autoAssignGate.getFace(rightSide).getFace(BlockFace.Up).getFace(BlockFace.Up).setType(TeamMaterials.TEAMDIAMOND);
autoAssignGate.getFace(rightSide).getFace(BlockFace.Up).setType(TeamMaterials.TEAMGOLD);
autoAssignGate.getFace(leftSide).getFace(BlockFace.UP).setType(TeamMaterials.TEAMGOLD);
autoAssignGate.getFace(leftSide).getFace(BlockFace.UP).getFace(BlockFace.UP).setType(TeamMaterials.TEAMDIAMOND);
autoAssignGate.getFace(rightSide).getFace(BlockFace.UP).setType(TeamMaterials.TEAMGOLD);
autoAssignGate.getFace(rightSide).getFace(BlockFace.UP).getFace(BlockFace.UP).setType(TeamMaterials.TEAMDIAMOND);
autoAssignGate.getFace(rightSide).getFace(BlockFace.UP).setType(TeamMaterials.TEAMGOLD);
autoAssignGate.getFace(rightSide).setType(TeamMaterials.TEAMDIAMOND);
}
}
@ -373,50 +373,50 @@ public class ZoneLobby {
if(gateBlock != null) {
BlockFace leftSide = null; // look at the zone
BlockFace rightSide = null;
if(wall == BlockFace.North) {
leftSide = BlockFace.East;
rightSide = BlockFace.West;
} else if(wall == BlockFace.East) {
leftSide = BlockFace.South;
rightSide = BlockFace.North;
} else if(wall == BlockFace.South) {
leftSide = BlockFace.West;
rightSide = BlockFace.East;
} else if(wall == BlockFace.West) {
leftSide = BlockFace.North;
rightSide = BlockFace.South;
if(wall == BlockFace.NORTH) {
leftSide = BlockFace.EAST;
rightSide = BlockFace.WEST;
} else if(wall == BlockFace.EAST) {
leftSide = BlockFace.SOUTH;
rightSide = BlockFace.NORTH;
} else if(wall == BlockFace.SOUTH) {
leftSide = BlockFace.WEST;
rightSide = BlockFace.EAST;
} else if(wall == BlockFace.WEST) {
leftSide = BlockFace.NORTH;
rightSide = BlockFace.SOUTH;
}
return (block.getX() == gateBlock.getX()
&& block.getY() == gateBlock.getY()
&& block.getZ() == gateBlock.getZ())
||
(block.getX() == gateBlock.getFace(BlockFace.Up).getX()
&& block.getY() == gateBlock.getFace(BlockFace.Up).getY()
&& block.getZ() == gateBlock.getFace(BlockFace.Up).getZ())
(block.getX() == gateBlock.getFace(BlockFace.UP).getX()
&& block.getY() == gateBlock.getFace(BlockFace.UP).getY()
&& block.getZ() == gateBlock.getFace(BlockFace.UP).getZ())
||
(block.getX() == gateBlock.getFace(leftSide).getX()
&& block.getY() == gateBlock.getFace(leftSide).getY()
&& block.getZ() == gateBlock.getFace(leftSide).getZ())
||
(block.getX() == gateBlock.getFace(leftSide).getFace(BlockFace.Up).getX()
&& block.getY() == gateBlock.getFace(leftSide).getFace(BlockFace.Up).getY()
&& block.getZ() == gateBlock.getFace(leftSide).getFace(BlockFace.Up).getZ())
(block.getX() == gateBlock.getFace(leftSide).getFace(BlockFace.UP).getX()
&& block.getY() == gateBlock.getFace(leftSide).getFace(BlockFace.UP).getY()
&& block.getZ() == gateBlock.getFace(leftSide).getFace(BlockFace.UP).getZ())
||
(block.getX() == gateBlock.getFace(leftSide).getFace(BlockFace.Up).getFace(BlockFace.Up).getX()
&& block.getY() == gateBlock.getFace(leftSide).getFace(BlockFace.Up).getFace(BlockFace.Up).getY()
&& block.getZ() == gateBlock.getFace(leftSide).getFace(BlockFace.Up).getFace(BlockFace.Up).getZ())
(block.getX() == gateBlock.getFace(leftSide).getFace(BlockFace.UP).getFace(BlockFace.UP).getX()
&& block.getY() == gateBlock.getFace(leftSide).getFace(BlockFace.UP).getFace(BlockFace.UP).getY()
&& block.getZ() == gateBlock.getFace(leftSide).getFace(BlockFace.UP).getFace(BlockFace.UP).getZ())
||
(block.getX() == gateBlock.getFace(BlockFace.Up).getFace(BlockFace.Up).getX()
&& block.getY() == gateBlock.getFace(BlockFace.Up).getFace(BlockFace.Up).getY()
&& block.getZ() == gateBlock.getFace(BlockFace.Up).getFace(BlockFace.Up).getZ())
(block.getX() == gateBlock.getFace(BlockFace.UP).getFace(BlockFace.UP).getX()
&& block.getY() == gateBlock.getFace(BlockFace.UP).getFace(BlockFace.UP).getY()
&& block.getZ() == gateBlock.getFace(BlockFace.UP).getFace(BlockFace.UP).getZ())
||
(block.getX() == gateBlock.getFace(rightSide).getFace(BlockFace.Up).getX()
&& block.getY() == gateBlock.getFace(rightSide).getFace(BlockFace.Up).getY()
&& block.getZ() == gateBlock.getFace(rightSide).getFace(BlockFace.Up).getZ())
(block.getX() == gateBlock.getFace(rightSide).getFace(BlockFace.UP).getX()
&& block.getY() == gateBlock.getFace(rightSide).getFace(BlockFace.UP).getY()
&& block.getZ() == gateBlock.getFace(rightSide).getFace(BlockFace.UP).getZ())
||
(block.getX() == gateBlock.getFace(rightSide).getFace(BlockFace.Up).getFace(BlockFace.Up).getX()
&& block.getY() == gateBlock.getFace(rightSide).getFace(BlockFace.Up).getFace(BlockFace.Up).getY()
&& block.getZ() == gateBlock.getFace(rightSide).getFace(BlockFace.Up).getFace(BlockFace.Up).getZ())
(block.getX() == gateBlock.getFace(rightSide).getFace(BlockFace.UP).getFace(BlockFace.UP).getX()
&& block.getY() == gateBlock.getFace(rightSide).getFace(BlockFace.UP).getFace(BlockFace.UP).getY()
&& block.getZ() == gateBlock.getFace(rightSide).getFace(BlockFace.UP).getFace(BlockFace.UP).getZ())
||
(block.getX() == gateBlock.getFace(rightSide).getX()
&& block.getY() == gateBlock.getFace(rightSide).getY()

View File

@ -2,11 +2,11 @@ package com.tommytony.war;
import java.util.List;
import org.bukkit.Block;
import org.bukkit.BlockFace;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Player;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import bukkit.tommytony.war.War;
@ -40,36 +40,36 @@ public class ZoneWallGuard {
// add wall guard blocks
for(Block block : nearestWallBlocks) {
toGlass(block, wall);
toGlass(block.getFace(BlockFace.Up), wall);
toGlass(block.getFace(BlockFace.Down), wall);
if(this.wall == BlockFace.North && warzone.getVolume().isNorthWallBlock(block)) {
toGlass(block.getFace(BlockFace.East), BlockFace.North);
toGlass(block.getFace(BlockFace.East).getFace(BlockFace.Up), BlockFace.North);
toGlass(block.getFace(BlockFace.East).getFace(BlockFace.Down), BlockFace.North);
toGlass(block.getFace(BlockFace.West), BlockFace.North);
toGlass(block.getFace(BlockFace.West).getFace(BlockFace.Up), BlockFace.North);
toGlass(block.getFace(BlockFace.West).getFace(BlockFace.Down), BlockFace.North);
} else if(this.wall == BlockFace.South && warzone.getVolume().isSouthWallBlock(block)) {
toGlass(block.getFace(BlockFace.East), BlockFace.South);
toGlass(block.getFace(BlockFace.East).getFace(BlockFace.Up), BlockFace.South);
toGlass(block.getFace(BlockFace.East).getFace(BlockFace.Down), BlockFace.South);
toGlass(block.getFace(BlockFace.West), BlockFace.South);
toGlass(block.getFace(BlockFace.West).getFace(BlockFace.Up), BlockFace.South);
toGlass(block.getFace(BlockFace.West).getFace(BlockFace.Down), BlockFace.South);
} else if(this.wall == BlockFace.East && warzone.getVolume().isEastWallBlock(block)) {
toGlass(block.getFace(BlockFace.North), BlockFace.East);
toGlass(block.getFace(BlockFace.North).getFace(BlockFace.Up), BlockFace.East);
toGlass(block.getFace(BlockFace.North).getFace(BlockFace.Down), BlockFace.East);
toGlass(block.getFace(BlockFace.South), BlockFace.West);
toGlass(block.getFace(BlockFace.South).getFace(BlockFace.Up), BlockFace.West);
toGlass(block.getFace(BlockFace.South).getFace(BlockFace.Down), BlockFace.West);
} else if(this.wall == BlockFace.West && warzone.getVolume().isWestWallBlock(block)) {
toGlass(block.getFace(BlockFace.North), BlockFace.West);
toGlass(block.getFace(BlockFace.North).getFace(BlockFace.Up), BlockFace.West);
toGlass(block.getFace(BlockFace.North).getFace(BlockFace.Down), BlockFace.West);
toGlass(block.getFace(BlockFace.South), BlockFace.West);
toGlass(block.getFace(BlockFace.South).getFace(BlockFace.Up), BlockFace.West);
toGlass(block.getFace(BlockFace.South).getFace(BlockFace.Down), BlockFace.West);
toGlass(block.getFace(BlockFace.UP), wall);
toGlass(block.getFace(BlockFace.DOWN), wall);
if(this.wall == BlockFace.NORTH && warzone.getVolume().isNorthWallBlock(block)) {
toGlass(block.getFace(BlockFace.EAST), BlockFace.NORTH);
toGlass(block.getFace(BlockFace.EAST).getFace(BlockFace.UP), BlockFace.NORTH);
toGlass(block.getFace(BlockFace.EAST).getFace(BlockFace.DOWN), BlockFace.NORTH);
toGlass(block.getFace(BlockFace.WEST), BlockFace.NORTH);
toGlass(block.getFace(BlockFace.WEST).getFace(BlockFace.UP), BlockFace.NORTH);
toGlass(block.getFace(BlockFace.WEST).getFace(BlockFace.DOWN), BlockFace.NORTH);
} else if(this.wall == BlockFace.SOUTH && warzone.getVolume().isSouthWallBlock(block)) {
toGlass(block.getFace(BlockFace.EAST), BlockFace.SOUTH);
toGlass(block.getFace(BlockFace.EAST).getFace(BlockFace.UP), BlockFace.SOUTH);
toGlass(block.getFace(BlockFace.EAST).getFace(BlockFace.DOWN), BlockFace.SOUTH);
toGlass(block.getFace(BlockFace.WEST), BlockFace.SOUTH);
toGlass(block.getFace(BlockFace.WEST).getFace(BlockFace.UP), BlockFace.SOUTH);
toGlass(block.getFace(BlockFace.WEST).getFace(BlockFace.DOWN), BlockFace.SOUTH);
} else if(this.wall == BlockFace.EAST && warzone.getVolume().isEastWallBlock(block)) {
toGlass(block.getFace(BlockFace.NORTH), BlockFace.EAST);
toGlass(block.getFace(BlockFace.NORTH).getFace(BlockFace.UP), BlockFace.EAST);
toGlass(block.getFace(BlockFace.NORTH).getFace(BlockFace.DOWN), BlockFace.EAST);
toGlass(block.getFace(BlockFace.SOUTH), BlockFace.WEST);
toGlass(block.getFace(BlockFace.SOUTH).getFace(BlockFace.UP), BlockFace.WEST);
toGlass(block.getFace(BlockFace.SOUTH).getFace(BlockFace.DOWN), BlockFace.WEST);
} else if(this.wall == BlockFace.WEST && warzone.getVolume().isWestWallBlock(block)) {
toGlass(block.getFace(BlockFace.NORTH), BlockFace.WEST);
toGlass(block.getFace(BlockFace.NORTH).getFace(BlockFace.UP), BlockFace.WEST);
toGlass(block.getFace(BlockFace.NORTH).getFace(BlockFace.DOWN), BlockFace.WEST);
toGlass(block.getFace(BlockFace.SOUTH), BlockFace.WEST);
toGlass(block.getFace(BlockFace.SOUTH).getFace(BlockFace.UP), BlockFace.WEST);
toGlass(block.getFace(BlockFace.SOUTH).getFace(BlockFace.DOWN), BlockFace.WEST);
}
}
}
@ -77,19 +77,19 @@ public class ZoneWallGuard {
private void toGlass(Block block, BlockFace wall) {
// face here means which wall we are working on
if(warzone.getLobby() == null || (warzone.getLobby() != null && !warzone.getLobby().blockIsAGateBlock(block, wall))){
if(wall == BlockFace.North) {
if(wall == BlockFace.NORTH) {
if(warzone.getVolume().isNorthWallBlock(block)) {
block.setType(Material.GLASS);
}
} else if (wall == BlockFace.South) {
} else if (wall == BlockFace.SOUTH) {
if(warzone.getVolume().isSouthWallBlock(block)) {
block.setType(Material.GLASS);
}
} else if (wall == BlockFace.East) {
} else if (wall == BlockFace.EAST) {
if(warzone.getVolume().isEastWallBlock(block)) {
block.setType(Material.GLASS);
}
} else if (wall == BlockFace.West) {
} else if (wall == BlockFace.WEST) {
if(warzone.getVolume().isWestWallBlock(block)) {
block.setType(Material.GLASS);
}

View File

@ -78,7 +78,7 @@ public class VolumeMapper {
int typeID = Integer.parseInt(blockSplit[0]);
byte data = Byte.parseByte(blockSplit[1]);
String[] lines = null;
if(typeID == Material.SIGN.getID() || typeID == Material.SIGN_POST.getID()) {
if(typeID == Material.SIGN.getId() || typeID == Material.SIGN_POST.getId()) {
String signLines = blockSplit[2];
if(blockSplit.length > 3) {
// sign includes commas
@ -150,11 +150,11 @@ public class VolumeMapper {
} else {
if(info.getType() == Material.SIGN || info.getType() == Material.SIGN_POST) {
String[] lines = info.getSignLines();
out.write(info.getTypeID() + "," + info.getData() + "," + lines[0] + "[line]" + lines[1]
out.write(info.getTypeId() + "," + info.getData() + "," + lines[0] + "[line]" + lines[1]
+ "[line]" + lines[2] + "[line]"+ lines[3]);
} else {
out.write(info.getTypeID() + "," + info.getData() + ",");
out.write(info.getTypeId() + "," + info.getData() + ",");
}
}
out.newLine();

View File

@ -3,9 +3,9 @@ import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import org.bukkit.ItemStack;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.inventory.ItemStack;
import bukkit.tommytony.war.War;
@ -140,7 +140,7 @@ public class WarMapper {
HashMap<Integer, ItemStack> items = war.getDefaultLoadout();
for(Integer slot : items.keySet()) {
ItemStack item = items.get(slot);
defaultLoadoutStr += item.getTypeID() + "," + item.getAmount() + "," + slot + ";";
defaultLoadoutStr += item.getTypeId() + "," + item.getAmount() + "," + slot + ";";
}
warConfig.setString("defaultLoadout", defaultLoadoutStr);

View File

@ -5,10 +5,10 @@ import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import org.bukkit.BlockFace;
import org.bukkit.ItemStack;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.BlockFace;
import org.bukkit.inventory.ItemStack;
import bukkit.tommytony.war.War;
@ -176,13 +176,13 @@ public class WarzoneMapper {
BlockFace lobbyFace = null;
if(lobbyStr != null && !lobbyStr.equals("")){
if(lobbyStr.equals("south")) {
lobbyFace = BlockFace.South;
lobbyFace = BlockFace.SOUTH;
} else if(lobbyStr.equals("east")) {
lobbyFace = BlockFace.East;
lobbyFace = BlockFace.EAST;
} else if(lobbyStr.equals("north")) {
lobbyFace = BlockFace.North;
lobbyFace = BlockFace.NORTH;
} else if(lobbyStr.equals("west")) {
lobbyFace = BlockFace.West;
lobbyFace = BlockFace.WEST;
}
Volume lobbyVolume = VolumeMapper.loadVolume("lobby", warzone.getName(), war, world);
ZoneLobby lobby = new ZoneLobby(war, warzone, lobbyFace, lobbyVolume);
@ -245,7 +245,7 @@ public class WarzoneMapper {
HashMap<Integer, ItemStack> items = warzone.getLoadout();
for(Integer slot : items.keySet()) {
ItemStack item = items.get(slot);
loadoutStr += item.getTypeID() + "," + item.getAmount() + "," + slot + ";";
loadoutStr += item.getTypeId() + "," + item.getAmount() + "," + slot + ";";
}
warzoneConfig.setString("loadout", loadoutStr);
@ -264,13 +264,13 @@ public class WarzoneMapper {
// lobby
String lobbyStr = "";
if(warzone.getLobby() != null) {
if(BlockFace.South == warzone.getLobby().getWall()) {
if(BlockFace.SOUTH == warzone.getLobby().getWall()) {
lobbyStr = "south";
} else if(BlockFace.East == warzone.getLobby().getWall()) {
} else if(BlockFace.EAST == warzone.getLobby().getWall()) {
lobbyStr = "east";
} else if(BlockFace.North == warzone.getLobby().getWall()) {
} else if(BlockFace.NORTH == warzone.getLobby().getWall()) {
lobbyStr = "north";
} else if(BlockFace.West == warzone.getLobby().getWall()) {
} else if(BlockFace.WEST == warzone.getLobby().getWall()) {
lobbyStr = "west";
}
}

View File

@ -1,7 +1,7 @@
package com.tommytony.war.volumes;
import org.bukkit.Block;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.block.Sign;
@ -22,7 +22,7 @@ public class BlockInfo {
this.x = block.getX();
this.y = block.getX();
this.z = block.getX();
this.type = block.getTypeID();
this.type = block.getTypeId();
this.data = block.getData();
}
@ -30,8 +30,8 @@ public class BlockInfo {
this.x = blockState.getX();
this.y = blockState.getX();
this.z = blockState.getX();
this.type = blockState.getTypeID();
this.data = blockState.getData();
this.type = blockState.getTypeId();
this.data = blockState.getData().getData();
if(is(Material.SIGN) || is(Material.SIGN_POST)) {
Sign sign = (Sign)blockState;
this.signLines = sign.getLines();
@ -56,7 +56,7 @@ public class BlockInfo {
return z;
}
public int getTypeID() {
public int getTypeId() {
return type;
}

View File

@ -1,8 +1,8 @@
package com.tommytony.war.volumes;
import org.bukkit.Block;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Block;
import bukkit.tommytony.war.War;

View File

@ -1,9 +1,9 @@
package com.tommytony.war.volumes;
import org.bukkit.Block;
import org.bukkit.BlockFace;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.block.Sign;
@ -79,7 +79,7 @@ public class VerticalVolume extends Volume{
int noOfResetBlocks = 0;
try {
if(hasTwoCorners() && getBlockInfos() != null) {
if(wall == BlockFace.East) {
if(wall == BlockFace.EAST) {
int z = getMinZ();
int k = 0;
int y = getMinY();
@ -97,7 +97,7 @@ public class VerticalVolume extends Volume{
}
y++;
}
} else if(wall == BlockFace.West) {
} else if(wall == BlockFace.WEST) {
int z = getMaxZ();
int k = getSizeZ()-1;
int y = getMinY();
@ -115,7 +115,7 @@ public class VerticalVolume extends Volume{
}
y++;
}
} else if(wall == BlockFace.North) {
} else if(wall == BlockFace.NORTH) {
int x = getMinX();
int i = 0;
int y = getMinY();
@ -133,7 +133,7 @@ public class VerticalVolume extends Volume{
}
y++;
}
} else if(wall == BlockFace.South) {
} else if(wall == BlockFace.SOUTH) {
int x = getMaxX();
int i = getSizeX()-1;
int y = getMinY();
@ -160,9 +160,9 @@ public class VerticalVolume extends Volume{
}
private boolean resetBlock(BlockInfo oldBlockInfo, Block currentBlock) {
if(currentBlock.getTypeID() != oldBlockInfo.getTypeID() ||
(currentBlock.getTypeID() == oldBlockInfo.getTypeID() && currentBlock.getData() != oldBlockInfo.getData()) ||
(currentBlock.getTypeID() == oldBlockInfo.getTypeID() && currentBlock.getData() == oldBlockInfo.getData() &&
if(currentBlock.getTypeId() != oldBlockInfo.getTypeId() ||
(currentBlock.getTypeId() == oldBlockInfo.getTypeId() && currentBlock.getData() != oldBlockInfo.getData()) ||
(currentBlock.getTypeId() == oldBlockInfo.getTypeId() && currentBlock.getData() == oldBlockInfo.getData() &&
(oldBlockInfo.is(Material.SIGN) || oldBlockInfo.is(Material.SIGN_POST))
)
) {

View File

@ -1,10 +1,10 @@
package com.tommytony.war.volumes;
import org.bukkit.Block;
import org.bukkit.BlockFace;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.block.Sign;
@ -80,9 +80,9 @@ public class Volume {
for(int k = 0;k < getSizeZ(); k++) {
BlockInfo oldBlockInfo = getBlockInfos()[i][j][k];
Block currentBlock = getWorld().getBlockAt(x, y, z);
if(currentBlock.getTypeID() != oldBlockInfo.getTypeID() ||
(currentBlock.getTypeID() == oldBlockInfo.getTypeID() && currentBlock.getData() != oldBlockInfo.getData()) ||
(currentBlock.getTypeID() == oldBlockInfo.getTypeID() && currentBlock.getData() == oldBlockInfo.getData() &&
if(currentBlock.getTypeId() != oldBlockInfo.getTypeId() ||
(currentBlock.getTypeId() == oldBlockInfo.getTypeId() && currentBlock.getData() != oldBlockInfo.getData()) ||
(currentBlock.getTypeId() == oldBlockInfo.getTypeId() && currentBlock.getData() == oldBlockInfo.getData() &&
(oldBlockInfo.is(Material.SIGN) || oldBlockInfo.is(Material.SIGN_POST))
)
) {
@ -336,12 +336,12 @@ public class Volume {
for(int j = 0; j < getSizeY(); j++){
int z = getMinZ();
for(int k = 0;k < getSizeZ(); k++) {
if((face == BlockFace.Down && y == getMinY())
|| (face == BlockFace.Up && y == getMaxY())
|| (face == BlockFace.North && x == getMinX())
|| (face == BlockFace.East && z == getMinZ())
|| (face == BlockFace.South && x == getMaxX())
|| (face == BlockFace.West && z == getMaxZ())) {
if((face == BlockFace.DOWN && y == getMinY())
|| (face == BlockFace.UP && y == getMaxY())
|| (face == BlockFace.NORTH && x == getMinX())
|| (face == BlockFace.EAST && z == getMinZ())
|| (face == BlockFace.SOUTH && x == getMaxX())
|| (face == BlockFace.WEST && z == getMaxZ())) {
Block currentBlock = getWorld().getBlockAt(x, y, z);
currentBlock.setType(material);
}