From f6da2d397bd1a8b594db499840468234ea96d6d0 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Wed, 24 Apr 2013 14:42:52 +0200 Subject: [PATCH] Specifying meanings for null in Faction fields and removing the getAccountId method alltogether. --- .../factions/EconomyParticipator.java | 1 - .../massivecraft/factions/entity/Faction.java | 27 +++++++------------ .../massivecraft/factions/entity/UPlayer.java | 3 --- .../factions/integration/lwc/LwcEngine.java | 3 ++- 4 files changed, 11 insertions(+), 23 deletions(-) diff --git a/src/com/massivecraft/factions/EconomyParticipator.java b/src/com/massivecraft/factions/EconomyParticipator.java index 037df5a6..93e9a4b1 100644 --- a/src/com/massivecraft/factions/EconomyParticipator.java +++ b/src/com/massivecraft/factions/EconomyParticipator.java @@ -3,6 +3,5 @@ package com.massivecraft.factions; public interface EconomyParticipator extends RelationParticipator { - public String getAccountId(); public boolean msg(String msg, Object... args); } \ No newline at end of file diff --git a/src/com/massivecraft/factions/entity/Faction.java b/src/com/massivecraft/factions/entity/Faction.java index fccb3db8..8f7d2ae8 100644 --- a/src/com/massivecraft/factions/entity/Faction.java +++ b/src/com/massivecraft/factions/entity/Faction.java @@ -65,48 +65,48 @@ public class Faction extends Entity implements EconomyParticipator // TODO: The faction "tag" could/should also have been called "name". // The actual faction id looks something like "54947df8-0e9e-4471-a2f9-9af509fb5889" and that is not too easy to remember for humans. // Thus we make use of a name. Since the id is used in all foreign key situations changing the name is fine. + // Null should never happen. The tag must not be null. private String tag = null; // Factions can optionally set a description for themselves. // This description can for example be seen in territorial alerts. + // Null means the faction has no description. private String description = null; // Factions can optionally set a home location. // If they do their members can teleport there using /f home + // Null means the faction has no home. private PS home = null; // Factions usually do not have a powerboost. It defaults to 0. // The powerBoost is a custom increase/decrease to default and maximum power. + // Null means the faction has powerBoost (0). private Double powerBoost = null; // Can anyone join the Faction? // If the faction is open they can. // If the faction is closed an invite is required. + // Null means default for the universe. private Boolean open = null; // This is the ids of the invited players. // They are actually "senderIds" since you can invite "@console" to your faction. + // Null means no one is invited @SerializedName("invites") private Set invitedPlayerIds = null; // The keys in this map are factionIds. + // Null means no special relation whishes. private Map relationWish = null; // The flag overrides are modifications to the default values. + // Null means default for the universe. private Map flagOverrides = null; // The perm overrides are modifications to the default values. + // Null means default for the universe. private Map> permOverrides = null; - // -------------------------------------------- // - // CONSTRUCT - // -------------------------------------------- // - - public Faction() - { - - } - // -------------------------------------------- // // FIELD: id // -------------------------------------------- // @@ -123,15 +123,6 @@ public class Faction extends Entity implements EconomyParticipator return ! this.isNone(); } - // This is the bank account id used by external money-plugins - @Override - public String getAccountId() - { - String accountId = "faction-"+this.getId(); - - return accountId; - } - // -------------------------------------------- // // FIELD: tag // -------------------------------------------- // diff --git a/src/com/massivecraft/factions/entity/UPlayer.java b/src/com/massivecraft/factions/entity/UPlayer.java index 076a7f03..2ed6b518 100644 --- a/src/com/massivecraft/factions/entity/UPlayer.java +++ b/src/com/massivecraft/factions/entity/UPlayer.java @@ -115,9 +115,6 @@ public class UPlayer extends SenderEntity implements EconomyParticipato // FIELD: loginPvpDisabled //private transient boolean loginPvpDisabled; - // FIELD: account - public String getAccountId() { return this.getId(); } - // -------------------------------------------- // // CORE UTILITIES // -------------------------------------------- // diff --git a/src/com/massivecraft/factions/integration/lwc/LwcEngine.java b/src/com/massivecraft/factions/integration/lwc/LwcEngine.java index cdcda183..a375ae03 100644 --- a/src/com/massivecraft/factions/integration/lwc/LwcEngine.java +++ b/src/com/massivecraft/factions/integration/lwc/LwcEngine.java @@ -73,10 +73,11 @@ public class LwcEngine implements Listener public static void removeAlienProtections(PS chunkPs, Faction faction) { + List nonAliens = faction.getUPlayers(); for (Protection protection : getProtectionsInChunk(chunkPs)) { UPlayer owner = UPlayer.get(protection.getOwner()); - if (faction.getUPlayers().contains(owner)) continue; + if (nonAliens.contains(owner)) continue; protection.remove(); } }