mirror of
https://github.com/taoneill/war.git
synced 2024-11-24 03:05:54 +01:00
Closes gh-277. Resolving conflicts while merging Tim's realEnums.
This commit is contained in:
commit
e8776d3d74
@ -75,11 +75,9 @@ public class War extends JavaPlugin {
|
||||
private boolean defaultAutoAssignOnly = false;
|
||||
private boolean defaultUnbreakableZoneBlocks = false;
|
||||
private boolean defaultNoCreatures = false;
|
||||
private boolean defaultResetOnEmpty = false,
|
||||
defaultResetOnLoad = false,
|
||||
defaultResetOnUnload = false;
|
||||
private String defaultSpawnStyle = TeamSpawnStyles.BIG;
|
||||
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>();
|
||||
|
||||
public War() {
|
||||
@ -263,16 +261,8 @@ public class War extends JavaPlugin {
|
||||
warzone.setBlockHeads(onOff.equals("on") || onOff.equals("true"));
|
||||
}
|
||||
if (namedParams.containsKey("spawnstyle")) {
|
||||
String spawnStyle = namedParams.get("spawnstyle").toLowerCase();
|
||||
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);
|
||||
} else {
|
||||
warzone.setSpawnStyle(TeamSpawnStyles.BIG);
|
||||
}
|
||||
String spawnStyle = namedParams.get("spawnstyle");
|
||||
warzone.setSpawnStyle(TeamSpawnStyle.getStyleByString(spawnStyle));
|
||||
}
|
||||
if (namedParams.containsKey("flagreturn")) {
|
||||
String flagReturn = namedParams.get("flagreturn").toLowerCase();
|
||||
@ -367,16 +357,8 @@ public class War extends JavaPlugin {
|
||||
this.setDefaultBlockHeads(onOff.equals("on") || onOff.equals("true"));
|
||||
}
|
||||
if (namedParams.containsKey("spawnstyle")) {
|
||||
String spawnStyle = namedParams.get("spawnstyle").toLowerCase();
|
||||
if (spawnStyle.equals(TeamSpawnStyles.SMALL)) {
|
||||
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);
|
||||
}
|
||||
String spawnStyle = namedParams.get("spawnstyle");
|
||||
this.setDefaultSpawnStyle(TeamSpawnStyle.getStyleByString(spawnStyle));
|
||||
}
|
||||
if (namedParams.containsKey("flagreturn")) {
|
||||
String flagreturn = namedParams.get("flagreturn").toLowerCase();
|
||||
@ -527,8 +509,8 @@ public class War extends JavaPlugin {
|
||||
>>>>>>> 174126209b48a201d04de613eaae26503605fa94
|
||||
*/
|
||||
private String colorKnownTokens(String str, ChatColor msgColor) {
|
||||
for (TeamKind kind : TeamKinds.getTeamkinds()) {
|
||||
str = str.replaceAll(" " + kind.getDefaultName(), " " + kind.getColor() + kind.getDefaultName() + msgColor);
|
||||
for (TeamKind kind : TeamKind.values()) {
|
||||
str = str.replaceAll(" " + kind.toString(), " " + kind.getColor() + kind.toString() + msgColor);
|
||||
}
|
||||
str = str.replaceAll("Ex -", ChatColor.GRAY + "Ex -");
|
||||
return str;
|
||||
@ -893,11 +875,11 @@ public class War extends JavaPlugin {
|
||||
this.defaultResetOnUnload = defaultResetOnUnload;
|
||||
}
|
||||
|
||||
public String getDefaultSpawnStyle() {
|
||||
return this.defaultSpawnStyle;
|
||||
public TeamSpawnStyle getDefaultSpawnStyle() {
|
||||
return defaultSpawnStyle;
|
||||
}
|
||||
|
||||
public void setDefaultSpawnStyle(String defaultSpawnStyle) {
|
||||
public void setDefaultSpawnStyle(TeamSpawnStyle defaultSpawnStyle) {
|
||||
this.defaultSpawnStyle = defaultSpawnStyle;
|
||||
}
|
||||
|
||||
|
@ -4,9 +4,9 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.tommytony.war.Team;
|
||||
import com.tommytony.war.TeamKinds;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.ZoneLobby;
|
||||
import com.tommytony.war.TeamKind;
|
||||
import com.tommytony.war.mappers.WarzoneMapper;
|
||||
|
||||
import bukkit.tommytony.war.WarCommandHandler;
|
||||
@ -50,7 +50,7 @@ public class DeleteTeamCommand extends AbstractZoneMakerCommand {
|
||||
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.getFlagVolume() != null) {
|
||||
team.getFlagVolume().resetBlocks();
|
||||
|
@ -10,7 +10,6 @@ import bukkit.tommytony.war.WarCommandHandler;
|
||||
|
||||
import com.tommytony.war.Team;
|
||||
import com.tommytony.war.TeamKind;
|
||||
import com.tommytony.war.TeamKinds;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.ZoneLobby;
|
||||
|
||||
@ -82,7 +81,7 @@ public class JoinCommand extends AbstractWarCommand {
|
||||
|
||||
// join new team
|
||||
String name = this.args[0];
|
||||
TeamKind kind = TeamKinds.teamKindFromString(this.args[0]);
|
||||
TeamKind kind = TeamKind.teamKindFromString(this.args[0]);
|
||||
|
||||
if (zone.isDisabled()) {
|
||||
this.msg("This warzone is disabled.");
|
||||
|
@ -5,7 +5,6 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import com.tommytony.war.Team;
|
||||
import com.tommytony.war.TeamKind;
|
||||
import com.tommytony.war.TeamKinds;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.mappers.WarzoneMapper;
|
||||
|
||||
@ -39,7 +38,7 @@ public class SetTeamCommand extends AbstractZoneMakerCommand {
|
||||
return false;
|
||||
}
|
||||
|
||||
TeamKind teamKind = TeamKinds.teamKindFromString(this.args[0]);
|
||||
TeamKind teamKind = TeamKind.teamKindFromString(this.args[0]);
|
||||
Team existingTeam = zone.getTeamByKind(teamKind);
|
||||
if (existingTeam != null) {
|
||||
// relocate
|
||||
@ -47,7 +46,7 @@ public class SetTeamCommand extends AbstractZoneMakerCommand {
|
||||
this.msg("Team " + existingTeam.getName() + " spawn relocated.");
|
||||
} else {
|
||||
// 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());
|
||||
zone.getTeams().add(newTeam);
|
||||
if (zone.getLobby() != null) {
|
||||
|
@ -6,7 +6,6 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import com.tommytony.war.Team;
|
||||
import com.tommytony.war.TeamKind;
|
||||
import com.tommytony.war.TeamKinds;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.mappers.WarzoneMapper;
|
||||
|
||||
@ -40,7 +39,7 @@ public class SetTeamFlagCommand extends AbstractZoneMakerCommand {
|
||||
return false;
|
||||
}
|
||||
|
||||
TeamKind kind = TeamKinds.teamKindFromString(this.args[0]);
|
||||
TeamKind kind = TeamKind.teamKindFromString(this.args[0]);
|
||||
Team team = zone.getTeamByKind(kind);
|
||||
if (team == null) {
|
||||
// no such team yet
|
||||
|
@ -62,10 +62,10 @@ public class Team {
|
||||
int y = this.teamSpawn.getBlockY();
|
||||
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.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.setCornerTwo(this.warzone.getWorld().getBlockAt(x + 1, y + 3, z + 1));
|
||||
} else {
|
||||
@ -85,7 +85,7 @@ public class Team {
|
||||
int y = this.teamSpawn.getBlockY();
|
||||
int z = this.teamSpawn.getBlockZ();
|
||||
|
||||
if (this.warzone.getSpawnStyle().equals(TeamSpawnStyles.INVISIBLE)) {
|
||||
if (this.warzone.getSpawnStyle().equals(TeamSpawnStyle.INVISIBLE)) {
|
||||
// nothing but glowstone
|
||||
this.warzone.getWorld().getBlockAt(x, y - 1, z).setType(Material.GLOWSTONE);
|
||||
} else {
|
||||
@ -111,7 +111,7 @@ public class Team {
|
||||
Block signBlock = null;
|
||||
int signData = 0;
|
||||
|
||||
if (this.warzone.getSpawnStyle().equals(TeamSpawnStyles.INVISIBLE)) {
|
||||
if (this.warzone.getSpawnStyle().equals(TeamSpawnStyle.INVISIBLE)) {
|
||||
// INVISIBLE style
|
||||
signBlock = this.warzone.getWorld().getBlockAt(x, y, z);
|
||||
if (yaw >= 0 && yaw < 90) {
|
||||
@ -123,7 +123,7 @@ public class Team {
|
||||
} else if (yaw >= 270 && yaw <= 360) {
|
||||
signData = 6;
|
||||
}
|
||||
} else if (this.warzone.getSpawnStyle().equals(TeamSpawnStyles.SMALL)) {
|
||||
} else if (this.warzone.getSpawnStyle().equals(TeamSpawnStyle.SMALL)) {
|
||||
// SMALL style
|
||||
if (yaw >= 0 && yaw < 90) {
|
||||
signData = 10;
|
||||
@ -169,7 +169,7 @@ public class Team {
|
||||
signData = 10;
|
||||
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
|
||||
this.setBlock(x - 2, y, z - 1, this.kind);
|
||||
this.setBlock(x - 2, y, z - 2, this.kind);
|
||||
@ -201,7 +201,7 @@ public class Team {
|
||||
opposite = BlockFace.SOUTH_WEST;
|
||||
signData = 14;
|
||||
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
|
||||
this.setBlock(x + 1, 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;
|
||||
signData = 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
|
||||
this.setBlock(x + 2, y, z + 1, this.kind);
|
||||
this.setBlock(x + 2, y, z + 2, this.kind);
|
||||
@ -265,7 +265,7 @@ public class Team {
|
||||
opposite = BlockFace.NORTH_EAST;
|
||||
signData = 6;
|
||||
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
|
||||
this.setBlock(x - 1, y, z + 2, this.kind);
|
||||
this.setBlock(x - 2, y, z + 2, this.kind);
|
||||
|
@ -3,33 +3,56 @@ package com.tommytony.war;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
|
||||
public class TeamKind {
|
||||
private final Material material;
|
||||
public enum TeamKind {
|
||||
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 String defaultName;
|
||||
private final ChatColor color;
|
||||
private final Material material;
|
||||
|
||||
public TeamKind(String defaultName, Material material, byte data, ChatColor color) {
|
||||
this.defaultName = defaultName;
|
||||
this.material = material;
|
||||
private TeamKind(byte data, Material material, ChatColor color) {
|
||||
this.data = data;
|
||||
this.material = material;
|
||||
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() {
|
||||
return this.material;
|
||||
}
|
||||
|
||||
public byte getData() {
|
||||
return this.data;
|
||||
}
|
||||
|
||||
public String getDefaultName() {
|
||||
return this.defaultName;
|
||||
}
|
||||
|
||||
public ChatColor getColor() {
|
||||
return this.color;
|
||||
public String toString() {
|
||||
return super.toString().toLowerCase();
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
28
war/src/main/java/com/tommytony/war/TeamSpawnStyle.java
Normal file
28
war/src/main/java/com/tommytony/war/TeamSpawnStyle.java
Normal 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;
|
||||
}
|
||||
}
|
@ -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";
|
||||
}
|
@ -46,8 +46,8 @@ public class Warzone {
|
||||
private int teamCap = 5;
|
||||
private int scoreCap = 5;
|
||||
private int monumentHeal = 5;
|
||||
private String spawnStyle = TeamSpawnStyles.BIG;
|
||||
private String flagReturn = "both";
|
||||
private TeamSpawnStyle spawnStyle = TeamSpawnStyle.BIG;
|
||||
private HashMap<Integer, ItemStack> reward = new HashMap<Integer, ItemStack>();
|
||||
|
||||
private HashMap<String, InventoryStash> inventories = new HashMap<String, InventoryStash>();
|
||||
@ -326,11 +326,11 @@ public class Warzone {
|
||||
if (this.isBlockHeads()) {
|
||||
playerInv.setHelmet(new ItemStack(team.getKind().getMaterial(), 1, (short) 1, new Byte(team.getKind().getData())));
|
||||
} else {
|
||||
if (team.getKind() == TeamKinds.teamKindFromString("gold")) {
|
||||
if (team.getKind() == TeamKind.GOLD) {
|
||||
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));
|
||||
} else if (team.getKind() == TeamKinds.teamKindFromString("iron")) {
|
||||
} else if (team.getKind() == TeamKind.IRON) {
|
||||
playerInv.setHelmet(new ItemStack(Material.IRON_HELMET));
|
||||
} else {
|
||||
playerInv.setHelmet(new ItemStack(Material.LEATHER_HELMET));
|
||||
@ -961,14 +961,14 @@ public class Warzone {
|
||||
return this.blockHeads;
|
||||
}
|
||||
|
||||
public void setSpawnStyle(String spawnStyle) {
|
||||
public void setSpawnStyle(TeamSpawnStyle spawnStyle) {
|
||||
this.spawnStyle = spawnStyle;
|
||||
for (Team team : this.teams) {
|
||||
team.setTeamSpawn(team.getTeamSpawn());
|
||||
}
|
||||
}
|
||||
|
||||
public String getSpawnStyle() {
|
||||
public TeamSpawnStyle getSpawnStyle() {
|
||||
return this.spawnStyle;
|
||||
}
|
||||
|
||||
|
@ -288,7 +288,7 @@ public class ZoneLobby {
|
||||
this.placeAutoAssignGate();
|
||||
for (String teamName : this.teamGateBlocks.keySet()) {
|
||||
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()) {
|
||||
this.resetTeamGateSign(t);
|
||||
|
@ -46,7 +46,7 @@ public class HelmetProtectionTask implements Runnable {
|
||||
}
|
||||
}
|
||||
try {
|
||||
Thread.sleep((War.war.isLoaded()) ? 500 : 10000));
|
||||
Thread.sleep((War.war.isLoaded()) ? 500 : 10000);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import bukkit.tommytony.war.War;
|
||||
|
||||
import com.tommytony.war.TeamSpawnStyles;
|
||||
import com.tommytony.war.TeamSpawnStyle;
|
||||
import com.tommytony.war.WarHub;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.jobs.RestoreWarhubJob;
|
||||
@ -118,15 +118,7 @@ public class WarMapper {
|
||||
// defaultSpawnStyle
|
||||
String spawnStyle = warConfig.getString("defaultspawnStyle");
|
||||
if (spawnStyle != null && !spawnStyle.equals("")) {
|
||||
spawnStyle = spawnStyle.toLowerCase();
|
||||
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)
|
||||
War.war.setDefaultSpawnStyle(TeamSpawnStyle.getStyleByString(spawnStyle));
|
||||
}
|
||||
|
||||
// defaultFlagReturn
|
||||
@ -248,7 +240,7 @@ public class WarMapper {
|
||||
warConfig.setBoolean("disablePvpMessage", War.war.isDisablePvpMessage());
|
||||
|
||||
// spawnStyle
|
||||
warConfig.setString("spawnStyle", War.war.getDefaultSpawnStyle());
|
||||
warConfig.setString("spawnStyle", War.war.getDefaultSpawnStyle().toString());
|
||||
|
||||
// defaultReward
|
||||
String defaultRewardStr = "";
|
||||
|
@ -15,8 +15,8 @@ import bukkit.tommytony.war.War;
|
||||
|
||||
import com.tommytony.war.Monument;
|
||||
import com.tommytony.war.Team;
|
||||
import com.tommytony.war.TeamKinds;
|
||||
import com.tommytony.war.TeamSpawnStyles;
|
||||
import com.tommytony.war.TeamKind;
|
||||
import com.tommytony.war.TeamSpawnStyle;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.ZoneLobby;
|
||||
import com.tommytony.war.volumes.Volume;
|
||||
@ -93,7 +93,7 @@ public class WarzoneMapper {
|
||||
int yaw = Integer.parseInt(teamStrSplit[4]);
|
||||
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());
|
||||
warzone.getTeams().add(team);
|
||||
}
|
||||
@ -107,7 +107,7 @@ public class WarzoneMapper {
|
||||
for (String teamFlagStr : teamFlagsSplit) {
|
||||
if (teamFlagStr != null && !teamFlagStr.equals("")) {
|
||||
String[] teamFlagStrSplit = teamFlagStr.split(",");
|
||||
Team team = warzone.getTeamByKind(TeamKinds.teamKindFromString(teamFlagStrSplit[0]));
|
||||
Team team = warzone.getTeamByKind(TeamKind.teamKindFromString(teamFlagStrSplit[0]));
|
||||
if (team != null) {
|
||||
int teamFlagX = Integer.parseInt(teamFlagStrSplit[1]);
|
||||
int teamFlagY = Integer.parseInt(teamFlagStrSplit[2]);
|
||||
@ -161,15 +161,7 @@ public class WarzoneMapper {
|
||||
// spawnStyle
|
||||
String spawnStyle = warzoneConfig.getString("spawnStyle");
|
||||
if (spawnStyle != null && !spawnStyle.equals("")) {
|
||||
spawnStyle = spawnStyle.toLowerCase();
|
||||
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)
|
||||
warzone.setSpawnStyle(TeamSpawnStyle.getStyleByString(spawnStyle));
|
||||
}
|
||||
|
||||
// flagReturn
|
||||
@ -382,7 +374,7 @@ public class WarzoneMapper {
|
||||
warzoneConfig.setBoolean("blockHeads", warzone.isBlockHeads());
|
||||
|
||||
// spawnStyle
|
||||
warzoneConfig.setString("spawnStyle", warzone.getSpawnStyle());
|
||||
warzoneConfig.setString("spawnStyle", warzone.getSpawnStyle().toString());
|
||||
|
||||
// reward
|
||||
String rewardStr = "";
|
||||
|
Loading…
Reference in New Issue
Block a user