mirror of
https://github.com/taoneill/war.git
synced 2024-11-27 12:46:11 +01:00
Merge branch 'master' of https://github.com/Evil-Code/war into tim
This commit is contained in:
commit
9f8e3ce575
@ -232,7 +232,7 @@ public class War extends JavaPlugin {
|
||||
} else if(command.equals("resetzone")) {
|
||||
performResetZone(player, arguments);
|
||||
} else if(command.equals("deletezone")) {
|
||||
performDeleteZone(player);
|
||||
performDeleteZone(player, arguments);
|
||||
} else if(command.equals("setteam")) {
|
||||
performSetTeam(player, arguments);
|
||||
} else if(command.equals("setteamflag")) {
|
||||
@ -564,14 +564,29 @@ public class War extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
public void performDeleteZone(Player player) {
|
||||
if(!this.inAnyWarzone(player.getLocation()) && !this.inAnyWarzoneLobby(player.getLocation())) {
|
||||
this.badMsg(player, "Usage: /deletezone. " +
|
||||
public void performDeleteZone(Player player, String[] arguments) {
|
||||
if(arguments.length == 0 && !this.inAnyWarzone(player.getLocation()) && !this.inAnyWarzoneLobby(player.getLocation())) {
|
||||
this.badMsg(player, "Usage: /deletezone [warzone-name]. " +
|
||||
"Deletes the warzone. " +
|
||||
"Must be in the warzone (try /zones and /zone). ");
|
||||
"Must be in the warzone or name must be provided (try /zones and /zone). ");
|
||||
} else {
|
||||
Warzone warzone = this.warzone(player.getLocation());
|
||||
ZoneLobby lobby = this.lobby(player.getLocation());
|
||||
ZoneLobby lobby = null;
|
||||
Warzone warzone = null;
|
||||
if(arguments.length == 1) { // get zone by name
|
||||
for(Warzone tmp : this.getWarzones()) {
|
||||
if(tmp.getName().toLowerCase().startsWith(arguments[0].toLowerCase())) {
|
||||
warzone = tmp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (warzone == null) {
|
||||
this.badMsg(player, "No such warzone.");
|
||||
return;
|
||||
}
|
||||
} else { // get zone by position
|
||||
warzone = this.warzone(player.getLocation());
|
||||
lobby = this.lobby(player.getLocation());
|
||||
}
|
||||
if(warzone == null && lobby != null) {
|
||||
warzone = lobby.getZone();
|
||||
} else {
|
||||
@ -1053,6 +1068,8 @@ public class War extends JavaPlugin {
|
||||
warzone.setSpawnStyle(spawnStyle);
|
||||
} else if (spawnStyle.equals(TeamSpawnStyles.FLAT)){
|
||||
warzone.setSpawnStyle(spawnStyle);
|
||||
} else if (spawnStyle.equals(TeamSpawnStyles.INVISIBLE)){
|
||||
warzone.setSpawnStyle(spawnStyle);
|
||||
} else {
|
||||
warzone.setSpawnStyle(TeamSpawnStyles.BIG);
|
||||
}
|
||||
|
@ -70,13 +70,17 @@ public class WarEntityListener extends EntityListener {
|
||||
&& attackerWarzone == defenderWarzone) {
|
||||
// Make sure one of the players isn't in the spawn
|
||||
if(defenderTeam.getSpawnVolume().contains(d.getLocation())) { // attacking person in spawn
|
||||
if(!defenderWarzone.isFlagThief(d.getName())) { // thiefs can always be attacked
|
||||
war.badMsg(a, "Can't attack a player that's inside his team's spawn.");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
} else if(attackerTeam.getSpawnVolume().contains(a.getLocation()) && !attackerTeam.getSpawnVolume().contains(d.getLocation())) {
|
||||
// only let a player inside spawn attack an enemy player if that player enters the spawn
|
||||
if(!attackerWarzone.isFlagThief(a.getName())) { // thiefs can always attack
|
||||
war.badMsg(a, "Can't attack a player from inside your spawn.");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
// Detect death, prevent it and respawn the player
|
||||
if(event.getDamage() >= d.getHealth()) {
|
||||
|
@ -51,7 +51,11 @@ public class Team {
|
||||
int x = teamSpawn.getBlockX();
|
||||
int y = teamSpawn.getBlockY();
|
||||
int z = teamSpawn.getBlockZ();
|
||||
if(warzone.getSpawnStyle().equals(TeamSpawnStyles.SMALL)) {
|
||||
|
||||
if(warzone.getSpawnStyle().equals(TeamSpawnStyles.INVISIBLE)) {
|
||||
this.spawnVolume.setCornerOne(warzone.getWorld().getBlockAt(x, y-1, z));
|
||||
this.spawnVolume.setCornerTwo(warzone.getWorld().getBlockAt(x, y+3, z));
|
||||
} else if(warzone.getSpawnStyle().equals(TeamSpawnStyles.SMALL)) {
|
||||
this.spawnVolume.setCornerOne(warzone.getWorld().getBlockAt(x-1, y-1, z-1));
|
||||
this.spawnVolume.setCornerTwo(warzone.getWorld().getBlockAt(x+1, y+3, z+1));
|
||||
} else {
|
||||
@ -71,6 +75,11 @@ public class Team {
|
||||
int y = teamSpawn.getBlockY();
|
||||
int z = teamSpawn.getBlockZ();
|
||||
|
||||
|
||||
if(warzone.getSpawnStyle().equals(TeamSpawnStyles.INVISIBLE)) {
|
||||
// nothing but glowstone
|
||||
warzone.getWorld().getBlockAt(x, y-1, z).setType(Material.GLOWSTONE);
|
||||
} else {
|
||||
// first ring
|
||||
setBlock(x+1, y-1, z+1, kind);
|
||||
setBlock(x+1, y-1, z, kind);
|
||||
@ -81,6 +90,7 @@ public class Team {
|
||||
setBlock(x-1, y-1, z+1, kind);
|
||||
setBlock(x-1, y-1, z, kind);
|
||||
setBlock(x-1, y-1, z-1, kind);
|
||||
}
|
||||
|
||||
// Orientation
|
||||
int yaw = 0;
|
||||
@ -92,7 +102,19 @@ public class Team {
|
||||
Block signBlock = null;
|
||||
int signData = 0;
|
||||
|
||||
if(warzone.getSpawnStyle().equals(TeamSpawnStyles.SMALL)){
|
||||
if(warzone.getSpawnStyle().equals(TeamSpawnStyles.INVISIBLE)){
|
||||
// INVISIBLE style
|
||||
signBlock = warzone.getWorld().getBlockAt(x, y, z);
|
||||
if(yaw >= 0 && yaw < 90) {
|
||||
signData = 10;
|
||||
}else if(yaw >= 90 && yaw <= 180) {
|
||||
signData = 14;
|
||||
} else if(yaw >= 180 && yaw < 270) {
|
||||
signData = 2;
|
||||
} else if(yaw >= 270 && yaw <= 360) {
|
||||
signData = 6;
|
||||
}
|
||||
} else if(warzone.getSpawnStyle().equals(TeamSpawnStyles.SMALL)){
|
||||
// SMALL style
|
||||
if(yaw >= 0 && yaw < 90) {
|
||||
signData = 10;
|
||||
|
@ -114,6 +114,8 @@ public class WarMapper {
|
||||
war.setDefaultSpawnStyle(spawnStyle);
|
||||
} else if (spawnStyle.equals(TeamSpawnStyles.FLAT)){
|
||||
war.setDefaultSpawnStyle(spawnStyle);
|
||||
} else if (spawnStyle.equals(TeamSpawnStyles.INVISIBLE)){
|
||||
war.setDefaultSpawnStyle(spawnStyle);
|
||||
}
|
||||
// default is already initialized to BIG (see Warzone)
|
||||
}
|
||||
|
@ -173,6 +173,8 @@ public class WarzoneMapper {
|
||||
warzone.setSpawnStyle(spawnStyle);
|
||||
} else if (spawnStyle.equals(TeamSpawnStyles.FLAT)){
|
||||
warzone.setSpawnStyle(spawnStyle);
|
||||
} else if (spawnStyle.equals(TeamSpawnStyles.INVISIBLE)){
|
||||
warzone.setSpawnStyle(spawnStyle);
|
||||
}
|
||||
// default is already initialized to BIG (see Warzone)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user