Closes gh-277. Resolving conflicts while merging Tim's realEnums.

This commit is contained in:
taoneill 2011-08-31 20:20:32 -04:00
commit e8776d3d74
15 changed files with 110 additions and 158 deletions

View File

@ -75,11 +75,9 @@ public class War extends JavaPlugin {
private boolean defaultAutoAssignOnly = false; private boolean defaultAutoAssignOnly = false;
private boolean defaultUnbreakableZoneBlocks = false; private boolean defaultUnbreakableZoneBlocks = false;
private boolean defaultNoCreatures = false; private boolean defaultNoCreatures = false;
private boolean defaultResetOnEmpty = false,
defaultResetOnLoad = false,
defaultResetOnUnload = false;
private String defaultSpawnStyle = TeamSpawnStyles.BIG;
private String defaultFlagReturn = "both"; private String defaultFlagReturn = "both";
private boolean defaultResetOnEmpty = false, defaultResetOnLoad = false, defaultResetOnUnload = false;
private TeamSpawnStyle defaultSpawnStyle = TeamSpawnStyle.BIG;
private final HashMap<Integer, ItemStack> defaultReward = new HashMap<Integer, ItemStack>(); private final HashMap<Integer, ItemStack> defaultReward = new HashMap<Integer, ItemStack>();
public War() { public War() {
@ -263,16 +261,8 @@ public class War extends JavaPlugin {
warzone.setBlockHeads(onOff.equals("on") || onOff.equals("true")); warzone.setBlockHeads(onOff.equals("on") || onOff.equals("true"));
} }
if (namedParams.containsKey("spawnstyle")) { if (namedParams.containsKey("spawnstyle")) {
String spawnStyle = namedParams.get("spawnstyle").toLowerCase(); String spawnStyle = namedParams.get("spawnstyle");
if (spawnStyle.equals(TeamSpawnStyles.SMALL)) { warzone.setSpawnStyle(TeamSpawnStyle.getStyleByString(spawnStyle));
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);
}
} }
if (namedParams.containsKey("flagreturn")) { if (namedParams.containsKey("flagreturn")) {
String flagReturn = namedParams.get("flagreturn").toLowerCase(); String flagReturn = namedParams.get("flagreturn").toLowerCase();
@ -367,16 +357,8 @@ public class War extends JavaPlugin {
this.setDefaultBlockHeads(onOff.equals("on") || onOff.equals("true")); this.setDefaultBlockHeads(onOff.equals("on") || onOff.equals("true"));
} }
if (namedParams.containsKey("spawnstyle")) { if (namedParams.containsKey("spawnstyle")) {
String spawnStyle = namedParams.get("spawnstyle").toLowerCase(); String spawnStyle = namedParams.get("spawnstyle");
if (spawnStyle.equals(TeamSpawnStyles.SMALL)) { this.setDefaultSpawnStyle(TeamSpawnStyle.getStyleByString(spawnStyle));
this.setDefaultSpawnStyle(spawnStyle);
} else if (spawnStyle.equals(TeamSpawnStyles.FLAT)) {
this.setDefaultSpawnStyle(spawnStyle);
} else if (spawnStyle.equals(TeamSpawnStyles.INVISIBLE)) {
this.setDefaultSpawnStyle(spawnStyle);
} else {
this.setDefaultSpawnStyle(TeamSpawnStyles.BIG);
}
} }
if (namedParams.containsKey("flagreturn")) { if (namedParams.containsKey("flagreturn")) {
String flagreturn = namedParams.get("flagreturn").toLowerCase(); String flagreturn = namedParams.get("flagreturn").toLowerCase();
@ -527,8 +509,8 @@ public class War extends JavaPlugin {
>>>>>>> 174126209b48a201d04de613eaae26503605fa94 >>>>>>> 174126209b48a201d04de613eaae26503605fa94
*/ */
private String colorKnownTokens(String str, ChatColor msgColor) { private String colorKnownTokens(String str, ChatColor msgColor) {
for (TeamKind kind : TeamKinds.getTeamkinds()) { for (TeamKind kind : TeamKind.values()) {
str = str.replaceAll(" " + kind.getDefaultName(), " " + kind.getColor() + kind.getDefaultName() + msgColor); str = str.replaceAll(" " + kind.toString(), " " + kind.getColor() + kind.toString() + msgColor);
} }
str = str.replaceAll("Ex -", ChatColor.GRAY + "Ex -"); str = str.replaceAll("Ex -", ChatColor.GRAY + "Ex -");
return str; return str;
@ -893,11 +875,11 @@ public class War extends JavaPlugin {
this.defaultResetOnUnload = defaultResetOnUnload; this.defaultResetOnUnload = defaultResetOnUnload;
} }
public String getDefaultSpawnStyle() { public TeamSpawnStyle getDefaultSpawnStyle() {
return this.defaultSpawnStyle; return defaultSpawnStyle;
} }
public void setDefaultSpawnStyle(String defaultSpawnStyle) { public void setDefaultSpawnStyle(TeamSpawnStyle defaultSpawnStyle) {
this.defaultSpawnStyle = defaultSpawnStyle; this.defaultSpawnStyle = defaultSpawnStyle;
} }

View File

@ -4,9 +4,9 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.tommytony.war.Team; import com.tommytony.war.Team;
import com.tommytony.war.TeamKinds;
import com.tommytony.war.Warzone; import com.tommytony.war.Warzone;
import com.tommytony.war.ZoneLobby; import com.tommytony.war.ZoneLobby;
import com.tommytony.war.TeamKind;
import com.tommytony.war.mappers.WarzoneMapper; import com.tommytony.war.mappers.WarzoneMapper;
import bukkit.tommytony.war.WarCommandHandler; import bukkit.tommytony.war.WarCommandHandler;
@ -50,7 +50,7 @@ public class DeleteTeamCommand extends AbstractZoneMakerCommand {
return false; return false;
} }
Team team = zone.getTeamByKind(TeamKinds.teamKindFromString(this.args[0])); Team team = zone.getTeamByKind(TeamKind.teamKindFromString(this.args[0]));
if (team != null) { if (team != null) {
if (team.getFlagVolume() != null) { if (team.getFlagVolume() != null) {
team.getFlagVolume().resetBlocks(); team.getFlagVolume().resetBlocks();

View File

@ -10,7 +10,6 @@ import bukkit.tommytony.war.WarCommandHandler;
import com.tommytony.war.Team; import com.tommytony.war.Team;
import com.tommytony.war.TeamKind; import com.tommytony.war.TeamKind;
import com.tommytony.war.TeamKinds;
import com.tommytony.war.Warzone; import com.tommytony.war.Warzone;
import com.tommytony.war.ZoneLobby; import com.tommytony.war.ZoneLobby;
@ -82,7 +81,7 @@ public class JoinCommand extends AbstractWarCommand {
// join new team // join new team
String name = this.args[0]; String name = this.args[0];
TeamKind kind = TeamKinds.teamKindFromString(this.args[0]); TeamKind kind = TeamKind.teamKindFromString(this.args[0]);
if (zone.isDisabled()) { if (zone.isDisabled()) {
this.msg("This warzone is disabled."); this.msg("This warzone is disabled.");

View File

@ -5,7 +5,6 @@ import org.bukkit.entity.Player;
import com.tommytony.war.Team; import com.tommytony.war.Team;
import com.tommytony.war.TeamKind; import com.tommytony.war.TeamKind;
import com.tommytony.war.TeamKinds;
import com.tommytony.war.Warzone; import com.tommytony.war.Warzone;
import com.tommytony.war.mappers.WarzoneMapper; import com.tommytony.war.mappers.WarzoneMapper;
@ -39,7 +38,7 @@ public class SetTeamCommand extends AbstractZoneMakerCommand {
return false; return false;
} }
TeamKind teamKind = TeamKinds.teamKindFromString(this.args[0]); TeamKind teamKind = TeamKind.teamKindFromString(this.args[0]);
Team existingTeam = zone.getTeamByKind(teamKind); Team existingTeam = zone.getTeamByKind(teamKind);
if (existingTeam != null) { if (existingTeam != null) {
// relocate // relocate
@ -47,7 +46,7 @@ public class SetTeamCommand extends AbstractZoneMakerCommand {
this.msg("Team " + existingTeam.getName() + " spawn relocated."); this.msg("Team " + existingTeam.getName() + " spawn relocated.");
} else { } else {
// new team (use default TeamKind name for now) // new team (use default TeamKind name for now)
Team newTeam = new Team(teamKind.getDefaultName(), teamKind, player.getLocation(), zone); Team newTeam = new Team(teamKind.toString(), teamKind, player.getLocation(), zone);
newTeam.setRemainingLives(zone.getLifePool()); newTeam.setRemainingLives(zone.getLifePool());
zone.getTeams().add(newTeam); zone.getTeams().add(newTeam);
if (zone.getLobby() != null) { if (zone.getLobby() != null) {

View File

@ -6,7 +6,6 @@ import org.bukkit.entity.Player;
import com.tommytony.war.Team; import com.tommytony.war.Team;
import com.tommytony.war.TeamKind; import com.tommytony.war.TeamKind;
import com.tommytony.war.TeamKinds;
import com.tommytony.war.Warzone; import com.tommytony.war.Warzone;
import com.tommytony.war.mappers.WarzoneMapper; import com.tommytony.war.mappers.WarzoneMapper;
@ -40,7 +39,7 @@ public class SetTeamFlagCommand extends AbstractZoneMakerCommand {
return false; return false;
} }
TeamKind kind = TeamKinds.teamKindFromString(this.args[0]); TeamKind kind = TeamKind.teamKindFromString(this.args[0]);
Team team = zone.getTeamByKind(kind); Team team = zone.getTeamByKind(kind);
if (team == null) { if (team == null) {
// no such team yet // no such team yet

View File

@ -62,10 +62,10 @@ public class Team {
int y = this.teamSpawn.getBlockY(); int y = this.teamSpawn.getBlockY();
int z = this.teamSpawn.getBlockZ(); int z = this.teamSpawn.getBlockZ();
if (this.warzone.getSpawnStyle().equals(TeamSpawnStyles.INVISIBLE)) { if (this.warzone.getSpawnStyle().equals(TeamSpawnStyle.INVISIBLE)) {
this.spawnVolume.setCornerOne(this.warzone.getWorld().getBlockAt(x, y - 1, z)); this.spawnVolume.setCornerOne(this.warzone.getWorld().getBlockAt(x, y - 1, z));
this.spawnVolume.setCornerTwo(this.warzone.getWorld().getBlockAt(x, y + 3, z)); this.spawnVolume.setCornerTwo(this.warzone.getWorld().getBlockAt(x, y + 3, z));
} else if (this.warzone.getSpawnStyle().equals(TeamSpawnStyles.SMALL)) { } else if (this.warzone.getSpawnStyle().equals(TeamSpawnStyle.SMALL)) {
this.spawnVolume.setCornerOne(this.warzone.getWorld().getBlockAt(x - 1, y - 1, z - 1)); this.spawnVolume.setCornerOne(this.warzone.getWorld().getBlockAt(x - 1, y - 1, z - 1));
this.spawnVolume.setCornerTwo(this.warzone.getWorld().getBlockAt(x + 1, y + 3, z + 1)); this.spawnVolume.setCornerTwo(this.warzone.getWorld().getBlockAt(x + 1, y + 3, z + 1));
} else { } else {
@ -85,7 +85,7 @@ public class Team {
int y = this.teamSpawn.getBlockY(); int y = this.teamSpawn.getBlockY();
int z = this.teamSpawn.getBlockZ(); int z = this.teamSpawn.getBlockZ();
if (this.warzone.getSpawnStyle().equals(TeamSpawnStyles.INVISIBLE)) { if (this.warzone.getSpawnStyle().equals(TeamSpawnStyle.INVISIBLE)) {
// nothing but glowstone // nothing but glowstone
this.warzone.getWorld().getBlockAt(x, y - 1, z).setType(Material.GLOWSTONE); this.warzone.getWorld().getBlockAt(x, y - 1, z).setType(Material.GLOWSTONE);
} else { } else {
@ -111,7 +111,7 @@ public class Team {
Block signBlock = null; Block signBlock = null;
int signData = 0; int signData = 0;
if (this.warzone.getSpawnStyle().equals(TeamSpawnStyles.INVISIBLE)) { if (this.warzone.getSpawnStyle().equals(TeamSpawnStyle.INVISIBLE)) {
// INVISIBLE style // INVISIBLE style
signBlock = this.warzone.getWorld().getBlockAt(x, y, z); signBlock = this.warzone.getWorld().getBlockAt(x, y, z);
if (yaw >= 0 && yaw < 90) { if (yaw >= 0 && yaw < 90) {
@ -123,7 +123,7 @@ public class Team {
} else if (yaw >= 270 && yaw <= 360) { } else if (yaw >= 270 && yaw <= 360) {
signData = 6; signData = 6;
} }
} else if (this.warzone.getSpawnStyle().equals(TeamSpawnStyles.SMALL)) { } else if (this.warzone.getSpawnStyle().equals(TeamSpawnStyle.SMALL)) {
// SMALL style // SMALL style
if (yaw >= 0 && yaw < 90) { if (yaw >= 0 && yaw < 90) {
signData = 10; signData = 10;
@ -169,7 +169,7 @@ public class Team {
signData = 10; signData = 10;
signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getFace(BlockFace.NORTH, 2).getFace(BlockFace.WEST, 2); signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getFace(BlockFace.NORTH, 2).getFace(BlockFace.WEST, 2);
if (this.warzone.getSpawnStyle().equals(TeamSpawnStyles.BIG)) { if (this.warzone.getSpawnStyle().equals(TeamSpawnStyle.BIG)) {
// rim // rim
this.setBlock(x - 2, y, z - 1, this.kind); this.setBlock(x - 2, y, z - 1, this.kind);
this.setBlock(x - 2, y, z - 2, this.kind); this.setBlock(x - 2, y, z - 2, this.kind);
@ -201,7 +201,7 @@ public class Team {
opposite = BlockFace.SOUTH_WEST; opposite = BlockFace.SOUTH_WEST;
signData = 14; signData = 14;
signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getFace(BlockFace.NORTH, 2).getFace(BlockFace.EAST, 2); signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getFace(BlockFace.NORTH, 2).getFace(BlockFace.EAST, 2);
if (this.warzone.getSpawnStyle().equals(TeamSpawnStyles.BIG)) { if (this.warzone.getSpawnStyle().equals(TeamSpawnStyle.BIG)) {
// rim // rim
this.setBlock(x + 1, y, z - 2, this.kind); this.setBlock(x + 1, y, z - 2, this.kind);
this.setBlock(x + 2, y, z - 2, this.kind); this.setBlock(x + 2, y, z - 2, this.kind);
@ -233,7 +233,7 @@ public class Team {
opposite = BlockFace.NORTH_WEST; opposite = BlockFace.NORTH_WEST;
signData = 2; signData = 2;
signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getFace(BlockFace.SOUTH, 2).getFace(BlockFace.EAST, 2); signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getFace(BlockFace.SOUTH, 2).getFace(BlockFace.EAST, 2);
if (this.warzone.getSpawnStyle().equals(TeamSpawnStyles.BIG)) { if (this.warzone.getSpawnStyle().equals(TeamSpawnStyle.BIG)) {
// rim // rim
this.setBlock(x + 2, y, z + 1, this.kind); this.setBlock(x + 2, y, z + 1, this.kind);
this.setBlock(x + 2, y, z + 2, this.kind); this.setBlock(x + 2, y, z + 2, this.kind);
@ -265,7 +265,7 @@ public class Team {
opposite = BlockFace.NORTH_EAST; opposite = BlockFace.NORTH_EAST;
signData = 6; signData = 6;
signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getFace(BlockFace.SOUTH, 2).getFace(BlockFace.WEST, 2); signBlock = this.warzone.getWorld().getBlockAt(x, y, z).getFace(BlockFace.SOUTH, 2).getFace(BlockFace.WEST, 2);
if (this.warzone.getSpawnStyle().equals(TeamSpawnStyles.BIG)) { if (this.warzone.getSpawnStyle().equals(TeamSpawnStyle.BIG)) {
// rim // rim
this.setBlock(x - 1, y, z + 2, this.kind); this.setBlock(x - 1, y, z + 2, this.kind);
this.setBlock(x - 2, y, z + 2, this.kind); this.setBlock(x - 2, y, z + 2, this.kind);

View File

@ -3,33 +3,56 @@ package com.tommytony.war;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
public class TeamKind { public enum TeamKind {
private final Material material; WHITE ((byte) 0, Material.WOOL, ChatColor.WHITE),
ORANGE ((byte) 1, Material.WOOL, ChatColor.GOLD),
MAGENTA ((byte) 2, Material.WOOL, ChatColor.LIGHT_PURPLE),
BLUE ((byte) 3, Material.WOOL, ChatColor.BLUE),
GOLD ((byte) 4, Material.WOOL, ChatColor.YELLOW), // yellow = gold
GREEN ((byte) 5, Material.WOOL, ChatColor.GREEN),
PINK ((byte) 6, Material.WOOL, ChatColor.WHITE),
GRAY ((byte) 7, Material.WOOL, ChatColor.DARK_GRAY),
IRON ((byte) 8, Material.WOOL, ChatColor.GRAY), // lightgrey = iron
DIAMOND ((byte) 9, Material.WOOL, ChatColor.DARK_AQUA), // cyan = diamond
PURPLE ((byte) 10, Material.WOOL, ChatColor.DARK_PURPLE),
NAVY ((byte) 11, Material.WOOL, ChatColor.DARK_BLUE),
BROWN ((byte) 12, Material.WOOL, ChatColor.DARK_RED),
DARKGREEN ((byte) 13, Material.WOOL, ChatColor.DARK_GREEN),
RED ((byte) 14, Material.WOOL, ChatColor.RED),
BLACK ((byte) 15, Material.WOOL, ChatColor.BLACK);
private final byte data; private final byte data;
private final String defaultName;
private final ChatColor color; private final ChatColor color;
private final Material material;
public TeamKind(String defaultName, Material material, byte data, ChatColor color) { private TeamKind(byte data, Material material, ChatColor color) {
this.defaultName = defaultName;
this.material = material;
this.data = data; this.data = data;
this.material = material;
this.color = color; this.color = color;
}
public static TeamKind teamKindFromString(String str) {
String lowered = str.toLowerCase();
for (TeamKind kind : TeamKind.values()) {
if (kind.toString().startsWith(lowered)) {
return kind;
}
}
return null;
}
public byte getData() {
return this.data;
}
public ChatColor getColor() {
return this.color;
} }
public Material getMaterial() { public Material getMaterial() {
return this.material; return this.material;
} }
public byte getData() { public String toString() {
return this.data; return super.toString().toLowerCase();
}
public String getDefaultName() {
return this.defaultName;
}
public ChatColor getColor() {
return this.color;
} }
} }

View File

@ -1,49 +0,0 @@
package com.tommytony.war;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.Material;
/**
*
* @author tommytony
*
*/
public class TeamKinds {
private static final List<TeamKind> teamKinds = new ArrayList<TeamKind>();
static {
TeamKinds.getTeamkinds().add(new TeamKind("white", Material.WOOL, (byte) 0, ChatColor.WHITE));
TeamKinds.getTeamkinds().add(new TeamKind("orange", Material.WOOL, (byte) 1, ChatColor.GOLD));
TeamKinds.getTeamkinds().add(new TeamKind("magenta", Material.WOOL, (byte) 2, ChatColor.LIGHT_PURPLE));
TeamKinds.getTeamkinds().add(new TeamKind("blue", Material.WOOL, (byte) 3, ChatColor.BLUE));
TeamKinds.getTeamkinds().add(new TeamKind("gold", Material.WOOL, (byte) 4, ChatColor.YELLOW)); // yellow = gold
TeamKinds.getTeamkinds().add(new TeamKind("green", Material.WOOL, (byte) 5, ChatColor.GREEN));
TeamKinds.getTeamkinds().add(new TeamKind("pink", Material.WOOL, (byte) 6, ChatColor.WHITE));
TeamKinds.getTeamkinds().add(new TeamKind("gray", Material.WOOL, (byte) 7, ChatColor.DARK_GRAY));
TeamKinds.getTeamkinds().add(new TeamKind("iron", Material.WOOL, (byte) 8, ChatColor.GRAY)); // lightgrey = iron
TeamKinds.getTeamkinds().add(new TeamKind("diamond", Material.WOOL, (byte) 9, ChatColor.DARK_AQUA)); // cyan = diamond
TeamKinds.getTeamkinds().add(new TeamKind("purple", Material.WOOL, (byte) 10, ChatColor.DARK_PURPLE));
TeamKinds.getTeamkinds().add(new TeamKind("navy", Material.WOOL, (byte) 11, ChatColor.DARK_BLUE));
TeamKinds.getTeamkinds().add(new TeamKind("brown", Material.WOOL, (byte) 12, ChatColor.DARK_RED));
TeamKinds.getTeamkinds().add(new TeamKind("darkgreen", Material.WOOL, (byte) 13, ChatColor.DARK_GREEN));
TeamKinds.getTeamkinds().add(new TeamKind("red", Material.WOOL, (byte) 14, ChatColor.RED));
TeamKinds.getTeamkinds().add(new TeamKind("black", Material.WOOL, (byte) 15, ChatColor.BLACK));
}
public static TeamKind teamKindFromString(String str) {
String lowered = str.toLowerCase();
for (TeamKind kind : TeamKinds.getTeamkinds()) {
if (kind.getDefaultName().startsWith(lowered)) {
return kind;
}
}
return null;
}
public static List<TeamKind> getTeamkinds() {
return TeamKinds.teamKinds;
}
}

View File

@ -0,0 +1,28 @@
package com.tommytony.war;
/**
*
* @author tommytony
*
*/
public enum TeamSpawnStyle {
INVISIBLE,
SMALL,
FLAT,
BIG;
@Override
public String toString() {
return super.toString().toLowerCase();
}
public static TeamSpawnStyle getStyleByString(String string) {
for (TeamSpawnStyle style : TeamSpawnStyle.values()) {
if (string.toLowerCase().equals(style.toString())) {
return style;
}
}
return TeamSpawnStyle.BIG;
}
}

View File

@ -1,13 +0,0 @@
package com.tommytony.war;
/**
*
* @author tommytony
*
*/
public class TeamSpawnStyles {
public static final String INVISIBLE = "invisible";
public static final String SMALL = "small";
public static final String FLAT = "flat";
public static final String BIG = "big";
}

View File

@ -46,8 +46,8 @@ public class Warzone {
private int teamCap = 5; private int teamCap = 5;
private int scoreCap = 5; private int scoreCap = 5;
private int monumentHeal = 5; private int monumentHeal = 5;
private String spawnStyle = TeamSpawnStyles.BIG;
private String flagReturn = "both"; private String flagReturn = "both";
private TeamSpawnStyle spawnStyle = TeamSpawnStyle.BIG;
private HashMap<Integer, ItemStack> reward = new HashMap<Integer, ItemStack>(); private HashMap<Integer, ItemStack> reward = new HashMap<Integer, ItemStack>();
private HashMap<String, InventoryStash> inventories = new HashMap<String, InventoryStash>(); private HashMap<String, InventoryStash> inventories = new HashMap<String, InventoryStash>();
@ -326,11 +326,11 @@ public class Warzone {
if (this.isBlockHeads()) { if (this.isBlockHeads()) {
playerInv.setHelmet(new ItemStack(team.getKind().getMaterial(), 1, (short) 1, new Byte(team.getKind().getData()))); playerInv.setHelmet(new ItemStack(team.getKind().getMaterial(), 1, (short) 1, new Byte(team.getKind().getData())));
} else { } else {
if (team.getKind() == TeamKinds.teamKindFromString("gold")) { if (team.getKind() == TeamKind.GOLD) {
playerInv.setHelmet(new ItemStack(Material.GOLD_HELMET)); playerInv.setHelmet(new ItemStack(Material.GOLD_HELMET));
} else if (team.getKind() == TeamKinds.teamKindFromString("diamond")) { } else if (team.getKind() == TeamKind.DIAMOND) {
playerInv.setHelmet(new ItemStack(Material.DIAMOND_HELMET)); playerInv.setHelmet(new ItemStack(Material.DIAMOND_HELMET));
} else if (team.getKind() == TeamKinds.teamKindFromString("iron")) { } else if (team.getKind() == TeamKind.IRON) {
playerInv.setHelmet(new ItemStack(Material.IRON_HELMET)); playerInv.setHelmet(new ItemStack(Material.IRON_HELMET));
} else { } else {
playerInv.setHelmet(new ItemStack(Material.LEATHER_HELMET)); playerInv.setHelmet(new ItemStack(Material.LEATHER_HELMET));
@ -961,14 +961,14 @@ public class Warzone {
return this.blockHeads; return this.blockHeads;
} }
public void setSpawnStyle(String spawnStyle) { public void setSpawnStyle(TeamSpawnStyle spawnStyle) {
this.spawnStyle = spawnStyle; this.spawnStyle = spawnStyle;
for (Team team : this.teams) { for (Team team : this.teams) {
team.setTeamSpawn(team.getTeamSpawn()); team.setTeamSpawn(team.getTeamSpawn());
} }
} }
public String getSpawnStyle() { public TeamSpawnStyle getSpawnStyle() {
return this.spawnStyle; return this.spawnStyle;
} }

View File

@ -288,7 +288,7 @@ public class ZoneLobby {
this.placeAutoAssignGate(); this.placeAutoAssignGate();
for (String teamName : this.teamGateBlocks.keySet()) { for (String teamName : this.teamGateBlocks.keySet()) {
BlockInfo gateInfo = this.teamGateBlocks.get(teamName); BlockInfo gateInfo = this.teamGateBlocks.get(teamName);
this.placeGate(BlockInfo.getBlock(this.warzone.getWorld(), gateInfo), TeamKinds.teamKindFromString(teamName)); this.placeGate(BlockInfo.getBlock(this.warzone.getWorld(), gateInfo), TeamKind.teamKindFromString(teamName));
} }
for (Team t : this.warzone.getTeams()) { for (Team t : this.warzone.getTeams()) {
this.resetTeamGateSign(t); this.resetTeamGateSign(t);

View File

@ -46,7 +46,7 @@ public class HelmetProtectionTask implements Runnable {
} }
} }
try { try {
Thread.sleep((War.war.isLoaded()) ? 500 : 10000)); Thread.sleep((War.war.isLoaded()) ? 500 : 10000);
} catch (InterruptedException e) { } catch (InterruptedException e) {
} }
} }

View File

@ -9,7 +9,7 @@ import org.bukkit.inventory.ItemStack;
import bukkit.tommytony.war.War; import bukkit.tommytony.war.War;
import com.tommytony.war.TeamSpawnStyles; import com.tommytony.war.TeamSpawnStyle;
import com.tommytony.war.WarHub; import com.tommytony.war.WarHub;
import com.tommytony.war.Warzone; import com.tommytony.war.Warzone;
import com.tommytony.war.jobs.RestoreWarhubJob; import com.tommytony.war.jobs.RestoreWarhubJob;
@ -118,15 +118,7 @@ public class WarMapper {
// defaultSpawnStyle // defaultSpawnStyle
String spawnStyle = warConfig.getString("defaultspawnStyle"); String spawnStyle = warConfig.getString("defaultspawnStyle");
if (spawnStyle != null && !spawnStyle.equals("")) { if (spawnStyle != null && !spawnStyle.equals("")) {
spawnStyle = spawnStyle.toLowerCase(); War.war.setDefaultSpawnStyle(TeamSpawnStyle.getStyleByString(spawnStyle));
if (spawnStyle.equals(TeamSpawnStyles.SMALL)) {
War.war.setDefaultSpawnStyle(spawnStyle);
} else if (spawnStyle.equals(TeamSpawnStyles.FLAT)) {
War.war.setDefaultSpawnStyle(spawnStyle);
} else if (spawnStyle.equals(TeamSpawnStyles.INVISIBLE)) {
War.war.setDefaultSpawnStyle(spawnStyle);
}
// default is already initialized to BIG (see Warzone)
} }
// defaultFlagReturn // defaultFlagReturn
@ -248,7 +240,7 @@ public class WarMapper {
warConfig.setBoolean("disablePvpMessage", War.war.isDisablePvpMessage()); warConfig.setBoolean("disablePvpMessage", War.war.isDisablePvpMessage());
// spawnStyle // spawnStyle
warConfig.setString("spawnStyle", War.war.getDefaultSpawnStyle()); warConfig.setString("spawnStyle", War.war.getDefaultSpawnStyle().toString());
// defaultReward // defaultReward
String defaultRewardStr = ""; String defaultRewardStr = "";

View File

@ -15,8 +15,8 @@ import bukkit.tommytony.war.War;
import com.tommytony.war.Monument; import com.tommytony.war.Monument;
import com.tommytony.war.Team; import com.tommytony.war.Team;
import com.tommytony.war.TeamKinds; import com.tommytony.war.TeamKind;
import com.tommytony.war.TeamSpawnStyles; import com.tommytony.war.TeamSpawnStyle;
import com.tommytony.war.Warzone; import com.tommytony.war.Warzone;
import com.tommytony.war.ZoneLobby; import com.tommytony.war.ZoneLobby;
import com.tommytony.war.volumes.Volume; import com.tommytony.war.volumes.Volume;
@ -93,7 +93,7 @@ public class WarzoneMapper {
int yaw = Integer.parseInt(teamStrSplit[4]); int yaw = Integer.parseInt(teamStrSplit[4]);
teamLocation.setYaw(yaw); teamLocation.setYaw(yaw);
} }
Team team = new Team(teamStrSplit[0], TeamKinds.teamKindFromString(teamStrSplit[0]), teamLocation, warzone); Team team = new Team(teamStrSplit[0], TeamKind.teamKindFromString(teamStrSplit[0]), teamLocation, warzone);
team.setRemainingLives(warzone.getLifePool()); team.setRemainingLives(warzone.getLifePool());
warzone.getTeams().add(team); warzone.getTeams().add(team);
} }
@ -107,7 +107,7 @@ public class WarzoneMapper {
for (String teamFlagStr : teamFlagsSplit) { for (String teamFlagStr : teamFlagsSplit) {
if (teamFlagStr != null && !teamFlagStr.equals("")) { if (teamFlagStr != null && !teamFlagStr.equals("")) {
String[] teamFlagStrSplit = teamFlagStr.split(","); String[] teamFlagStrSplit = teamFlagStr.split(",");
Team team = warzone.getTeamByKind(TeamKinds.teamKindFromString(teamFlagStrSplit[0])); Team team = warzone.getTeamByKind(TeamKind.teamKindFromString(teamFlagStrSplit[0]));
if (team != null) { if (team != null) {
int teamFlagX = Integer.parseInt(teamFlagStrSplit[1]); int teamFlagX = Integer.parseInt(teamFlagStrSplit[1]);
int teamFlagY = Integer.parseInt(teamFlagStrSplit[2]); int teamFlagY = Integer.parseInt(teamFlagStrSplit[2]);
@ -161,15 +161,7 @@ public class WarzoneMapper {
// spawnStyle // spawnStyle
String spawnStyle = warzoneConfig.getString("spawnStyle"); String spawnStyle = warzoneConfig.getString("spawnStyle");
if (spawnStyle != null && !spawnStyle.equals("")) { if (spawnStyle != null && !spawnStyle.equals("")) {
spawnStyle = spawnStyle.toLowerCase(); warzone.setSpawnStyle(TeamSpawnStyle.getStyleByString(spawnStyle));
if (spawnStyle.equals(TeamSpawnStyles.SMALL)) {
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)
} }
// flagReturn // flagReturn
@ -382,7 +374,7 @@ public class WarzoneMapper {
warzoneConfig.setBoolean("blockHeads", warzone.isBlockHeads()); warzoneConfig.setBoolean("blockHeads", warzone.isBlockHeads());
// spawnStyle // spawnStyle
warzoneConfig.setString("spawnStyle", warzone.getSpawnStyle()); warzoneConfig.setString("spawnStyle", warzone.getSpawnStyle().toString());
// reward // reward
String rewardStr = ""; String rewardStr = "";