From 21f75477664f7e22613dd080204654868b4a32b7 Mon Sep 17 00:00:00 2001 From: taoneill Date: Mon, 9 May 2011 00:12:49 -0400 Subject: [PATCH] Added ZoneWallGuards for UP and DOWN walls, and changed related Warzone methods. Fixed warnings. --- .../main/java/bukkit/tommytony/war/War.java | 10 +- .../tommytony/war/WarBlockListener.java | 1 - .../tommytony/war/WarPlayerListener.java | 6 - war/src/main/java/com/tommytony/war/Team.java | 5 +- .../java/com/tommytony/war/TeamKinds.java | 2 +- .../main/java/com/tommytony/war/WarHub.java | 5 - .../main/java/com/tommytony/war/Warzone.java | 110 ++++++++++++++---- .../java/com/tommytony/war/ZoneLobby.java | 4 - .../java/com/tommytony/war/ZoneWallGuard.java | 67 +++++++++-- .../war/jobs/RestoreDeadmanInventoryJob.java | 1 - .../tommytony/war/mappers/VolumeMapper.java | 12 -- .../tommytony/war/mappers/WarzoneMapper.java | 1 - .../com/tommytony/war/volumes/BlockInfo.java | 2 - 13 files changed, 152 insertions(+), 74 deletions(-) diff --git a/war/src/main/java/bukkit/tommytony/war/War.java b/war/src/main/java/bukkit/tommytony/war/War.java index badf085..d5403c3 100644 --- a/war/src/main/java/bukkit/tommytony/war/War.java +++ b/war/src/main/java/bukkit/tommytony/war/War.java @@ -439,7 +439,6 @@ public class War extends JavaPlugin { } else { lobby = warzone.getLobby(); } - List teams = warzone.getTeams(); Team team = warzone.getTeamByKind(TeamKinds.teamKindFromString(name)); if(team != null) { if(team.getFlagVolume() != null) team.getFlagVolume().resetBlocks(); @@ -467,7 +466,6 @@ public class War extends JavaPlugin { "Must be in a warzone (try /zones and /zone). "); } else { TeamKind kind = TeamKinds.teamKindFromString(arguments[0]); - String name = arguments[0]; Warzone warzone = this.warzone(player.getLocation()); Team team = warzone.getTeamByKind(kind); if(team == null) { @@ -573,7 +571,6 @@ public class War extends JavaPlugin { } else { lobby = warzone.getLobby(); } - int resetBlocks = 0; warzone.clearFlagThieves(); for(Team team: warzone.getTeams()) { team.teamcast("The war has ended. " + playerListener.getAllTeamsMsg(player) + " Resetting warzone " + warzone.getName() + " and teams..."); @@ -1373,7 +1370,7 @@ public class War extends JavaPlugin { public Warzone zoneOfZoneWallAtProximity(Location location) { for(Warzone zone : warzones) { - if(zone.isNearWall(location)) return zone; + if(zone.getWorld() == location.getWorld() && zone.isNearWall(location)) return zone; } return null; } @@ -1382,6 +1379,7 @@ public class War extends JavaPlugin { return zoneMakerNames; } + @SuppressWarnings("static-access") public boolean canPlayWar(Player player) { if(Permissions != null && (Permissions.Security.permission(player, "war.player") @@ -1395,6 +1393,7 @@ public class War extends JavaPlugin { return false; } + @SuppressWarnings("static-access") public boolean canWarp(Player player) { if(Permissions != null && (Permissions.Security.permission(player, "war.warp") @@ -1408,6 +1407,7 @@ public class War extends JavaPlugin { return false; } + @SuppressWarnings("static-access") public boolean canBuildOutsideZone(Player player) { if(isBuildInZonesOnly()) { if(Permissions != null @@ -1422,6 +1422,7 @@ public class War extends JavaPlugin { } } + @SuppressWarnings("static-access") public boolean isZoneMaker(Player player) { boolean isPlayerImpersonator = false; for(String disguised : zoneMakersImpersonatingPlayers) { @@ -1524,6 +1525,7 @@ public class War extends JavaPlugin { return zoneMakersImpersonatingPlayers; } + @SuppressWarnings("static-access") public void setupPermissions() { Plugin test = this.getServer().getPluginManager().getPlugin("Permissions"); diff --git a/war/src/main/java/bukkit/tommytony/war/WarBlockListener.java b/war/src/main/java/bukkit/tommytony/war/WarBlockListener.java index c63ea4e..c62c3aa 100644 --- a/war/src/main/java/bukkit/tommytony/war/WarBlockListener.java +++ b/war/src/main/java/bukkit/tommytony/war/WarBlockListener.java @@ -32,7 +32,6 @@ public class WarBlockListener extends BlockListener { public void onBlockPlace(BlockPlaceEvent event) { Player player = event.getPlayer(); Block block = event.getBlock(); - boolean captured = false; if(player != null && block != null) { Team team = war.getPlayerTeam(player.getName()); Warzone zone = war.warzone(player.getLocation()); diff --git a/war/src/main/java/bukkit/tommytony/war/WarPlayerListener.java b/war/src/main/java/bukkit/tommytony/war/WarPlayerListener.java index cefcbf1..58d00b4 100644 --- a/war/src/main/java/bukkit/tommytony/war/WarPlayerListener.java +++ b/war/src/main/java/bukkit/tommytony/war/WarPlayerListener.java @@ -7,10 +7,8 @@ import org.bukkit.Material; import org.bukkit.craftbukkit.entity.CraftItem; import org.bukkit.entity.Item; import org.bukkit.entity.Player; -import org.bukkit.event.player.PlayerChatEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerDropItemEvent; -import org.bukkit.event.player.PlayerEvent; import org.bukkit.event.player.PlayerInventoryEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerListener; @@ -22,11 +20,9 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; import com.tommytony.war.Team; -import com.tommytony.war.TeamKinds; import com.tommytony.war.WarHub; import com.tommytony.war.Warzone; import com.tommytony.war.ZoneLobby; -import com.tommytony.war.jobs.RestoreDeadmanInventoryJob; import com.tommytony.war.utils.InventoryStash; @@ -232,7 +228,6 @@ public class WarPlayerListener extends PlayerListener { Warzone zone = locLobby.getZone(); Team oldTeam = war.getPlayerTeam(player.getName()); boolean isAutoAssignGate = false; - boolean isSomeTeamGate = false; if(oldTeam == null && canPlay) { // trying to counter spammy player move isAutoAssignGate = zone.getLobby().isAutoAssignGate(playerLoc); if(isAutoAssignGate) { @@ -287,7 +282,6 @@ public class WarPlayerListener extends PlayerListener { event.setCancelled(true); war.badMsg(player, "Team " + team.getName() + " is full."); } - isSomeTeamGate = true; return; } } diff --git a/war/src/main/java/com/tommytony/war/Team.java b/war/src/main/java/com/tommytony/war/Team.java index ffdbe43..97fd8e8 100644 --- a/war/src/main/java/com/tommytony/war/Team.java +++ b/war/src/main/java/com/tommytony/war/Team.java @@ -7,10 +7,7 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -import org.bukkit.block.BlockState; -import org.bukkit.block.Sign; import org.bukkit.entity.Player; -import org.bukkit.material.MaterialData; import bukkit.tommytony.war.War; @@ -64,6 +61,7 @@ public class Team { } } + @SuppressWarnings("unused") public void initializeTeamSpawn() { // make air this.spawnVolume.setToMaterial(Material.AIR); @@ -426,6 +424,7 @@ public class Team { this.flagVolume.setCornerTwo(warzone.getWorld().getBlockAt(x+1, y+3, z+1)); } + @SuppressWarnings("unused") public void initializeTeamFlag() { // make air this.flagVolume.setToMaterial(Material.AIR); diff --git a/war/src/main/java/com/tommytony/war/TeamKinds.java b/war/src/main/java/com/tommytony/war/TeamKinds.java index cfbea33..adcaea5 100644 --- a/war/src/main/java/com/tommytony/war/TeamKinds.java +++ b/war/src/main/java/com/tommytony/war/TeamKinds.java @@ -36,7 +36,7 @@ public class TeamKinds { public static TeamKind teamKindFromString(String str) { String lowered = str.toLowerCase(); for(TeamKind kind : getTeamkinds()) { - if(kind.getDefaultName().startsWith(str)) { + if(kind.getDefaultName().startsWith(lowered)) { return kind; } } diff --git a/war/src/main/java/com/tommytony/war/WarHub.java b/war/src/main/java/com/tommytony/war/WarHub.java index a431dc9..f4bd22b 100644 --- a/war/src/main/java/com/tommytony/war/WarHub.java +++ b/war/src/main/java/com/tommytony/war/WarHub.java @@ -1,17 +1,12 @@ package com.tommytony.war; -import java.util.ArrayList; import java.util.HashMap; -import java.util.List; import java.util.Map; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -import org.bukkit.block.BlockState; -import org.bukkit.block.Sign; -import org.bukkit.material.MaterialData; import bukkit.tommytony.war.War; diff --git a/war/src/main/java/com/tommytony/war/Warzone.java b/war/src/main/java/com/tommytony/war/Warzone.java index 6902129..f988dca 100644 --- a/war/src/main/java/com/tommytony/war/Warzone.java +++ b/war/src/main/java/com/tommytony/war/Warzone.java @@ -17,12 +17,8 @@ import bukkit.tommytony.war.War; import com.tommytony.war.jobs.InitZoneJob; import com.tommytony.war.jobs.LoadoutResetJob; -import com.tommytony.war.jobs.ResetCursorJob; -import com.tommytony.war.jobs.RespawnPlayerJob; import com.tommytony.war.jobs.ScoreCapReachedJob; import com.tommytony.war.utils.InventoryStash; -import com.tommytony.war.volumes.BlockInfo; -import com.tommytony.war.volumes.VerticalVolume; import com.tommytony.war.volumes.ZoneVolume; /** @@ -624,20 +620,40 @@ public class Warzone { if(volume.hasTwoCorners()) { if(Math.abs(volume.getSoutheastZ() - latestPlayerLocation.getBlockZ()) < minSafeDistanceFromWall && latestPlayerLocation.getBlockX() <= volume.getSoutheastX() - && latestPlayerLocation.getBlockX() >= volume.getNorthwestX()) { + && latestPlayerLocation.getBlockX() >= volume.getNorthwestX() + && latestPlayerLocation.getBlockY() >= volume.getMinY() + && latestPlayerLocation.getBlockY() <= volume.getMaxY()) { return true; // near east wall } else if (Math.abs(volume.getSoutheastX() - latestPlayerLocation.getBlockX()) < minSafeDistanceFromWall && latestPlayerLocation.getBlockZ() <= volume.getNorthwestZ() - && latestPlayerLocation.getBlockZ() >= volume.getSoutheastZ()) { + && latestPlayerLocation.getBlockZ() >= volume.getSoutheastZ() + && latestPlayerLocation.getBlockY() >= volume.getMinY() + && latestPlayerLocation.getBlockY() <= volume.getMaxY()) { return true; // near south wall } else if (Math.abs(volume.getNorthwestX() - latestPlayerLocation.getBlockX()) < minSafeDistanceFromWall && latestPlayerLocation.getBlockZ() <= volume.getNorthwestZ() - && latestPlayerLocation.getBlockZ() >= volume.getSoutheastZ()) { + && latestPlayerLocation.getBlockZ() >= volume.getSoutheastZ() + && latestPlayerLocation.getBlockY() >= volume.getMinY() + && latestPlayerLocation.getBlockY() <= volume.getMaxY()) { return true; // near north wall } else if (Math.abs(volume.getNorthwestZ() - latestPlayerLocation.getBlockZ()) < minSafeDistanceFromWall && latestPlayerLocation.getBlockX() <= volume.getSoutheastX() - && latestPlayerLocation.getBlockX() >= volume.getNorthwestX()) { + && latestPlayerLocation.getBlockX() >= volume.getNorthwestX() + && latestPlayerLocation.getBlockY() >= volume.getMinY() + && latestPlayerLocation.getBlockY() <= volume.getMaxY()) { return true; // near west wall + } else if (Math.abs(volume.getMaxY() - latestPlayerLocation.getBlockY()) < minSafeDistanceFromWall + && latestPlayerLocation.getBlockX() <= volume.getMaxX() + && latestPlayerLocation.getBlockX() >= volume.getMinX() + && latestPlayerLocation.getBlockZ() <= volume.getMaxZ() + && latestPlayerLocation.getBlockZ() >= volume.getMinZ()) { + return true; // near up wall + } else if (Math.abs(volume.getMinY() - latestPlayerLocation.getBlockY()) < minSafeDistanceFromWall + && latestPlayerLocation.getBlockX() <= volume.getMaxX() + && latestPlayerLocation.getBlockX() >= volume.getMinX() + && latestPlayerLocation.getBlockZ() <= volume.getMaxZ() + && latestPlayerLocation.getBlockZ() >= volume.getMinZ()) { + return true; // near down wall } } return false; @@ -647,15 +663,19 @@ public class Warzone { List nearestWallBlocks = new ArrayList(); if(Math.abs(volume.getSoutheastZ() - latestPlayerLocation.getBlockZ()) < minSafeDistanceFromWall && latestPlayerLocation.getBlockX() <= volume.getSoutheastX() - && latestPlayerLocation.getBlockX() >= volume.getNorthwestX()) { + && latestPlayerLocation.getBlockX() >= volume.getNorthwestX() + && latestPlayerLocation.getBlockY() >= volume.getMinY() + && latestPlayerLocation.getBlockY() <= volume.getMaxY()) { // near east wall - Block eastWallBlock = world.getBlockAt(latestPlayerLocation.getBlockX() + 1, latestPlayerLocation.getBlockY(), volume.getSoutheastZ()); + Block eastWallBlock = world.getBlockAt(latestPlayerLocation.getBlockX() + 1, latestPlayerLocation.getBlockY() + 1, volume.getSoutheastZ()); nearestWallBlocks.add(eastWallBlock); } if (Math.abs(volume.getSoutheastX() - latestPlayerLocation.getBlockX()) < minSafeDistanceFromWall && latestPlayerLocation.getBlockZ() <= volume.getNorthwestZ() - && latestPlayerLocation.getBlockZ() >= volume.getSoutheastZ()) { + && latestPlayerLocation.getBlockZ() >= volume.getSoutheastZ() + && latestPlayerLocation.getBlockY() >= volume.getMinY() + && latestPlayerLocation.getBlockY() <= volume.getMaxY()) { // near south wall Block southWallBlock = world.getBlockAt(volume.getSoutheastX(), latestPlayerLocation.getBlockY() + 1, latestPlayerLocation.getBlockZ()); nearestWallBlocks.add(southWallBlock); @@ -663,7 +683,9 @@ public class Warzone { if (Math.abs(volume.getNorthwestX() - latestPlayerLocation.getBlockX()) < minSafeDistanceFromWall && latestPlayerLocation.getBlockZ() <= volume.getNorthwestZ() - && latestPlayerLocation.getBlockZ() >= volume.getSoutheastZ()) { + && latestPlayerLocation.getBlockZ() >= volume.getSoutheastZ() + && latestPlayerLocation.getBlockY() >= volume.getMinY() + && latestPlayerLocation.getBlockY() <= volume.getMaxY()) { // near north wall Block northWallBlock = world.getBlockAt(volume.getNorthwestX(), latestPlayerLocation.getBlockY() + 1, latestPlayerLocation.getBlockZ()); nearestWallBlocks.add(northWallBlock); @@ -671,11 +693,33 @@ public class Warzone { if (Math.abs(volume.getNorthwestZ() - latestPlayerLocation.getBlockZ()) < minSafeDistanceFromWall && latestPlayerLocation.getBlockX() <= volume.getSoutheastX() - && latestPlayerLocation.getBlockX() >= volume.getNorthwestX()) { + && latestPlayerLocation.getBlockX() >= volume.getNorthwestX() + && latestPlayerLocation.getBlockY() >= volume.getMinY() + && latestPlayerLocation.getBlockY() <= volume.getMaxY()) { // near west wall Block westWallBlock = world.getBlockAt(latestPlayerLocation.getBlockX(), latestPlayerLocation.getBlockY() + 1, volume.getNorthwestZ()); nearestWallBlocks.add(westWallBlock); } + + if (Math.abs(volume.getMaxY() - latestPlayerLocation.getBlockY()) < minSafeDistanceFromWall + && latestPlayerLocation.getBlockX() <= volume.getMaxX() + && latestPlayerLocation.getBlockX() >= volume.getMinX() + && latestPlayerLocation.getBlockZ() <= volume.getMaxZ() + && latestPlayerLocation.getBlockZ() >= volume.getMinZ()) { + // near up wall + Block upWallBlock = world.getBlockAt(latestPlayerLocation.getBlockX(), volume.getMaxY(), latestPlayerLocation.getBlockZ()); + nearestWallBlocks.add(upWallBlock); + } + + if (Math.abs(volume.getMinY() - latestPlayerLocation.getBlockY()) < minSafeDistanceFromWall + && latestPlayerLocation.getBlockX() <= volume.getMaxX() + && latestPlayerLocation.getBlockX() >= volume.getMinX() + && latestPlayerLocation.getBlockZ() <= volume.getMaxZ() + && latestPlayerLocation.getBlockZ() >= volume.getMinZ()) { + // near down wall + Block downWallBlock = world.getBlockAt(latestPlayerLocation.getBlockX(), volume.getMinY(), latestPlayerLocation.getBlockZ()); + nearestWallBlocks.add(downWallBlock); + } return nearestWallBlocks; // note: y + 1 to line up 3 sided square with player eyes } @@ -684,31 +728,57 @@ public class Warzone { List walls = new ArrayList(); if(Math.abs(volume.getSoutheastZ() - latestPlayerLocation.getBlockZ()) < minSafeDistanceFromWall && latestPlayerLocation.getBlockX() <= volume.getSoutheastX() - && latestPlayerLocation.getBlockX() >= volume.getNorthwestX()) { + && latestPlayerLocation.getBlockX() >= volume.getNorthwestX() + && latestPlayerLocation.getBlockY() >= volume.getMinY() + && latestPlayerLocation.getBlockY() <= volume.getMaxY()) { // near east wall walls.add(BlockFace.EAST); } if (Math.abs(volume.getSoutheastX() - latestPlayerLocation.getBlockX()) < minSafeDistanceFromWall && latestPlayerLocation.getBlockZ() <= volume.getNorthwestZ() - && latestPlayerLocation.getBlockZ() >= volume.getSoutheastZ()) { + && latestPlayerLocation.getBlockZ() >= volume.getSoutheastZ() + && latestPlayerLocation.getBlockY() >= volume.getMinY() + && latestPlayerLocation.getBlockY() <= volume.getMaxY()) { // near south wall walls.add(BlockFace.SOUTH); } if (Math.abs(volume.getNorthwestX() - latestPlayerLocation.getBlockX()) < minSafeDistanceFromWall && latestPlayerLocation.getBlockZ() <= volume.getNorthwestZ() - && latestPlayerLocation.getBlockZ() >= volume.getSoutheastZ()) { + && latestPlayerLocation.getBlockZ() >= volume.getSoutheastZ() + && latestPlayerLocation.getBlockY() >= volume.getMinY() + && latestPlayerLocation.getBlockY() <= volume.getMaxY()) { // near north wall walls.add(BlockFace.NORTH); } if (Math.abs(volume.getNorthwestZ() - latestPlayerLocation.getBlockZ()) < minSafeDistanceFromWall && latestPlayerLocation.getBlockX() <= volume.getSoutheastX() - && latestPlayerLocation.getBlockX() >= volume.getNorthwestX()) { + && latestPlayerLocation.getBlockX() >= volume.getNorthwestX() + && latestPlayerLocation.getBlockY() >= volume.getMinY() + && latestPlayerLocation.getBlockY() <= volume.getMaxY()) { // near west wall walls.add(BlockFace.WEST); } + + if (Math.abs(volume.getMaxY() - latestPlayerLocation.getBlockY()) < minSafeDistanceFromWall + && latestPlayerLocation.getBlockX() <= volume.getMaxX() + && latestPlayerLocation.getBlockX() >= volume.getMinX() + && latestPlayerLocation.getBlockZ() <= volume.getMaxZ() + && latestPlayerLocation.getBlockZ() >= volume.getMinZ()) { + // near up wall + walls.add(BlockFace.UP); + } + + if (Math.abs(volume.getMinY() - latestPlayerLocation.getBlockY()) < minSafeDistanceFromWall + && latestPlayerLocation.getBlockX() <= volume.getMaxX() + && latestPlayerLocation.getBlockX() >= volume.getMinX() + && latestPlayerLocation.getBlockZ() <= volume.getMaxZ() + && latestPlayerLocation.getBlockZ() >= volume.getMinZ()) { + // near down wall + walls.add(BlockFace.DOWN); + } return walls; } @@ -742,7 +812,6 @@ public class Warzone { for(ZoneWallGuard guard : zoneWallGuards) { if(guard.getPlayer().getName().equals(player.getName())){ playerGuards.add(guard); - int reset = volume.resetWallBlocks(guard.getWall()); // this should restore old blocks if(isDrawZoneOutline()) { addZoneOutline(guard.getWall()); } @@ -751,7 +820,6 @@ public class Warzone { // because player can go around corner lobby.initialize(); } - //war.getLogger().info("Reset " + reset + " blocks in " + guard.getWall() + " wall of warzone " + name); } } // now remove those zone guards @@ -835,8 +903,6 @@ public class Warzone { if(playerTeam != null && playerWarzone != null) { // teleport to team spawn upon death war.msg(player, "You died."); - boolean newBattle = false; - boolean scoreCapReached = false; playerWarzone.respawnPlayer(playerTeam, player); int remaining = playerTeam.getRemainingLifes(); if(remaining == 0) { // your death caused your team to lose @@ -879,7 +945,6 @@ public class Warzone { // we dont restore his inventory in handleScoreCapReached // check out PLAYER_MOVE for the rest of the fix - scoreCapReached = true; } else { // A new battle starts. Reset the zone but not the teams. for(Team t : teams) { @@ -887,7 +952,6 @@ public class Warzone { } playerWarzone.getVolume().resetBlocksAsJob(); playerWarzone.initializeZoneAsJob(player); - newBattle = true; } } else { // player died without causing his team's demise diff --git a/war/src/main/java/com/tommytony/war/ZoneLobby.java b/war/src/main/java/com/tommytony/war/ZoneLobby.java index 9489523..33dbbad 100644 --- a/war/src/main/java/com/tommytony/war/ZoneLobby.java +++ b/war/src/main/java/com/tommytony/war/ZoneLobby.java @@ -6,16 +6,13 @@ import java.util.Map; 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.craftbukkit.CraftWorld; import bukkit.tommytony.war.War; import com.tommytony.war.utils.SignHelper; import com.tommytony.war.volumes.BlockInfo; -import com.tommytony.war.volumes.VerticalVolume; import com.tommytony.war.volumes.Volume; import com.tommytony.war.volumes.ZoneVolume; @@ -192,7 +189,6 @@ public class ZoneLobby { // add team gates or single auto assign gate placeAutoAssignGate(); - int i = 0; for(String teamName : teamGateBlocks.keySet()) { BlockInfo gateInfo = teamGateBlocks.get(teamName); placeGate(BlockInfo.getBlock(warzone.getWorld(), gateInfo), TeamKinds.teamKindFromString(teamName)); diff --git a/war/src/main/java/com/tommytony/war/ZoneWallGuard.java b/war/src/main/java/com/tommytony/war/ZoneWallGuard.java index a7194f0..f8add14 100644 --- a/war/src/main/java/com/tommytony/war/ZoneWallGuard.java +++ b/war/src/main/java/com/tommytony/war/ZoneWallGuard.java @@ -19,15 +19,10 @@ public class ZoneWallGuard { private Player player; private Warzone warzone; private Location playerLocation; - private final War war; private BlockFace wall; - private final int radius = 3; - - public ZoneWallGuard(Player player, War war, Warzone warzone, BlockFace wall) { this.player = player; - this.war = war; this.wall = wall; this.playerLocation = player.getLocation(); this.warzone = warzone; @@ -40,10 +35,12 @@ public class ZoneWallGuard { // add wall guard blocks for(Block block : nearestWallBlocks) { toGlass(block, wall); - toGlass(block.getFace(BlockFace.UP), wall); - toGlass(block.getFace(BlockFace.UP, 2), wall); - toGlass(block.getFace(BlockFace.DOWN), wall); - toGlass(block.getFace(BlockFace.DOWN, 2), wall); + if(this.wall != BlockFace.UP && this.wall != BlockFace.DOWN) { + toGlass(block.getFace(BlockFace.UP), wall); + toGlass(block.getFace(BlockFace.UP, 2), wall); + toGlass(block.getFace(BlockFace.DOWN), wall); + toGlass(block.getFace(BlockFace.DOWN, 2), 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); @@ -107,13 +104,53 @@ public class ZoneWallGuard { 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.SOUTH).getFace(BlockFace.UP), BlockFace.WEST); - toGlass(block.getFace(BlockFace.SOUTH).getFace(BlockFace.DOWN), BlockFace.WEST); toGlass(block.getFace(BlockFace.SOUTH, 2), BlockFace.WEST); toGlass(block.getFace(BlockFace.SOUTH, 2).getFace(BlockFace.UP), BlockFace.WEST); toGlass(block.getFace(BlockFace.SOUTH, 2).getFace(BlockFace.DOWN), BlockFace.WEST); toGlass(block.getFace(BlockFace.SOUTH).getFace(BlockFace.UP, 2), BlockFace.WEST); toGlass(block.getFace(BlockFace.SOUTH).getFace(BlockFace.DOWN, 2), BlockFace.WEST); + } else if(this.wall == BlockFace.UP && warzone.getVolume().isUpWallBlock(block)) { + toGlass(block.getFace(BlockFace.EAST), BlockFace.UP); + toGlass(block.getFace(BlockFace.EAST, 2), BlockFace.UP); + toGlass(block.getFace(BlockFace.WEST), BlockFace.UP); + toGlass(block.getFace(BlockFace.WEST, 2), BlockFace.UP); + toGlass(block.getFace(BlockFace.NORTH), BlockFace.UP); + toGlass(block.getFace(BlockFace.NORTH).getFace(BlockFace.EAST), BlockFace.UP); + toGlass(block.getFace(BlockFace.NORTH).getFace(BlockFace.WEST), BlockFace.UP); + toGlass(block.getFace(BlockFace.NORTH, 2), BlockFace.UP); + toGlass(block.getFace(BlockFace.NORTH, 2).getFace(BlockFace.EAST), BlockFace.UP); + toGlass(block.getFace(BlockFace.NORTH, 2).getFace(BlockFace.WEST), BlockFace.UP); + toGlass(block.getFace(BlockFace.NORTH).getFace(BlockFace.EAST, 2), BlockFace.UP); + toGlass(block.getFace(BlockFace.NORTH).getFace(BlockFace.WEST, 2), BlockFace.UP); + toGlass(block.getFace(BlockFace.SOUTH), BlockFace.UP); + toGlass(block.getFace(BlockFace.SOUTH).getFace(BlockFace.EAST), BlockFace.UP); + toGlass(block.getFace(BlockFace.SOUTH).getFace(BlockFace.WEST), BlockFace.UP); + toGlass(block.getFace(BlockFace.SOUTH, 2), BlockFace.UP); + toGlass(block.getFace(BlockFace.SOUTH, 2).getFace(BlockFace.EAST), BlockFace.UP); + toGlass(block.getFace(BlockFace.SOUTH, 2).getFace(BlockFace.WEST), BlockFace.UP); + toGlass(block.getFace(BlockFace.SOUTH).getFace(BlockFace.UP, 2), BlockFace.UP); + toGlass(block.getFace(BlockFace.SOUTH).getFace(BlockFace.DOWN, 2), BlockFace.UP); + } else if (this.wall == BlockFace.DOWN && warzone.getVolume().isDownWallBlock(block)) { + toGlass(block.getFace(BlockFace.EAST), BlockFace.DOWN); + toGlass(block.getFace(BlockFace.EAST, 2), BlockFace.DOWN); + toGlass(block.getFace(BlockFace.WEST), BlockFace.DOWN); + toGlass(block.getFace(BlockFace.WEST, 2), BlockFace.DOWN); + toGlass(block.getFace(BlockFace.NORTH), BlockFace.DOWN); + toGlass(block.getFace(BlockFace.NORTH).getFace(BlockFace.EAST), BlockFace.DOWN); + toGlass(block.getFace(BlockFace.NORTH).getFace(BlockFace.WEST), BlockFace.DOWN); + toGlass(block.getFace(BlockFace.NORTH, 2), BlockFace.DOWN); + toGlass(block.getFace(BlockFace.NORTH, 2).getFace(BlockFace.EAST), BlockFace.DOWN); + toGlass(block.getFace(BlockFace.NORTH, 2).getFace(BlockFace.WEST), BlockFace.DOWN); + toGlass(block.getFace(BlockFace.NORTH).getFace(BlockFace.EAST, 2), BlockFace.DOWN); + toGlass(block.getFace(BlockFace.NORTH).getFace(BlockFace.WEST, 2), BlockFace.DOWN); + toGlass(block.getFace(BlockFace.SOUTH), BlockFace.DOWN); + toGlass(block.getFace(BlockFace.SOUTH).getFace(BlockFace.EAST), BlockFace.DOWN); + toGlass(block.getFace(BlockFace.SOUTH).getFace(BlockFace.WEST), BlockFace.DOWN); + toGlass(block.getFace(BlockFace.SOUTH, 2), BlockFace.DOWN); + toGlass(block.getFace(BlockFace.SOUTH, 2).getFace(BlockFace.EAST), BlockFace.DOWN); + toGlass(block.getFace(BlockFace.SOUTH, 2).getFace(BlockFace.WEST), BlockFace.DOWN); + toGlass(block.getFace(BlockFace.SOUTH).getFace(BlockFace.DOWN, 2), BlockFace.DOWN); + toGlass(block.getFace(BlockFace.SOUTH).getFace(BlockFace.DOWN, 2), BlockFace.DOWN); } } } @@ -137,6 +174,14 @@ public class ZoneWallGuard { if(warzone.getVolume().isWestWallBlock(block)) { block.setType(Material.GLASS); } + } else if (wall == BlockFace.UP) { + if(warzone.getVolume().isUpWallBlock(block)) { + block.setType(Material.GLASS); + } + } else if (wall == BlockFace.DOWN) { + if(warzone.getVolume().isDownWallBlock(block)) { + block.setType(Material.GLASS); + } } } } diff --git a/war/src/main/java/com/tommytony/war/jobs/RestoreDeadmanInventoryJob.java b/war/src/main/java/com/tommytony/war/jobs/RestoreDeadmanInventoryJob.java index 2dc34c2..987eb09 100644 --- a/war/src/main/java/com/tommytony/war/jobs/RestoreDeadmanInventoryJob.java +++ b/war/src/main/java/com/tommytony/war/jobs/RestoreDeadmanInventoryJob.java @@ -8,7 +8,6 @@ public class RestoreDeadmanInventoryJob implements Runnable { private final Player player; private final Warzone zone; - private boolean giveReward; public RestoreDeadmanInventoryJob(Player player, Warzone zone) { this.player = player; diff --git a/war/src/main/java/com/tommytony/war/mappers/VolumeMapper.java b/war/src/main/java/com/tommytony/war/mappers/VolumeMapper.java index 8380d1c..0568fb8 100644 --- a/war/src/main/java/com/tommytony/war/mappers/VolumeMapper.java +++ b/war/src/main/java/com/tommytony/war/mappers/VolumeMapper.java @@ -11,16 +11,11 @@ import java.util.List; import org.bukkit.Material; import org.bukkit.World; -import org.bukkit.block.Chest; -import org.bukkit.block.Dispenser; -import org.bukkit.block.Sign; import org.bukkit.inventory.ItemStack; import org.bukkit.material.MaterialData; import bukkit.tommytony.war.War; -import com.tommytony.war.volumes.BlockInfo; -import com.tommytony.war.volumes.VerticalVolume; import com.tommytony.war.volumes.Volume; import com.tommytony.war.volumes.ZoneVolume; @@ -37,13 +32,6 @@ public class VolumeMapper { load(volume, zoneName, war, world); return volume; } - - public static VerticalVolume loadVerticalVolume(String volumeName, String zoneName, - War war, World world) { - VerticalVolume volume = new VerticalVolume(volumeName, war, world); - load(volume, zoneName, war, world); - return volume; - } public static ZoneVolume loadZoneVolume(String volumeName, String zoneName, War war, World world) { diff --git a/war/src/main/java/com/tommytony/war/mappers/WarzoneMapper.java b/war/src/main/java/com/tommytony/war/mappers/WarzoneMapper.java index ba8a921..ed10b02 100644 --- a/war/src/main/java/com/tommytony/war/mappers/WarzoneMapper.java +++ b/war/src/main/java/com/tommytony/war/mappers/WarzoneMapper.java @@ -18,7 +18,6 @@ import com.tommytony.war.TeamKinds; import com.tommytony.war.TeamSpawnStyles; import com.tommytony.war.Warzone; import com.tommytony.war.ZoneLobby; -import com.tommytony.war.volumes.VerticalVolume; import com.tommytony.war.volumes.Volume; import com.tommytony.war.volumes.ZoneVolume; diff --git a/war/src/main/java/com/tommytony/war/volumes/BlockInfo.java b/war/src/main/java/com/tommytony/war/volumes/BlockInfo.java index 99efab3..f2c020b 100644 --- a/war/src/main/java/com/tommytony/war/volumes/BlockInfo.java +++ b/war/src/main/java/com/tommytony/war/volumes/BlockInfo.java @@ -3,8 +3,6 @@ package com.tommytony.war.volumes; import org.bukkit.Material; import org.bukkit.World; import org.bukkit.block.Block; -import org.bukkit.block.BlockState; -import org.bukkit.block.Sign; /** *