mirror of
https://github.com/taoneill/war.git
synced 2025-03-12 14:39:08 +01:00
Closes gh-34. Flag orientation is now saved (like the spawn). Made sure multi-line error messages are colored red also.
This commit is contained in:
parent
6e8c06ee30
commit
9221582e2a
@ -447,7 +447,7 @@ public class War extends JavaPlugin {
|
||||
team.setTeamFlag(player.getLocation());
|
||||
Location playerLoc = player.getLocation();
|
||||
player.teleportTo(new Location(playerLoc.getWorld(),
|
||||
playerLoc.getBlockX()+1, playerLoc.getBlockY() + 1, playerLoc.getBlockZ()));
|
||||
playerLoc.getBlockX(), playerLoc.getBlockY() + 1, playerLoc.getBlockZ()));
|
||||
player.sendMessage(this.str("Team " + name + " flag moved."));
|
||||
WarzoneMapper.save(this, warzone, false);
|
||||
}
|
||||
@ -1038,7 +1038,7 @@ public class War extends JavaPlugin {
|
||||
for(String namedPair : arguments) {
|
||||
String[] pairSplit = namedPair.split(":");
|
||||
if(pairSplit.length == 2) {
|
||||
namedParams.put(pairSplit[0], pairSplit[1]);
|
||||
namedParams.put(pairSplit[0].toLowerCase(), pairSplit[1]);
|
||||
}
|
||||
}
|
||||
if(namedParams.containsKey("lifepool")){
|
||||
@ -1147,7 +1147,8 @@ public class War extends JavaPlugin {
|
||||
}
|
||||
|
||||
private String colorTeams(String str, ChatColor msgColor) {
|
||||
String out = str.replaceAll("iron", TeamChatColors.TEAMIRON + "iron" + msgColor);
|
||||
String out = str.replaceAll(" ", msgColor + " ");
|
||||
out = out.replaceAll("iron", TeamChatColors.TEAMIRON + "iron" + msgColor);
|
||||
out = out.replaceAll("Iron", TeamChatColors.TEAMIRON + "Iron" + msgColor);
|
||||
out = out.replaceAll("gold", TeamChatColors.TEAMGOLD + "gold" + msgColor);
|
||||
out = out.replaceAll("Gold", TeamChatColors.TEAMGOLD + "Gold" + msgColor);
|
||||
|
@ -417,13 +417,44 @@ public class Team {
|
||||
warzone.getWorld().getBlockAt(x-1, y-1, z).setType(Material.OBSIDIAN);
|
||||
warzone.getWorld().getBlockAt(x-1, y-1, z-1).setType(Material.OBSIDIAN);
|
||||
|
||||
// flag post
|
||||
warzone.getWorld().getBlockAt(x, y, z-1).setType(Material.FENCE);
|
||||
warzone.getWorld().getBlockAt(x, y+1, z-1).setType(Material.FENCE);
|
||||
warzone.getWorld().getBlockAt(x, y+2, z-1).setType(Material.FENCE);
|
||||
warzone.getWorld().getBlockAt(x, y+2, z).setType(Material.FENCE);
|
||||
// flag
|
||||
warzone.getWorld().getBlockAt(x, y+1, z).setType(material);
|
||||
warzone.getWorld().getBlockAt(x, y+2, z).setType(Material.FENCE);
|
||||
|
||||
// Flag post using Orientation
|
||||
int yaw = 0;
|
||||
if(teamFlag.getYaw() >= 0){
|
||||
yaw = (int)(teamFlag.getYaw() % 360);
|
||||
} else {
|
||||
yaw = (int)(360 + (teamFlag.getYaw() % 360));
|
||||
}
|
||||
BlockFace facing = null;
|
||||
BlockFace opposite = null;
|
||||
if((yaw >= 0 && yaw < 45) || (yaw >= 315 && yaw <= 360)) {
|
||||
facing = BlockFace.WEST;
|
||||
opposite = BlockFace.EAST;
|
||||
warzone.getWorld().getBlockAt(x, y, z-1).setType(Material.FENCE);
|
||||
warzone.getWorld().getBlockAt(x, y+1, z-1).setType(Material.FENCE);
|
||||
warzone.getWorld().getBlockAt(x, y+2, z-1).setType(Material.FENCE);
|
||||
} else if(yaw >= 45 && yaw < 135) {
|
||||
facing = BlockFace.NORTH;
|
||||
opposite = BlockFace.SOUTH;
|
||||
warzone.getWorld().getBlockAt(x+1, y, z).setType(Material.FENCE);
|
||||
warzone.getWorld().getBlockAt(x+1, y+1, z).setType(Material.FENCE);
|
||||
warzone.getWorld().getBlockAt(x+1, y+2, z).setType(Material.FENCE);
|
||||
} else if(yaw >= 135 && yaw < 225) {
|
||||
facing = BlockFace.EAST;
|
||||
opposite = BlockFace.WEST;
|
||||
warzone.getWorld().getBlockAt(x, y, z+1).setType(Material.FENCE);
|
||||
warzone.getWorld().getBlockAt(x, y+1, z+1).setType(Material.FENCE);
|
||||
warzone.getWorld().getBlockAt(x, y+2, z+1).setType(Material.FENCE);
|
||||
} else if(yaw >= 225 && yaw < 315) {
|
||||
facing = BlockFace.SOUTH;
|
||||
opposite = BlockFace.NORTH;
|
||||
warzone.getWorld().getBlockAt(x-1, y, z).setType(Material.FENCE);
|
||||
warzone.getWorld().getBlockAt(x-1, y+1, z).setType(Material.FENCE);
|
||||
warzone.getWorld().getBlockAt(x-1, y+2, z).setType(Material.FENCE);
|
||||
}
|
||||
}
|
||||
|
||||
public void setTeamFlag(Location teamFlag) {
|
||||
|
@ -133,7 +133,12 @@ public class WarzoneMapper {
|
||||
int teamFlagX = Integer.parseInt(teamFlagStrSplit[1]);
|
||||
int teamFlagY = Integer.parseInt(teamFlagStrSplit[2]);
|
||||
int teamFlagZ = Integer.parseInt(teamFlagStrSplit[3]);
|
||||
team.setTeamFlag(new Location(world, teamFlagX, teamFlagY, teamFlagZ)); // this may screw things up
|
||||
Location teamFlagLocation = new Location(world, teamFlagX, teamFlagY, teamFlagZ);
|
||||
if(teamFlagStrSplit.length > 4) {
|
||||
int yaw = Integer.parseInt(teamFlagStrSplit[4]);
|
||||
teamFlagLocation.setYaw(yaw);
|
||||
}
|
||||
team.setTeamFlag(teamFlagLocation); // this may screw things up
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -303,7 +308,13 @@ public class WarzoneMapper {
|
||||
for(Team team : teams) {
|
||||
if(team.getFlagVolume() != null) {
|
||||
Location flag = team.getTeamFlag();
|
||||
teamFlagsStr += team.getName() + "," + flag.getBlockX() + "," + flag.getBlockY() + "," + flag.getBlockZ() + ";";
|
||||
int intYaw = 0;
|
||||
if(flag.getYaw() >= 0){
|
||||
intYaw = (int)(flag.getYaw() % 360);
|
||||
} else {
|
||||
intYaw = (int)(360 + (flag.getYaw() % 360));
|
||||
}
|
||||
teamFlagsStr += team.getName() + "," + flag.getBlockX() + "," + flag.getBlockY() + "," + flag.getBlockZ() + "," + intYaw + ";";
|
||||
}
|
||||
}
|
||||
warzoneConfig.setString("teamFlags", teamFlagsStr);
|
||||
|
Loading…
Reference in New Issue
Block a user