Switch from depending on Permissions to Essentials GroupManagerBridge. Cuboid zone walls are working and resetting properly. Resizing is still a problem though.

This commit is contained in:
taoneill 2011-05-09 02:05:27 -04:00
parent 21f7547766
commit e81ba0faae
5 changed files with 14 additions and 260 deletions

View File

@ -5,9 +5,9 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/bukkit"/>
<classpathentry kind="lib" path="C:/dev/war/war/lib/Permissions.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/craftbukkit"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="lib" path="C:/dev/war/war/lib/mockito-all-1.8.5.jar"/>
<classpathentry kind="lib" path="C:/dev/war/war/lib/EssentialsGroupBridge.jar"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -603,9 +603,6 @@ public class War extends JavaPlugin {
warzone.initializeZoneAsJob();
}
// this.msg(player, "Warzone and teams reset. " + resetBlocks + " blocks reset.");
// logInfo(resetBlocks + " blocks reset in warzone " + warzone.getName() + ".");
}
}
@ -753,135 +750,6 @@ public class War extends JavaPlugin {
}
}
}
// Pre 1.5
// public void performSetZone(Player player, String[] arguments) {
// if(arguments.length < 2 || arguments.length > 2
// || (arguments.length == 2 && (!arguments[1].equals("southeast") && !arguments[1].equals("northwest")
// && !arguments[1].equals("se") && !arguments[1].equals("nw")))) {
// this.badMsg(player, "Usage: /setzone <warzone-name> <'southeast'/'northwest'/'se'/'nw'>. " +
// "Set one corner, then the next. Defines the outline of the warzone, which will be reset at the start of every battle. " +
// "Saves the zone blocks if the zone if the outline is correct.");
// } else {
// Warzone warzone = this.findWarzone(arguments[0]);
// String msgString = "";
// Location oldSoutheast = null;
// Location oldNorthwest = null;
// boolean fail = false;
// if(warzone == null) {
// // create the warzone
// warzone = new Warzone(this, player.getLocation().getWorld(), arguments[0]);
// this.getIncompleteZones().add(warzone);
// //WarMapper.save(this);
// if(arguments[1].equals("northwest") || arguments[1].equals("nw")) {
// warzone.setNorthwest(player.getLocation());
// this.msg(player, "Warzone " + warzone.getName() + " created. Northwesternmost point set to x:"
// + (int)warzone.getNorthwest().getBlockX() + " z:" + (int)warzone.getNorthwest().getBlockZ() + ".");
// } else {
// warzone.setSoutheast(player.getLocation());
// this.msg(player, "Warzone " + warzone.getName() + " created. Southeasternmost point set to x:"
// + (int)warzone.getSoutheast().getBlockX() + " z:" + (int)warzone.getSoutheast().getBlockZ() + ".");
// }
// //WarzoneMapper.save(this, warzone, false);
// } else {
// // change existing warzone
// if(arguments[1].equals("northwest") || arguments[1].equals("nw")) {
// if(warzone.getSoutheast() != null
// && (player.getLocation().getBlockX() >= warzone.getSoutheast().getBlockX()
// || player.getLocation().getBlockZ() <= warzone.getSoutheast().getBlockZ())) {
// this.badMsg(player, "You must place that corner northwest relative to the existing southeast corner!");
// } else if (warzone.getSoutheast() == null){
// // just moving the single nw corner we've placed so far
// warzone.setNorthwest(player.getLocation());
// }else {
// if(warzone.getVolume().isSaved()) {
// msg(player, "Resetting " + warzone.getName() + " blocks.");
// if(warzone.getLobby() != null) {
// warzone.getLobby().getVolume().resetBlocks();
// }
// int reset = warzone.getVolume().resetBlocks();
//
// msgString = reset + " blocks reset. ";
// oldNorthwest = warzone.getNorthwest();
// }
// warzone.setNorthwest(player.getLocation());
// }
// } else if(arguments[1].equals("southeast") || arguments[1].equals("se")) {
// if(warzone.getNorthwest() != null
// && (player.getLocation().getBlockX() <= warzone.getNorthwest().getBlockX()
// || player.getLocation().getBlockZ() >= warzone.getNorthwest().getBlockZ())) {
// this.badMsg(player, "You must place that corner southeast relative to the existing northwest corner! ");
// fail = true;
// } else if (warzone.getNorthwest() == null){
// // just moving the single se corner we've placed so far
// warzone.setSoutheast(player.getLocation());
// } else {
// if(warzone.getVolume().isSaved()) {
// // we're resizing a zone
// msg(player, "Resetting zone " + warzone.getName() + " blocks.");
// if(warzone.getLobby() != null) {
// warzone.getLobby().getVolume().resetBlocks();
// }
// int reset = warzone.getVolume().resetBlocks();
//
// msgString = reset + " blocks reset. ";
// oldSoutheast = warzone.getSoutheast();
// }
// warzone.setSoutheast(player.getLocation());
// }
// }
// }
// if(warzone.getNorthwest() == null) {
// msg(player, msgString + "Still missing northwesternmost point.");
// } else if(warzone.getSoutheast() == null) {
// msg(player, msgString + "Still missing southeasternmost point.");
// } else if (warzone.tooBig()) {
// badMsg(player, msgString + "Warzone " + warzone.getName() + " is too Big. Max north-south size: 750. Max east-west size: 750.");
// } else if (warzone.tooSmall()) {
// badMsg(player, msgString + "Warzone " + warzone.getName() + " is too small. Min north-south size: 10. Min east-west size: 10.");
// } else if(!fail && warzone.ready()) {
// if(!this.warzones.contains(warzone)) {
// this.addWarzone(warzone);
// }
// if(this.incompleteZones.contains(warzone)) {
// this.incompleteZones.remove(warzone);
// }
// WarMapper.save(this);
// msgString += "New zone outline ok. Saving new warzone blocks...";
// msg(player, msgString);
// warzone.saveState(false); // we just changed the volume, cant reset walls
// if(warzone.getLobby() == null) {
// // Set default lobby on south side
// ZoneLobby lobby = new ZoneLobby(this, warzone, BlockFace.SOUTH);
// warzone.setLobby(lobby);
// if(warHub != null) { // warhub has to change
// warHub.getVolume().resetBlocks();
// warHub.initialize();
// }
// this.msg(player, "Default lobby created on south side of zone. Use /setzonelobby <n/s/e/w> to change its position.");
// } else {
// // gotta move the lobby
// warzone.getLobby().changeWall(warzone.getLobby().getWall());
// }
// warzone.initializeZone();
// WarzoneMapper.save(this, warzone, true);
// this.msg(player, "Warzone saved. Use /setteam, /setmonument and /savezone to configure the zone.");
// }
//
// if(warzone.getVolume().isSaved()
// && (warzone.tooBig() || warzone.tooSmall())
// && (oldNorthwest != null || oldSoutheast != null) )
// {
// // we resized but the result is too small or too big. Restore the old corner and reinit the zone.
// if(oldNorthwest != null) {
// warzone.setNorthwest(oldNorthwest);
// } else if (oldSoutheast != null) {
// warzone.setSoutheast(oldSoutheast);
// }
// warzone.initializeZone();
// }
//
// }
// }
public void performNextBattle(Player player) {
if(!this.inAnyWarzone(player.getLocation())) {
@ -894,8 +762,6 @@ public class War extends JavaPlugin {
}
warzone.getVolume().resetBlocksAsJob();
warzone.initializeZoneAsJob();
// this.msg(player, "Warzone reset. " + resetBlocks + " blocks reset.");
// logInfo(resetBlocks + " blocks reset in warzone " + warzone.getName() + ".");
}
}
@ -1379,7 +1245,6 @@ public class War extends JavaPlugin {
return zoneMakerNames;
}
@SuppressWarnings("static-access")
public boolean canPlayWar(Player player) {
if(Permissions != null
&& (Permissions.Security.permission(player, "war.player")
@ -1393,7 +1258,6 @@ public class War extends JavaPlugin {
return false;
}
@SuppressWarnings("static-access")
public boolean canWarp(Player player) {
if(Permissions != null
&& (Permissions.Security.permission(player, "war.warp")
@ -1407,7 +1271,6 @@ public class War extends JavaPlugin {
return false;
}
@SuppressWarnings("static-access")
public boolean canBuildOutsideZone(Player player) {
if(isBuildInZonesOnly()) {
if(Permissions != null
@ -1525,23 +1388,16 @@ public class War extends JavaPlugin {
return zoneMakersImpersonatingPlayers;
}
@SuppressWarnings("static-access")
public void setupPermissions() {
Plugin test = this.getServer().getPluginManager().getPlugin("Permissions");
if(this.Permissions == null) {
if(Permissions == null) {
if(test != null) {
this.Permissions = (Permissions)test;
Permissions = (Permissions)test;
} else {
logInfo("Permissions system not enabled. Defaulting to regular War config.");
}
}
}
// public BlockState refetchStateForBlock(World world, Block block) {
// Block again = world.getBlockAt(block.getX(), block.getY(), block.getZ());
// return again.getState();
// }
}
public void setDefaultBlockHeads(boolean defaultBlockHeads) {
this.defaultBlockHeads = defaultBlockHeads;

View File

@ -29,8 +29,6 @@ import com.tommytony.war.volumes.ZoneVolume;
public class Warzone {
private String name;
private ZoneVolume volume;
// private Location northwest;
// private Location southeast;
private final List<Team> teams = new ArrayList<Team>();
private final List<Monument> monuments = new ArrayList<Monument>();
@ -104,51 +102,6 @@ public class Warzone {
return name;
}
// public void setNorthwest(Location northwest) {
// this.northwest = northwest;
// this.volume.setCornerOne(world.getBlockAt(northwest.getBlockX(), northwest.getBlockY(), northwest.getBlockZ()));
// addNorthwestCursorBlocks();
// }
//
// private void addNorthwestCursorBlocks() {
// Block topNWBlock = this.world.getBlockAt(this.northwest.getBlockX(), this.northwest.getBlockY()-1, this.northwest.getBlockZ());
// BlockInfo[] originalNorthwestBlocks = new BlockInfo[3];
// originalNorthwestBlocks[0] = new BlockInfo(topNWBlock); // save blocks for reset
// originalNorthwestBlocks[1] = new BlockInfo(topNWBlock.getFace(BlockFace.EAST));
// originalNorthwestBlocks[2] = new BlockInfo(topNWBlock.getFace(BlockFace.SOUTH));
// topNWBlock.setType(Material.GLASS);
// topNWBlock.getFace(BlockFace.EAST).setType(Material.GLASS);
// topNWBlock.getFace(BlockFace.SOUTH).setType(Material.GLASS);
// this.war.getServer().getScheduler().scheduleSyncDelayedTask(this.war, new ResetCursorJob(topNWBlock, originalNorthwestBlocks, false), 75);
// }
//
// public Location getNorthwest() {
// return northwest;
// }
//
// public void setSoutheast(Location southeast) {
// this.southeast = southeast;
// this.volume.setCornerTwo(world.getBlockAt(southeast.getBlockX(), southeast.getBlockY(), southeast.getBlockZ()));
// addSoutheastCursorBlocks();
// }
//
// private void addSoutheastCursorBlocks() {
// Block topSEBlock = this.world.getBlockAt(this.southeast.getBlockX(), this.southeast.getBlockY()-1, this.southeast.getBlockZ());
// BlockInfo[] originalSoutheastBlocks = new BlockInfo[3];
// originalSoutheastBlocks[0] = new BlockInfo(topSEBlock); // save block for reset
// originalSoutheastBlocks[1] = new BlockInfo(topSEBlock.getFace(BlockFace.WEST));
// originalSoutheastBlocks[2] = new BlockInfo(topSEBlock.getFace(BlockFace.NORTH));
// topSEBlock.setType(Material.GLASS);
// topSEBlock.getFace(BlockFace.WEST).setType(Material.GLASS);
// topSEBlock.getFace(BlockFace.NORTH).setType(Material.GLASS);
// this.war.getServer().getScheduler().scheduleSyncDelayedTask(this.war, new ResetCursorJob(topSEBlock, originalSoutheastBlocks, true), 75);
// }
//
//
// public Location getSoutheast() {
// return southeast;
// }
public void setTeleport(Location location) {
this.teleport = location;
}
@ -212,19 +165,6 @@ public class Warzone {
}
initZone();
// // Set the zone chunks to all players
// World world = this.getWorld();
// if(world instanceof CraftWorld) {
// CraftWorld craftWorld = (CraftWorld)world;
// // team spawns
// for(Team team : teams) {
// if(team.getPlayers().size() > 0) {
// craftWorld.refreshChunk(team.getTeamSpawn().getBlockX(), team.getTeamSpawn().getBlockZ());
// }
// }
// // dont do all the zone chunks for now
// }
}
}
@ -259,9 +199,6 @@ public class Warzone {
lobby.initialize();
}
// this.setNorthwest(this.getNorthwest());
// this.setSoutheast(this.getSoutheast());
this.flagThieves.clear();
}
@ -566,30 +503,6 @@ public class Warzone {
return false;
}
// private boolean teleportNear(Block block) {
// if(teleport != null) {
// int x = (int)this.teleport.getBlockX();
// int y = (int)this.teleport.getBlockY();
// int z = (int)this.teleport.getBlockZ();
// int bx = block.getX();
// int by = block.getY();
// int bz = block.getZ();
// if((bx == x && by == y && bz == z) ||
// (bx == x+1 && by == y-1 && bz == z+1) ||
// (bx == x+1 && by == y-1 && bz == z) ||
// (bx == x+1 && by == y-1 && bz == z-1) ||
// (bx == x && by == y-1 && bz == z+1) ||
// (bx == x && by == y-1 && bz == z) ||
// (bx == x && by == y-1 && bz == z-1) ||
// (bx == x-1 && by == y-1 && bz == z+1) ||
// (bx == x-1 && by == y-1 && bz == z) ||
// (bx == x-1 && by == y-1 && bz == z-1) ) {
// return true;
// }
// }
// return false;
// }
public World getWorld() {
return world;
@ -789,7 +702,6 @@ public class Warzone {
}
}
return null;
}
public void protectZoneWallAgainstPlayer(Player player) {
@ -812,6 +724,8 @@ public class Warzone {
for(ZoneWallGuard guard : zoneWallGuards) {
if(guard.getPlayer().getName().equals(player.getName())){
playerGuards.add(guard);
BlockFace guardWall = guard.getWall();
getVolume().resetWallBlocks(guardWall);
if(isDrawZoneOutline()) {
addZoneOutline(guard.getWall());
}
@ -830,7 +744,6 @@ public class Warzone {
}
public boolean getAutoAssignOnly() {
return isAutoAssignOnly();
}
@ -976,7 +889,6 @@ public class Warzone {
}
}
public void handlePlayerLeave(Player player, Location destination, boolean removeFromTeam) {
Team playerTeam = war.getPlayerTeam(player.getName());
if(playerTeam !=null) {
@ -1173,14 +1085,4 @@ public class Warzone {
public Location getRallyPoint() {
return this.rallyPoint;
}
// public Team getTeamByName(String name) {
// for(Team team : getTeams()) {
// if(team.getName().startsWith(name)) {
// return team;
// }
// }
// return null;
// }
}

View File

@ -37,13 +37,13 @@ public class ZoneSetter {
war.getIncompleteZones().add(warzone);
warzone.getVolume().setNorthwest(northwestBlock);
war.msg(player, "Warzone " + warzone.getName() + " created. Northwesternmost point set to x:"
+ (int)warzone.getVolume().getNorthwestX() + " z:" + (int)warzone.getVolume().getNorthwestZ() + ".");
+ (int)warzone.getVolume().getNorthwestX() + " z:" + (int)warzone.getVolume().getNorthwestZ() + ". ");
} else {
// change existing warzone
resetWarzone(warzone, msgString);
warzone.getVolume().setNorthwest(northwestBlock);
msgString.append("Warzone " + warzone.getName() + " modified. Northwesternmost point set to x:"
+ (int)warzone.getVolume().getNorthwestX() + " z:" + (int)warzone.getVolume().getNorthwestZ() + ".");
+ (int)warzone.getVolume().getNorthwestX() + " z:" + (int)warzone.getVolume().getNorthwestZ() + ". ");
}
saveIfReady(warzone, msgString);
} catch (NotNorthwestException e) {
@ -56,7 +56,6 @@ public class ZoneSetter {
handleTooBig();
if(warzone.getVolume().isSaved()) warzone.initializeZone();
}
saveIfReady(warzone, msgString);
}
public void placeSoutheast() {
@ -71,7 +70,7 @@ public class ZoneSetter {
war.getIncompleteZones().add(warzone);
warzone.getVolume().setSoutheast(southeastBlock);
war.msg(player, "Warzone " + warzone.getName() + " created. Southeasternmost point set to x:"
+ (int)warzone.getVolume().getSoutheastX() + " z:" + (int)warzone.getVolume().getSoutheastZ() + ".");
+ (int)warzone.getVolume().getSoutheastX() + " z:" + (int)warzone.getVolume().getSoutheastZ() + ". ");
} else {
// change existing warzone
resetWarzone(warzone, msgString);
@ -90,7 +89,6 @@ public class ZoneSetter {
handleTooBig();
if(warzone.getVolume().isSaved()) warzone.initializeZone();
}
saveIfReady(warzone, msgString);
}
public void placeCorner1() {
@ -105,13 +103,13 @@ public class ZoneSetter {
war.getIncompleteZones().add(warzone);
warzone.getVolume().setZoneCornerOne(corner1Block);
war.msg(player, "Warzone " + warzone.getName() + " created. Corner 1 set to x:"
+ (int)corner1Block.getX() + " y:" + (int)corner1Block.getY() + " z:" + (int)corner1Block.getZ() + ".");
+ (int)corner1Block.getX() + " y:" + (int)corner1Block.getY() + " z:" + (int)corner1Block.getZ() + ". ");
} else {
// change existing warzone
resetWarzone(warzone, msgString);
warzone.getVolume().setZoneCornerOne(corner1Block);
msgString.append("Warzone " + warzone.getName() + " modified. Corner 1 set to x:"
+ (int)corner1Block.getX() + " y:" + (int)corner1Block.getY() + " z:" + (int)corner1Block.getZ() + ".");
+ (int)corner1Block.getX() + " y:" + (int)corner1Block.getY() + " z:" + (int)corner1Block.getZ() + ". ");
}
saveIfReady(warzone, msgString);
} catch (TooSmallException e) {
@ -121,7 +119,6 @@ public class ZoneSetter {
handleTooBig();
if(warzone.getVolume().isSaved()) warzone.initializeZone();
}
saveIfReady(warzone, msgString);
}
public void placeCorner2() {
@ -136,13 +133,13 @@ public class ZoneSetter {
war.getIncompleteZones().add(warzone);
warzone.getVolume().setZoneCornerTwo(corner2Block);
war.msg(player, "Warzone " + warzone.getName() + " created. Corner 2 set to x:"
+ (int)corner2Block.getX() + " y:" + (int)corner2Block.getY() + " z:" + (int)corner2Block.getZ() + ".");
+ (int)corner2Block.getX() + " y:" + (int)corner2Block.getY() + " z:" + (int)corner2Block.getZ() + ". ");
} else {
// change existing warzone
resetWarzone(warzone, msgString);
warzone.getVolume().setZoneCornerTwo(corner2Block);
msgString.append("Warzone " + warzone.getName() + " modified. Corner 2 set to x:"
+ (int)corner2Block.getX() + " y:" + (int)corner2Block.getY() + " z:" + (int)corner2Block.getZ() + ".");
+ (int)corner2Block.getX() + " y:" + (int)corner2Block.getY() + " z:" + (int)corner2Block.getZ() + ". ");
}
saveIfReady(warzone, msgString);
} catch (TooSmallException e) {
@ -152,7 +149,6 @@ public class ZoneSetter {
handleTooBig();
if(warzone.getVolume().isSaved()) warzone.initializeZone();
}
saveIfReady(warzone, msgString);
}
private void resetWarzone(Warzone warzone, StringBuilder msgString) {

View File

@ -241,7 +241,7 @@ public class ZoneVolume extends Volume {
}
public boolean isDownWallBlock(Block block) {
if (getMaxY() == block.getY()
if (getMinY() == block.getY()
&& block.getX() <= getMaxX()
&& block.getX() >= getMinX()
&& block.getZ() >= getMinZ()