mirror of
https://github.com/taoneill/war.git
synced 2024-11-23 18:55:28 +01:00
Merge branch 'tim'
This commit is contained in:
commit
e3918180fc
@ -233,7 +233,7 @@ public class War extends JavaPlugin {
|
|||||||
} else if(command.equals("resetzone")) {
|
} else if(command.equals("resetzone")) {
|
||||||
performResetZone(player, arguments);
|
performResetZone(player, arguments);
|
||||||
} else if(command.equals("deletezone")) {
|
} else if(command.equals("deletezone")) {
|
||||||
performDeleteZone(player);
|
performDeleteZone(player, arguments);
|
||||||
} else if(command.equals("setteam")) {
|
} else if(command.equals("setteam")) {
|
||||||
performSetTeam(player, arguments);
|
performSetTeam(player, arguments);
|
||||||
} else if(command.equals("setteamflag")) {
|
} else if(command.equals("setteamflag")) {
|
||||||
@ -565,14 +565,29 @@ public class War extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void performDeleteZone(Player player) {
|
public void performDeleteZone(Player player, String[] arguments) {
|
||||||
if(!this.inAnyWarzone(player.getLocation()) && !this.inAnyWarzoneLobby(player.getLocation())) {
|
if(arguments.length == 0 && !this.inAnyWarzone(player.getLocation()) && !this.inAnyWarzoneLobby(player.getLocation())) {
|
||||||
this.badMsg(player, "Usage: /deletezone. " +
|
this.badMsg(player, "Usage: /deletezone [warzone-name]. " +
|
||||||
"Deletes the warzone. " +
|
"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 {
|
} else {
|
||||||
Warzone warzone = this.warzone(player.getLocation());
|
ZoneLobby lobby = null;
|
||||||
ZoneLobby lobby = this.lobby(player.getLocation());
|
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) {
|
if(warzone == null && lobby != null) {
|
||||||
warzone = lobby.getZone();
|
warzone = lobby.getZone();
|
||||||
} else {
|
} else {
|
||||||
@ -1057,6 +1072,8 @@ public class War extends JavaPlugin {
|
|||||||
warzone.setSpawnStyle(spawnStyle);
|
warzone.setSpawnStyle(spawnStyle);
|
||||||
} else if (spawnStyle.equals(TeamSpawnStyles.FLAT)){
|
} else if (spawnStyle.equals(TeamSpawnStyles.FLAT)){
|
||||||
warzone.setSpawnStyle(spawnStyle);
|
warzone.setSpawnStyle(spawnStyle);
|
||||||
|
} else if (spawnStyle.equals(TeamSpawnStyles.INVISIBLE)){
|
||||||
|
warzone.setSpawnStyle(spawnStyle);
|
||||||
} else {
|
} else {
|
||||||
warzone.setSpawnStyle(TeamSpawnStyles.BIG);
|
warzone.setSpawnStyle(TeamSpawnStyles.BIG);
|
||||||
}
|
}
|
||||||
|
@ -70,12 +70,16 @@ public class WarEntityListener extends EntityListener {
|
|||||||
&& attackerWarzone == defenderWarzone) {
|
&& attackerWarzone == defenderWarzone) {
|
||||||
// Make sure one of the players isn't in the spawn
|
// Make sure one of the players isn't in the spawn
|
||||||
if(defenderTeam.getSpawnVolume().contains(d.getLocation())) { // attacking person in spawn
|
if(defenderTeam.getSpawnVolume().contains(d.getLocation())) { // attacking person in spawn
|
||||||
war.badMsg(a, "Can't attack a player that's inside his team's spawn.");
|
if(!defenderWarzone.isFlagThief(d.getName())) { // thiefs can always be attacked
|
||||||
event.setCancelled(true);
|
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())) {
|
} 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
|
// only let a player inside spawn attack an enemy player if that player enters the spawn
|
||||||
war.badMsg(a, "Can't attack a player from inside your spawn.");
|
if(!attackerWarzone.isFlagThief(a.getName())) { // thiefs can always attack
|
||||||
event.setCancelled(true);
|
war.badMsg(a, "Can't attack a player from inside your spawn.");
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Detect death, prevent it and respawn the player
|
// Detect death, prevent it and respawn the player
|
||||||
|
@ -51,7 +51,11 @@ public class Team {
|
|||||||
int x = teamSpawn.getBlockX();
|
int x = teamSpawn.getBlockX();
|
||||||
int y = teamSpawn.getBlockY();
|
int y = teamSpawn.getBlockY();
|
||||||
int z = teamSpawn.getBlockZ();
|
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.setCornerOne(warzone.getWorld().getBlockAt(x-1, y-1, z-1));
|
||||||
this.spawnVolume.setCornerTwo(warzone.getWorld().getBlockAt(x+1, y+3, z+1));
|
this.spawnVolume.setCornerTwo(warzone.getWorld().getBlockAt(x+1, y+3, z+1));
|
||||||
} else {
|
} else {
|
||||||
@ -71,16 +75,22 @@ public class Team {
|
|||||||
int y = teamSpawn.getBlockY();
|
int y = teamSpawn.getBlockY();
|
||||||
int z = teamSpawn.getBlockZ();
|
int z = teamSpawn.getBlockZ();
|
||||||
|
|
||||||
// first ring
|
|
||||||
setBlock(x+1, y-1, z+1, kind);
|
if(warzone.getSpawnStyle().equals(TeamSpawnStyles.INVISIBLE)) {
|
||||||
setBlock(x+1, y-1, z, kind);
|
// nothing but glowstone
|
||||||
setBlock(x+1, y-1, z-1, kind);
|
warzone.getWorld().getBlockAt(x, y-1, z).setType(Material.GLOWSTONE);
|
||||||
setBlock(x, y-1, z+1, kind);
|
} else {
|
||||||
warzone.getWorld().getBlockAt(x, y-1, z).setType(Material.GLOWSTONE);
|
// first ring
|
||||||
setBlock(x, y-1, z-1, kind);
|
setBlock(x+1, y-1, z+1, kind);
|
||||||
setBlock(x-1, y-1, z+1, kind);
|
setBlock(x+1, y-1, z, kind);
|
||||||
setBlock(x-1, y-1, z, kind);
|
setBlock(x+1, y-1, z-1, kind);
|
||||||
setBlock(x-1, y-1, z-1, kind);
|
setBlock(x, y-1, z+1, kind);
|
||||||
|
warzone.getWorld().getBlockAt(x, y-1, z).setType(Material.GLOWSTONE);
|
||||||
|
setBlock(x, y-1, z-1, kind);
|
||||||
|
setBlock(x-1, y-1, z+1, kind);
|
||||||
|
setBlock(x-1, y-1, z, kind);
|
||||||
|
setBlock(x-1, y-1, z-1, kind);
|
||||||
|
}
|
||||||
|
|
||||||
// Orientation
|
// Orientation
|
||||||
int yaw = 0;
|
int yaw = 0;
|
||||||
@ -92,7 +102,19 @@ public class Team {
|
|||||||
Block signBlock = null;
|
Block signBlock = null;
|
||||||
int signData = 0;
|
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
|
// SMALL style
|
||||||
if(yaw >= 0 && yaw < 90) {
|
if(yaw >= 0 && yaw < 90) {
|
||||||
signData = 10;
|
signData = 10;
|
||||||
|
@ -114,6 +114,8 @@ public class WarMapper {
|
|||||||
war.setDefaultSpawnStyle(spawnStyle);
|
war.setDefaultSpawnStyle(spawnStyle);
|
||||||
} else if (spawnStyle.equals(TeamSpawnStyles.FLAT)){
|
} else if (spawnStyle.equals(TeamSpawnStyles.FLAT)){
|
||||||
war.setDefaultSpawnStyle(spawnStyle);
|
war.setDefaultSpawnStyle(spawnStyle);
|
||||||
|
} else if (spawnStyle.equals(TeamSpawnStyles.INVISIBLE)){
|
||||||
|
war.setDefaultSpawnStyle(spawnStyle);
|
||||||
}
|
}
|
||||||
// default is already initialized to BIG (see Warzone)
|
// default is already initialized to BIG (see Warzone)
|
||||||
}
|
}
|
||||||
|
@ -173,6 +173,8 @@ public class WarzoneMapper {
|
|||||||
warzone.setSpawnStyle(spawnStyle);
|
warzone.setSpawnStyle(spawnStyle);
|
||||||
} else if (spawnStyle.equals(TeamSpawnStyles.FLAT)){
|
} else if (spawnStyle.equals(TeamSpawnStyles.FLAT)){
|
||||||
warzone.setSpawnStyle(spawnStyle);
|
warzone.setSpawnStyle(spawnStyle);
|
||||||
|
} else if (spawnStyle.equals(TeamSpawnStyles.INVISIBLE)){
|
||||||
|
warzone.setSpawnStyle(spawnStyle);
|
||||||
}
|
}
|
||||||
// default is already initialized to BIG (see Warzone)
|
// default is already initialized to BIG (see Warzone)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user