Specifying meanings for null in Faction fields and removing the getAccountId method alltogether.

This commit is contained in:
Olof Larsson 2013-04-24 14:42:52 +02:00
parent 6846c426c4
commit f6da2d397b
4 changed files with 11 additions and 23 deletions

View File

@ -3,6 +3,5 @@ package com.massivecraft.factions;
public interface EconomyParticipator extends RelationParticipator public interface EconomyParticipator extends RelationParticipator
{ {
public String getAccountId();
public boolean msg(String msg, Object... args); public boolean msg(String msg, Object... args);
} }

View File

@ -65,48 +65,48 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
// TODO: The faction "tag" could/should also have been called "name". // 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. // 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. // 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; private String tag = null;
// Factions can optionally set a description for themselves. // Factions can optionally set a description for themselves.
// This description can for example be seen in territorial alerts. // This description can for example be seen in territorial alerts.
// Null means the faction has no description.
private String description = null; private String description = null;
// Factions can optionally set a home location. // Factions can optionally set a home location.
// If they do their members can teleport there using /f home // If they do their members can teleport there using /f home
// Null means the faction has no home.
private PS home = null; private PS home = null;
// Factions usually do not have a powerboost. It defaults to 0. // Factions usually do not have a powerboost. It defaults to 0.
// The powerBoost is a custom increase/decrease to default and maximum power. // The powerBoost is a custom increase/decrease to default and maximum power.
// Null means the faction has powerBoost (0).
private Double powerBoost = null; private Double powerBoost = null;
// Can anyone join the Faction? // Can anyone join the Faction?
// If the faction is open they can. // If the faction is open they can.
// If the faction is closed an invite is required. // If the faction is closed an invite is required.
// Null means default for the universe.
private Boolean open = null; private Boolean open = null;
// This is the ids of the invited players. // This is the ids of the invited players.
// They are actually "senderIds" since you can invite "@console" to your faction. // They are actually "senderIds" since you can invite "@console" to your faction.
// Null means no one is invited
@SerializedName("invites") @SerializedName("invites")
private Set<String> invitedPlayerIds = null; private Set<String> invitedPlayerIds = null;
// The keys in this map are factionIds. // The keys in this map are factionIds.
// Null means no special relation whishes.
private Map<String, Rel> relationWish = null; private Map<String, Rel> relationWish = null;
// The flag overrides are modifications to the default values. // The flag overrides are modifications to the default values.
// Null means default for the universe.
private Map<FFlag, Boolean> flagOverrides = null; private Map<FFlag, Boolean> flagOverrides = null;
// The perm overrides are modifications to the default values. // The perm overrides are modifications to the default values.
// Null means default for the universe.
private Map<FPerm, Set<Rel>> permOverrides = null; private Map<FPerm, Set<Rel>> permOverrides = null;
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public Faction()
{
}
// -------------------------------------------- // // -------------------------------------------- //
// FIELD: id // FIELD: id
// -------------------------------------------- // // -------------------------------------------- //
@ -123,15 +123,6 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
return ! this.isNone(); 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 // FIELD: tag
// -------------------------------------------- // // -------------------------------------------- //

View File

@ -115,9 +115,6 @@ public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipato
// FIELD: loginPvpDisabled // FIELD: loginPvpDisabled
//private transient boolean loginPvpDisabled; //private transient boolean loginPvpDisabled;
// FIELD: account
public String getAccountId() { return this.getId(); }
// -------------------------------------------- // // -------------------------------------------- //
// CORE UTILITIES // CORE UTILITIES
// -------------------------------------------- // // -------------------------------------------- //

View File

@ -73,10 +73,11 @@ public class LwcEngine implements Listener
public static void removeAlienProtections(PS chunkPs, Faction faction) public static void removeAlienProtections(PS chunkPs, Faction faction)
{ {
List<UPlayer> nonAliens = faction.getUPlayers();
for (Protection protection : getProtectionsInChunk(chunkPs)) for (Protection protection : getProtectionsInChunk(chunkPs))
{ {
UPlayer owner = UPlayer.get(protection.getOwner()); UPlayer owner = UPlayer.get(protection.getOwner());
if (faction.getUPlayers().contains(owner)) continue; if (nonAliens.contains(owner)) continue;
protection.remove(); protection.remove();
} }
} }