Rename Factions --> FactionColl

This commit is contained in:
Olof Larsson 2013-04-09 12:58:39 +02:00
parent ff4b85fcf4
commit 8a4b26cbd9
18 changed files with 48 additions and 48 deletions

View File

@ -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<Entry<FLocation, TerritoryAccess>> iter = flocationIds.entrySet().iterator();
while (iter.hasNext()) {
Entry<FLocation, TerritoryAccess> 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());

View File

@ -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)

View File

@ -40,7 +40,7 @@ public class FPlayers extends PlayerEntityCollection<FPlayer>
{
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);

View File

@ -289,7 +289,7 @@ public class Faction extends Entity implements EconomyParticipator
{
ret.put(rel, new ArrayList<String>());
}
for (Faction faction : Factions.i.get())
for (Faction faction : FactionColl.i.get())
{
Rel relation = faction.getRelationTo(this);
if (onlyNonNeutral && relation == Rel.NEUTRAL) continue;

View File

@ -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<Faction>
public class FactionColl extends EntityCollection<Faction>
{
public static Factions i = new Factions();
public static FactionColl i = new FactionColl();
P p = P.p;
private Factions()
private FactionColl()
{
super
(

View File

@ -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<String> getFactionTags()
{
Set<String> tags = new HashSet<String>();
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<String> getPlayersInFaction(String factionTag)
{
Set<String> players = new HashSet<String>();
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<String> getOnlinePlayersInFaction(String factionTag)
{
Set<String> players = new HashSet<String>();
Faction faction = Factions.i.getByTag(factionTag);
Faction faction = FactionColl.i.getByTag(factionTag);
if (faction != null)
{
for (FPlayer fplayer : faction.getFPlayersWhereOnline(true))

View File

@ -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("<b>That tag is already in use.");
return;
}
ArrayList<String> tagValidationErrors = Factions.validateTag(tag);
ArrayList<String> 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)

View File

@ -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<Faction> factionList = new ArrayList<Faction>(Factions.i.get());
ArrayList<Faction> factionList = new ArrayList<Faction>(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("<i>Factionless<i> %d online", Factions.i.getNone().getFPlayersWhereOnline(true).size()));
lines.add(p.txt.parse("<i>Factionless<i> %d online", FactionColl.i.getNone().getFPlayersWhereOnline(true).size()));
continue;
}
lines.add(p.txt.parse("%s<i> %d/%d online, %d/%d/%d",

View File

@ -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<i> changed the faction to <h>%s<i>.", fme.describeTo(myFaction, true), open);
for (Faction faction : Factions.i.get())
for (Faction faction : FactionColl.i.get())
{
if (faction == myFaction)
{

View File

@ -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

View File

@ -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("<i>Factions saved to disk!");

View File

@ -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("<b>That tag is already taken");
return;
}
ArrayList<String> errors = new ArrayList<String>();
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<i> 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)
{

View File

@ -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<P>
// 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

View File

@ -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()

View File

@ -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()

View File

@ -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)
{

View File

@ -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<TerritoryAccess>, 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<TerritoryAccess>, JsonS
{
if (list.length() > 0)
list.append(", ");
list.append(Factions.i.get(factionID).getTag());
list.append(FactionColl.i.get(factionID).getTag());
}
return list.toString();
}

View File

@ -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);