From 8a4b26cbd9d5eadbc11bf730e62cda58a1d1d0e8 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Tue, 9 Apr 2013 12:58:39 +0200 Subject: [PATCH] Rename Factions --> FactionColl --- src/com/massivecraft/factions/Board.java | 4 ++-- src/com/massivecraft/factions/FPlayer.java | 6 +++--- src/com/massivecraft/factions/FPlayers.java | 2 +- src/com/massivecraft/factions/Faction.java | 2 +- .../factions/{Factions.java => FactionColl.java} | 6 +++--- src/com/massivecraft/factions/P.java | 8 ++++---- src/com/massivecraft/factions/cmd/CmdCreate.java | 8 ++++---- src/com/massivecraft/factions/cmd/CmdList.java | 10 +++++----- src/com/massivecraft/factions/cmd/CmdOpen.java | 4 ++-- src/com/massivecraft/factions/cmd/CmdReload.java | 6 +++--- src/com/massivecraft/factions/cmd/CmdSaveAll.java | 4 ++-- src/com/massivecraft/factions/cmd/CmdTag.java | 8 ++++---- src/com/massivecraft/factions/cmd/FCommand.java | 6 +++--- .../factions/event/FactionCreateEvent.java | 4 ++-- .../factions/event/FactionDisbandEvent.java | 4 ++-- src/com/massivecraft/factions/integration/Econ.java | 4 ++-- .../massivecraft/factions/struct/TerritoryAccess.java | 6 +++--- .../massivecraft/factions/util/EconLandRewardTask.java | 4 ++-- 18 files changed, 48 insertions(+), 48 deletions(-) rename src/com/massivecraft/factions/{Factions.java => FactionColl.java} (95%) diff --git a/src/com/massivecraft/factions/Board.java b/src/com/massivecraft/factions/Board.java index b9b81412..6a41f89c 100644 --- a/src/com/massivecraft/factions/Board.java +++ b/src/com/massivecraft/factions/Board.java @@ -47,7 +47,7 @@ public class Board public static Faction getFactionAt(FLocation flocation) { - return Factions.i.get(getIdAt(flocation)); + return FactionColl.i.get(getIdAt(flocation)); } public static Faction getFactionAt(Location location) { @@ -127,7 +127,7 @@ public class Board Iterator> iter = flocationIds.entrySet().iterator(); while (iter.hasNext()) { Entry entry = iter.next(); - if ( ! Factions.i.exists(entry.getValue().getHostFactionID())) + if ( ! FactionColl.i.exists(entry.getValue().getHostFactionID())) { if(Conf.onUnclaimResetLwcLocks && LWCFeatures.getEnabled()) LWCFeatures.clearAllChests(entry.getKey()); diff --git a/src/com/massivecraft/factions/FPlayer.java b/src/com/massivecraft/factions/FPlayer.java index bc06fce5..6fb3faa5 100644 --- a/src/com/massivecraft/factions/FPlayer.java +++ b/src/com/massivecraft/factions/FPlayer.java @@ -44,7 +44,7 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator // FIELD: factionId private String factionId; - public Faction getFaction() { if(this.factionId == null) {return null;} return Factions.i.get(this.factionId); } + public Faction getFaction() { if(this.factionId == null) {return null;} return FactionColl.i.get(this.factionId); } public String getFactionId() { return this.factionId; } public boolean hasFaction() { return ! factionId.equals("0"); } public void setFaction(Faction faction) @@ -118,7 +118,7 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator this.loginPvpDisabled = (Conf.noPVPDamageToOthersForXSecondsAfterLogin > 0) ? true : false; this.powerBoost = 0.0; - if ( ! Conf.newPlayerStartingFactionID.equals("0") && Factions.i.exists(Conf.newPlayerStartingFactionID)) + if ( ! Conf.newPlayerStartingFactionID.equals("0") && FactionColl.i.exists(Conf.newPlayerStartingFactionID)) { this.factionId = Conf.newPlayerStartingFactionID; } @@ -126,7 +126,7 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator public final void resetFactionData(boolean doSpoutUpdate) { - if (this.factionId != null && Factions.i.exists(this.factionId)) // Avoid infinite loop! TODO: I think that this is needed is a sign we need to refactor. + if (this.factionId != null && FactionColl.i.exists(this.factionId)) // Avoid infinite loop! TODO: I think that this is needed is a sign we need to refactor. { Faction currentFaction = this.getFaction(); if (currentFaction != null) diff --git a/src/com/massivecraft/factions/FPlayers.java b/src/com/massivecraft/factions/FPlayers.java index cb3fb0e1..b836480a 100644 --- a/src/com/massivecraft/factions/FPlayers.java +++ b/src/com/massivecraft/factions/FPlayers.java @@ -40,7 +40,7 @@ public class FPlayers extends PlayerEntityCollection { for (FPlayer fplayer : this.get()) { - if ( ! Factions.i.exists(fplayer.getFactionId())) + if ( ! FactionColl.i.exists(fplayer.getFactionId())) { p.log("Reset faction data (invalid faction) for player "+fplayer.getName()); fplayer.resetFactionData(false); diff --git a/src/com/massivecraft/factions/Faction.java b/src/com/massivecraft/factions/Faction.java index ac9714ac..a4d290c0 100644 --- a/src/com/massivecraft/factions/Faction.java +++ b/src/com/massivecraft/factions/Faction.java @@ -289,7 +289,7 @@ public class Faction extends Entity implements EconomyParticipator { ret.put(rel, new ArrayList()); } - for (Faction faction : Factions.i.get()) + for (Faction faction : FactionColl.i.get()) { Rel relation = faction.getRelationTo(this); if (onlyNonNeutral && relation == Rel.NEUTRAL) continue; diff --git a/src/com/massivecraft/factions/Factions.java b/src/com/massivecraft/factions/FactionColl.java similarity index 95% rename from src/com/massivecraft/factions/Factions.java rename to src/com/massivecraft/factions/FactionColl.java index 0bceabcb..b126ea85 100644 --- a/src/com/massivecraft/factions/Factions.java +++ b/src/com/massivecraft/factions/FactionColl.java @@ -19,13 +19,13 @@ import com.massivecraft.factions.util.MiscUtil; import com.massivecraft.factions.zcore.persist.EntityCollection; import com.massivecraft.factions.zcore.util.TextUtil; -public class Factions extends EntityCollection +public class FactionColl extends EntityCollection { - public static Factions i = new Factions(); + public static FactionColl i = new FactionColl(); P p = P.p; - private Factions() + private FactionColl() { super ( diff --git a/src/com/massivecraft/factions/P.java b/src/com/massivecraft/factions/P.java index 237e5c76..078e0670 100644 --- a/src/com/massivecraft/factions/P.java +++ b/src/com/massivecraft/factions/P.java @@ -104,7 +104,7 @@ public class P extends MPlugin // Load Conf from disk Conf.load(); FPlayers.i.loadFromDisc(); - Factions.i.loadFromDisc(); + FactionColl.i.loadFromDisc(); Board.load(); // Add Base Commands @@ -316,7 +316,7 @@ public class P extends MPlugin public Set getFactionTags() { Set tags = new HashSet(); - for (Faction faction : Factions.i.get()) + for (Faction faction : FactionColl.i.get()) { tags.add(faction.getTag()); } @@ -327,7 +327,7 @@ public class P extends MPlugin public Set getPlayersInFaction(String factionTag) { Set players = new HashSet(); - Faction faction = Factions.i.getByTag(factionTag); + Faction faction = FactionColl.i.getByTag(factionTag); if (faction != null) { for (FPlayer fplayer : faction.getFPlayers()) @@ -342,7 +342,7 @@ public class P extends MPlugin public Set getOnlinePlayersInFaction(String factionTag) { Set players = new HashSet(); - Faction faction = Factions.i.getByTag(factionTag); + Faction faction = FactionColl.i.getByTag(factionTag); if (faction != null) { for (FPlayer fplayer : faction.getFPlayersWhereOnline(true)) diff --git a/src/com/massivecraft/factions/cmd/CmdCreate.java b/src/com/massivecraft/factions/cmd/CmdCreate.java index 8be58f08..3f9d48b7 100644 --- a/src/com/massivecraft/factions/cmd/CmdCreate.java +++ b/src/com/massivecraft/factions/cmd/CmdCreate.java @@ -8,7 +8,7 @@ import com.massivecraft.factions.Conf; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.Faction; -import com.massivecraft.factions.Factions; +import com.massivecraft.factions.FactionColl; import com.massivecraft.factions.P; import com.massivecraft.factions.Perm; import com.massivecraft.factions.event.FPlayerJoinEvent; @@ -45,13 +45,13 @@ public class CmdCreate extends FCommand return; } - if (Factions.i.isTagTaken(tag)) + if (FactionColl.i.isTagTaken(tag)) { msg("That tag is already in use."); return; } - ArrayList tagValidationErrors = Factions.validateTag(tag); + ArrayList tagValidationErrors = FactionColl.validateTag(tag); if (tagValidationErrors.size() > 0) { sendMessage(tagValidationErrors); @@ -69,7 +69,7 @@ public class CmdCreate extends FCommand // then make 'em pay (if applicable) if ( ! payForCommand(Conf.econCostCreate, "to create a new faction", "for creating a new faction")) return; - Faction faction = Factions.i.create(); + Faction faction = FactionColl.i.create(); // TODO: Why would this even happen??? Auto increment clash?? if (faction == null) diff --git a/src/com/massivecraft/factions/cmd/CmdList.java b/src/com/massivecraft/factions/cmd/CmdList.java index 31bc021c..f0ecc8e2 100644 --- a/src/com/massivecraft/factions/cmd/CmdList.java +++ b/src/com/massivecraft/factions/cmd/CmdList.java @@ -6,7 +6,7 @@ import java.util.Comparator; import com.massivecraft.factions.Conf; import com.massivecraft.factions.Faction; -import com.massivecraft.factions.Factions; +import com.massivecraft.factions.FactionColl; import com.massivecraft.factions.Perm; @@ -37,9 +37,9 @@ public class CmdList extends FCommand // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay if ( ! payForCommand(Conf.econCostList, "to list the factions", "for listing the factions")) return; - ArrayList factionList = new ArrayList(Factions.i.get()); + ArrayList factionList = new ArrayList(FactionColl.i.get()); - factionList.remove(Factions.i.getNone()); + factionList.remove(FactionColl.i.getNone()); // TODO: Add flag SECRET To factions instead. //factionList.remove(Factions.i.getSafeZone()); //factionList.remove(Factions.i.getWarZone()); @@ -91,7 +91,7 @@ public class CmdList extends FCommand sendMessage(p.txt.getPage(lines, this.argAsInt(0, 1), "Faction List")); */ - factionList.add(0, Factions.i.getNone()); + factionList.add(0, FactionColl.i.getNone()); final int pageheight = 9; int pagenumber = this.argAsInt(0, 1); @@ -111,7 +111,7 @@ public class CmdList extends FCommand { if (faction.isNone()) { - lines.add(p.txt.parse("Factionless %d online", Factions.i.getNone().getFPlayersWhereOnline(true).size())); + lines.add(p.txt.parse("Factionless %d online", FactionColl.i.getNone().getFPlayersWhereOnline(true).size())); continue; } lines.add(p.txt.parse("%s %d/%d online, %d/%d/%d", diff --git a/src/com/massivecraft/factions/cmd/CmdOpen.java b/src/com/massivecraft/factions/cmd/CmdOpen.java index db05345b..54acfc24 100644 --- a/src/com/massivecraft/factions/cmd/CmdOpen.java +++ b/src/com/massivecraft/factions/cmd/CmdOpen.java @@ -2,7 +2,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Conf; import com.massivecraft.factions.Faction; -import com.massivecraft.factions.Factions; +import com.massivecraft.factions.FactionColl; import com.massivecraft.factions.Perm; public class CmdOpen extends FCommand @@ -36,7 +36,7 @@ public class CmdOpen extends FCommand // Inform myFaction.msg("%s changed the faction to %s.", fme.describeTo(myFaction, true), open); - for (Faction faction : Factions.i.get()) + for (Faction faction : FactionColl.i.get()) { if (faction == myFaction) { diff --git a/src/com/massivecraft/factions/cmd/CmdReload.java b/src/com/massivecraft/factions/cmd/CmdReload.java index 06bdcf0f..f47e275e 100644 --- a/src/com/massivecraft/factions/cmd/CmdReload.java +++ b/src/com/massivecraft/factions/cmd/CmdReload.java @@ -3,7 +3,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Board; import com.massivecraft.factions.Conf; import com.massivecraft.factions.FPlayers; -import com.massivecraft.factions.Factions; +import com.massivecraft.factions.FactionColl; import com.massivecraft.factions.P; import com.massivecraft.factions.Perm; @@ -47,7 +47,7 @@ public class CmdReload extends FCommand } else if (file.startsWith("f")) { - Factions.i.loadFromDisc(); + FactionColl.i.loadFromDisc(); fileName = "factions.json"; } else if (file.startsWith("p")) @@ -60,7 +60,7 @@ public class CmdReload extends FCommand fileName = "all"; Conf.load(); FPlayers.i.loadFromDisc(); - Factions.i.loadFromDisc(); + FactionColl.i.loadFromDisc(); Board.load(); } else diff --git a/src/com/massivecraft/factions/cmd/CmdSaveAll.java b/src/com/massivecraft/factions/cmd/CmdSaveAll.java index 31b744f6..720ef594 100644 --- a/src/com/massivecraft/factions/cmd/CmdSaveAll.java +++ b/src/com/massivecraft/factions/cmd/CmdSaveAll.java @@ -3,7 +3,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Board; import com.massivecraft.factions.Conf; import com.massivecraft.factions.FPlayers; -import com.massivecraft.factions.Factions; +import com.massivecraft.factions.FactionColl; import com.massivecraft.factions.Perm; public class CmdSaveAll extends FCommand @@ -31,7 +31,7 @@ public class CmdSaveAll extends FCommand public void perform() { FPlayers.i.saveToDisc(); - Factions.i.saveToDisc(); + FactionColl.i.saveToDisc(); Board.save(); Conf.save(); msg("Factions saved to disk!"); diff --git a/src/com/massivecraft/factions/cmd/CmdTag.java b/src/com/massivecraft/factions/cmd/CmdTag.java index 809b5933..4c915636 100644 --- a/src/com/massivecraft/factions/cmd/CmdTag.java +++ b/src/com/massivecraft/factions/cmd/CmdTag.java @@ -6,7 +6,7 @@ import org.bukkit.Bukkit; import com.massivecraft.factions.Conf; import com.massivecraft.factions.Faction; -import com.massivecraft.factions.Factions; +import com.massivecraft.factions.FactionColl; import com.massivecraft.factions.Perm; import com.massivecraft.factions.event.FactionRenameEvent; import com.massivecraft.factions.integration.SpoutFeatures; @@ -37,14 +37,14 @@ public class CmdTag extends FCommand String tag = this.argAsString(0); // TODO does not first test cover selfcase? - if (Factions.i.isTagTaken(tag) && ! MiscUtil.getComparisonString(tag).equals(myFaction.getComparisonTag())) + if (FactionColl.i.isTagTaken(tag) && ! MiscUtil.getComparisonString(tag).equals(myFaction.getComparisonTag())) { msg("That tag is already taken"); return; } ArrayList errors = new ArrayList(); - errors.addAll(Factions.validateTag(tag)); + errors.addAll(FactionColl.validateTag(tag)); if (errors.size() > 0) { sendMessage(errors); @@ -67,7 +67,7 @@ public class CmdTag extends FCommand // Inform myFaction.msg("%s changed your faction tag to %s", fme.describeTo(myFaction, true), myFaction.getTag(myFaction)); - for (Faction faction : Factions.i.get()) + for (Faction faction : FactionColl.i.get()) { if (faction == myFaction) { diff --git a/src/com/massivecraft/factions/cmd/FCommand.java b/src/com/massivecraft/factions/cmd/FCommand.java index 6b5bd54a..42fdb676 100644 --- a/src/com/massivecraft/factions/cmd/FCommand.java +++ b/src/com/massivecraft/factions/cmd/FCommand.java @@ -10,7 +10,7 @@ import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.Faction; -import com.massivecraft.factions.Factions; +import com.massivecraft.factions.FactionColl; import com.massivecraft.factions.P; import com.massivecraft.factions.struct.FFlag; import com.massivecraft.factions.struct.FPerm; @@ -230,13 +230,13 @@ public abstract class FCommand extends MCommand

// First we try an exact match if (faction == null) { - faction = Factions.i.getByTag(name); + faction = FactionColl.i.getByTag(name); } // Next we match faction tags if (faction == null) { - faction = Factions.i.getBestTagMatch(name); + faction = FactionColl.i.getBestTagMatch(name); } // Next we match player names diff --git a/src/com/massivecraft/factions/event/FactionCreateEvent.java b/src/com/massivecraft/factions/event/FactionCreateEvent.java index 5732699b..9bf8739e 100644 --- a/src/com/massivecraft/factions/event/FactionCreateEvent.java +++ b/src/com/massivecraft/factions/event/FactionCreateEvent.java @@ -7,7 +7,7 @@ import org.bukkit.event.HandlerList; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayers; -import com.massivecraft.factions.Factions; +import com.massivecraft.factions.FactionColl; public class FactionCreateEvent extends Event implements Cancellable { @@ -31,7 +31,7 @@ public class FactionCreateEvent extends Event implements Cancellable public String getFactionId() { - return Factions.i.getNextId(); + return FactionColl.i.getNextId(); } public String getFactionTag() diff --git a/src/com/massivecraft/factions/event/FactionDisbandEvent.java b/src/com/massivecraft/factions/event/FactionDisbandEvent.java index 2d742feb..de970cf3 100644 --- a/src/com/massivecraft/factions/event/FactionDisbandEvent.java +++ b/src/com/massivecraft/factions/event/FactionDisbandEvent.java @@ -8,7 +8,7 @@ import org.bukkit.event.HandlerList; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.Faction; -import com.massivecraft.factions.Factions; +import com.massivecraft.factions.FactionColl; public class FactionDisbandEvent extends Event implements Cancellable { @@ -37,7 +37,7 @@ public class FactionDisbandEvent extends Event implements Cancellable public Faction getFaction() { - return Factions.i.get(id); + return FactionColl.i.get(id); } public FPlayer getFPlayer() diff --git a/src/com/massivecraft/factions/integration/Econ.java b/src/com/massivecraft/factions/integration/Econ.java index f2e92ae4..267247a5 100644 --- a/src/com/massivecraft/factions/integration/Econ.java +++ b/src/com/massivecraft/factions/integration/Econ.java @@ -10,7 +10,7 @@ import org.bukkit.plugin.RegisteredServiceProvider; import com.massivecraft.factions.Conf; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.Faction; -import com.massivecraft.factions.Factions; +import com.massivecraft.factions.FactionColl; import com.massivecraft.factions.P; import com.massivecraft.factions.iface.EconomyParticipator; import com.massivecraft.factions.struct.FPerm; @@ -299,7 +299,7 @@ public class Econ { if ( ! shouldBeUsed()) return; - for (Faction faction : Factions.i.get()) + for (Faction faction : FactionColl.i.get()) { if (faction.money > 0) { diff --git a/src/com/massivecraft/factions/struct/TerritoryAccess.java b/src/com/massivecraft/factions/struct/TerritoryAccess.java index 3f1256bb..de18b85c 100644 --- a/src/com/massivecraft/factions/struct/TerritoryAccess.java +++ b/src/com/massivecraft/factions/struct/TerritoryAccess.java @@ -10,7 +10,7 @@ import org.bukkit.entity.Player; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.Faction; -import com.massivecraft.factions.Factions; +import com.massivecraft.factions.FactionColl; import com.massivecraft.factions.P; import org.bukkit.craftbukkit.libs.com.google.gson.JsonArray; @@ -54,7 +54,7 @@ public class TerritoryAccess implements JsonDeserializer, JsonS } public Faction getHostFaction() { - return Factions.i.get(hostFactionID); + return FactionColl.i.get(hostFactionID); } // considered "default" if host faction is still allowed and nobody has been granted access @@ -166,7 +166,7 @@ public class TerritoryAccess implements JsonDeserializer, JsonS { if (list.length() > 0) list.append(", "); - list.append(Factions.i.get(factionID).getTag()); + list.append(FactionColl.i.get(factionID).getTag()); } return list.toString(); } diff --git a/src/com/massivecraft/factions/util/EconLandRewardTask.java b/src/com/massivecraft/factions/util/EconLandRewardTask.java index 98f150b7..172c67a6 100644 --- a/src/com/massivecraft/factions/util/EconLandRewardTask.java +++ b/src/com/massivecraft/factions/util/EconLandRewardTask.java @@ -1,7 +1,7 @@ package com.massivecraft.factions.util; import com.massivecraft.factions.Conf; -import com.massivecraft.factions.Factions; +import com.massivecraft.factions.FactionColl; import com.massivecraft.factions.P; public class EconLandRewardTask implements Runnable { @@ -16,7 +16,7 @@ public class EconLandRewardTask implements Runnable { @Override public void run() { - Factions.i.econLandRewardRoutine(); + FactionColl.i.econLandRewardRoutine(); // maybe setting has been changed? if so, restart task at new rate if (this.rate != Conf.econLandRewardTaskRunsEveryXMinutes) P.p.startEconLandRewardTask(true);