From 0992c403b57c1e6add1dc67114008640d1c1fabc Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Wed, 24 Apr 2013 16:40:35 +0200 Subject: [PATCH] minor stuff --- .../massivecraft/factions/entity/Faction.java | 16 +++++++++++----- .../factions/entity/FactionColl.java | 12 +++--------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/com/massivecraft/factions/entity/Faction.java b/src/com/massivecraft/factions/entity/Faction.java index 8f7d2ae8..c89043e9 100644 --- a/src/com/massivecraft/factions/entity/Faction.java +++ b/src/com/massivecraft/factions/entity/Faction.java @@ -133,19 +133,24 @@ public class Faction extends Entity implements EconomyParticipator public String getTag() { String ret = this.tag; - if (UConf.get(this).factionTagForceUpperCase) + + UConf uconf = UConf.get(this); + if (uconf != null && UConf.get(this).factionTagForceUpperCase) { ret = ret.toUpperCase(); } + return ret; } public void setTag(String str) { - if (UConf.get(this).factionTagForceUpperCase) + UConf uconf = UConf.get(this); + if (uconf != null && UConf.get(this).factionTagForceUpperCase) { str = str.toUpperCase(); } + this.tag = str; this.changed(); } @@ -264,7 +269,9 @@ public class Faction extends Entity implements EconomyParticipator public boolean isDefaultOpen() { - return UConf.get(this).defaultFactionOpen; + UConf uconf = UConf.get(this); + if (uconf == null) return false; + return uconf.defaultFactionOpen; } public boolean isOpen() @@ -274,9 +281,8 @@ public class Faction extends Entity implements EconomyParticipator return ret; } - public void setOpen(Boolean open) + public void setOpen(boolean open) { - if (open == null || MUtil.equals(open, this.isDefaultOpen())) open = null; this.open = open; this.changed(); } diff --git a/src/com/massivecraft/factions/entity/FactionColl.java b/src/com/massivecraft/factions/entity/FactionColl.java index aca1c320..98fa697b 100644 --- a/src/com/massivecraft/factions/entity/FactionColl.java +++ b/src/com/massivecraft/factions/entity/FactionColl.java @@ -127,7 +127,7 @@ public class FactionColl extends Coll Faction faction = this.get(id); if (faction != null) return faction; - faction = this.createNewInstance(); + faction = this.create(id); faction.setTag(ChatColor.DARK_GREEN+"Wilderness"); faction.setDescription(null); @@ -150,8 +150,6 @@ public class FactionColl extends Coll faction.setPermittedRelations(FPerm.BUTTON, Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY); faction.setPermittedRelations(FPerm.LEVER, Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY); - this.attach(faction, id); - return faction; } @@ -161,7 +159,7 @@ public class FactionColl extends Coll Faction faction = this.get(id); if (faction != null) return faction; - faction = this.createNewInstance(); + faction = this.create(id); faction.setTag("SafeZone"); faction.setDescription("Free from PVP and monsters"); @@ -184,8 +182,6 @@ public class FactionColl extends Coll faction.setPermittedRelations(FPerm.LEVER, Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY); faction.setPermittedRelations(FPerm.TERRITORY, Rel.LEADER, Rel.OFFICER, Rel.MEMBER); - this.attach(faction, id); - return faction; } @@ -195,7 +191,7 @@ public class FactionColl extends Coll Faction faction = this.get(id); if (faction != null) return faction; - faction = this.createNewInstance(); + faction = this.create(id); faction.setTag("WarZone"); faction.setDescription("Not the safest place to be"); @@ -218,8 +214,6 @@ public class FactionColl extends Coll faction.setPermittedRelations(FPerm.LEVER, Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY, Rel.TRUCE, Rel.NEUTRAL, Rel.ENEMY); faction.setPermittedRelations(FPerm.TERRITORY, Rel.LEADER, Rel.OFFICER, Rel.MEMBER); - this.attach(faction, id); - return faction; }