More reformatting

This commit is contained in:
drtshock
2014-07-01 14:52:40 -05:00
parent dc54f78cc1
commit 5066934a95
109 changed files with 1288 additions and 2883 deletions

View File

@@ -27,8 +27,7 @@ public class Factions extends EntityCollection<Faction> {
@Override
public Type getMapType() {
return new TypeToken<Map<String, Faction>>() {
}.getType();
return new TypeToken<Map<String, Faction>>() {}.getType();
}
@Override
@@ -37,30 +36,24 @@ public class Factions extends EntityCollection<Faction> {
// Make sure the default neutral faction exists
if (!this.exists("0")) {
Faction faction = this.create("0");
faction.setTag(TL.WILDERNESS.toString());
Faction faction = this.create("0"); faction.setTag(TL.WILDERNESS.toString());
faction.setDescription(TL.WILDERNESS_DESCRIPTION.toString());
}
else {
} else {
if (!this.get("0").getTag().equalsIgnoreCase(TL.WILDERNESS.toString())) {
get("0").setTag(TL.WILDERNESS.toString());
}
if (!this.get("0").getDescription().equalsIgnoreCase(TL.WILDERNESS_DESCRIPTION.toString())) {
} if (!this.get("0").getDescription().equalsIgnoreCase(TL.WILDERNESS_DESCRIPTION.toString())) {
get("0").setDescription(TL.WILDERNESS_DESCRIPTION.toString());
}
}
// Make sure the safe zone faction exists
if (!this.exists("-1")) {
Faction faction = this.create("-1");
faction.setTag(TL.SAFEZONE.toString());
Faction faction = this.create("-1"); faction.setTag(TL.SAFEZONE.toString());
faction.setDescription(TL.SAFEZONE_DESCRIPTION.toString());
}
else {
} else {
if (!getSafeZone().getTag().equalsIgnoreCase(TL.SAFEZONE.toString())) {
getSafeZone().setTag(TL.SAFEZONE.toString());
}
if (!getSafeZone().getDescription().equalsIgnoreCase(TL.SAFEZONE_DESCRIPTION.toString())) {
} if (!getSafeZone().getDescription().equalsIgnoreCase(TL.SAFEZONE_DESCRIPTION.toString())) {
getSafeZone().setDescription(TL.SAFEZONE_DESCRIPTION.toString());
}
// if SafeZone has old pre-1.6.0 name, rename it to remove troublesome " "
@@ -70,15 +63,12 @@ public class Factions extends EntityCollection<Faction> {
// Make sure the war zone faction exists
if (!this.exists("-2")) {
Faction faction = this.create("-2");
faction.setTag(TL.WARZONE.toString());
Faction faction = this.create("-2"); faction.setTag(TL.WARZONE.toString());
faction.setDescription(TL.WARZONE_DESCRIPTION.toString());
}
else {
} else {
if (!getWarZone().getTag().equalsIgnoreCase(TL.WARZONE.toString())) {
getWarZone().setTag(TL.WARZONE.toString());
}
if (!getWarZone().getDescription().equalsIgnoreCase(TL.WARZONE_DESCRIPTION.toString())) {
} if (!getWarZone().getDescription().equalsIgnoreCase(TL.WARZONE_DESCRIPTION.toString())) {
getWarZone().setDescription(TL.WARZONE_DESCRIPTION.toString());
}
// if WarZone has old pre-1.6.0 name, rename it to remove troublesome " "
@@ -102,8 +92,7 @@ public class Factions extends EntityCollection<Faction> {
@Override
public Faction get(String id) {
if (!this.exists(id)) {
p.log(Level.WARNING, "Non existing factionId " + id + " requested! Issuing cleaning!");
Board.clean();
p.log(Level.WARNING, "Non existing factionId " + id + " requested! Issuing cleaning!"); Board.clean();
FPlayers.i.clean();
}
@@ -149,13 +138,11 @@ public class Factions extends EntityCollection<Faction> {
// Loops through all faction tags. Case and color insensitive.
public Faction getByTag(String str) {
String compStr = MiscUtil.getComparisonString(str);
for (Faction faction : this.get()) {
String compStr = MiscUtil.getComparisonString(str); for (Faction faction : this.get()) {
if (faction.getComparisonTag().equals(compStr)) {
return faction;
}
}
return null;
} return null;
}
public Faction getBestTagMatch(String searchFor) {
@@ -166,8 +153,7 @@ public class Factions extends EntityCollection<Faction> {
tag2faction.put(ChatColor.stripColor(faction.getTag()), faction);
}
String tag = TextUtil.getBestStartWithCI(tag2faction.keySet(), searchFor);
if (tag == null) { return null; }
String tag = TextUtil.getBestStartWithCI(tag2faction.keySet(), searchFor); if (tag == null) { return null; }
return tag2faction.get(tag);
}