Starting to rename fplayer --> uplayer since we will need an mplayer.
This commit is contained in:
@ -350,9 +350,9 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
||||
return this.getInvitedPlayerIds().contains(playerId);
|
||||
}
|
||||
|
||||
public boolean isInvited(FPlayer fplayer)
|
||||
public boolean isInvited(UPlayer uplayer)
|
||||
{
|
||||
return this.isInvited(fplayer.getId());
|
||||
return this.isInvited(uplayer.getId());
|
||||
}
|
||||
|
||||
public boolean setInvited(String playerId, boolean invited)
|
||||
@ -372,9 +372,9 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
||||
|
||||
}
|
||||
|
||||
public void setInvited(FPlayer fplayer, boolean invited)
|
||||
public void setInvited(UPlayer uplayer, boolean invited)
|
||||
{
|
||||
this.setInvited(fplayer.getId(), invited);
|
||||
this.setInvited(uplayer.getId(), invited);
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
@ -673,9 +673,9 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
||||
}
|
||||
|
||||
double ret = 0;
|
||||
for (FPlayer fplayer : this.getFPlayers())
|
||||
for (UPlayer uplayer : this.getUPlayers())
|
||||
{
|
||||
ret += fplayer.getPower();
|
||||
ret += uplayer.getPower();
|
||||
}
|
||||
|
||||
if (UConf.get(this).powerFactionMax > 0 && ret > UConf.get(this).powerFactionMax)
|
||||
@ -694,9 +694,9 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
||||
}
|
||||
|
||||
double ret = 0;
|
||||
for (FPlayer fplayer : this.getFPlayers())
|
||||
for (UPlayer uplayer : this.getUPlayers())
|
||||
{
|
||||
ret += fplayer.getPowerMax();
|
||||
ret += uplayer.getPowerMax();
|
||||
}
|
||||
|
||||
if (UConf.get(this).powerFactionMax > 0 && ret > UConf.get(this).powerFactionMax)
|
||||
@ -732,41 +732,37 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// FOREIGN KEYS: FPLAYERS
|
||||
// FOREIGN KEY: UPLAYER
|
||||
// -------------------------------------------- //
|
||||
|
||||
// TODO: With this approach null must be used as default always.
|
||||
// TODO: Take a moment and reflect upon the consequenses eeeeeeh...
|
||||
// TODO: This one may be to slow after all :/ Thus I must maintain an index.
|
||||
|
||||
protected transient List<FPlayer> fplayers = null;
|
||||
public void reindexFPlayers()
|
||||
protected transient List<UPlayer> uplayers = null;
|
||||
public void reindexUPlayers()
|
||||
{
|
||||
this.fplayers = new ArrayList<FPlayer>();
|
||||
this.uplayers = new ArrayList<UPlayer>();
|
||||
|
||||
String factionId = this.getId();
|
||||
if (factionId == null) return;
|
||||
|
||||
for (FPlayer fplayer : FPlayerColls.get().get(this).getAll())
|
||||
for (UPlayer uplayer : UPlayerColls.get().get(this).getAll())
|
||||
{
|
||||
if (!MUtil.equals(factionId, fplayer.getFactionId())) continue;
|
||||
this.fplayers.add(fplayer);
|
||||
if (!MUtil.equals(factionId, uplayer.getFactionId())) continue;
|
||||
this.uplayers.add(uplayer);
|
||||
}
|
||||
}
|
||||
|
||||
public List<FPlayer> getFPlayers()
|
||||
public List<UPlayer> getUPlayers()
|
||||
{
|
||||
return new ArrayList<FPlayer>(this.fplayers);
|
||||
return new ArrayList<UPlayer>(this.uplayers);
|
||||
}
|
||||
|
||||
public List<FPlayer> getFPlayersWhereOnline(boolean online)
|
||||
public List<UPlayer> getUPlayersWhereOnline(boolean online)
|
||||
{
|
||||
List<FPlayer> ret = this.getFPlayers();
|
||||
Iterator<FPlayer> iter = ret.iterator();
|
||||
List<UPlayer> ret = this.getUPlayers();
|
||||
Iterator<UPlayer> iter = ret.iterator();
|
||||
while (iter.hasNext())
|
||||
{
|
||||
FPlayer fplayer = iter.next();
|
||||
if (fplayer.isOnline() != online)
|
||||
UPlayer uplayer = iter.next();
|
||||
if (uplayer.isOnline() != online)
|
||||
{
|
||||
iter.remove();
|
||||
}
|
||||
@ -774,14 +770,14 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
||||
return ret;
|
||||
}
|
||||
|
||||
public List<FPlayer> getFPlayersWhereRole(Rel role)
|
||||
public List<UPlayer> getUPlayersWhereRole(Rel role)
|
||||
{
|
||||
List<FPlayer> ret = this.getFPlayers();
|
||||
Iterator<FPlayer> iter = ret.iterator();
|
||||
List<UPlayer> ret = this.getUPlayers();
|
||||
Iterator<UPlayer> iter = ret.iterator();
|
||||
while (iter.hasNext())
|
||||
{
|
||||
FPlayer fplayer = iter.next();
|
||||
if (fplayer.getRole() != role)
|
||||
UPlayer uplayer = iter.next();
|
||||
if (uplayer.getRole() != role)
|
||||
{
|
||||
iter.remove();
|
||||
}
|
||||
@ -789,16 +785,16 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
||||
return ret;
|
||||
}
|
||||
|
||||
public FPlayer getLeader()
|
||||
public UPlayer getLeader()
|
||||
{
|
||||
List<FPlayer> ret = this.getFPlayers();
|
||||
Iterator<FPlayer> iter = ret.iterator();
|
||||
List<UPlayer> ret = this.getUPlayers();
|
||||
Iterator<UPlayer> iter = ret.iterator();
|
||||
while (iter.hasNext())
|
||||
{
|
||||
FPlayer fplayer = iter.next();
|
||||
if (fplayer.getRole() == Rel.LEADER)
|
||||
UPlayer uplayer = iter.next();
|
||||
if (uplayer.getRole() == Rel.LEADER)
|
||||
{
|
||||
return fplayer;
|
||||
return uplayer;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@ -809,9 +805,9 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
||||
List<CommandSender> ret = new ArrayList<CommandSender>();
|
||||
for (CommandSender player : SenderUtil.getOnlineSenders())
|
||||
{
|
||||
FPlayer fplayer = FPlayer.get(player);
|
||||
if (!MUtil.equals(fplayer.getUniverse(), this.getUniverse())) continue;
|
||||
if (fplayer.getFaction() != this) continue;
|
||||
UPlayer uplayer = UPlayer.get(player);
|
||||
if (!MUtil.equals(uplayer.getUniverse(), this.getUniverse())) continue;
|
||||
if (uplayer.getFaction() != this) continue;
|
||||
ret.add(player);
|
||||
}
|
||||
return ret;
|
||||
@ -822,9 +818,9 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
||||
List<Player> ret = new ArrayList<Player>();
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
FPlayer fplayer = FPlayer.get(player);
|
||||
if (!MUtil.equals(fplayer.getUniverse(), this.getUniverse())) continue;
|
||||
if (fplayer.getFaction() != this) continue;
|
||||
UPlayer uplayer = UPlayer.get(player);
|
||||
if (!MUtil.equals(uplayer.getUniverse(), this.getUniverse())) continue;
|
||||
if (uplayer.getFaction() != this) continue;
|
||||
ret.add(player);
|
||||
}
|
||||
return ret;
|
||||
@ -836,13 +832,13 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
||||
if ( ! this.isNormal()) return;
|
||||
if (this.getFlag(FFlag.PERMANENT) && ConfServer.permanentFactionsDisableLeaderPromotion) return;
|
||||
|
||||
FPlayer oldLeader = this.getLeader();
|
||||
UPlayer oldLeader = this.getLeader();
|
||||
|
||||
// get list of officers, or list of normal members if there are no officers
|
||||
List<FPlayer> replacements = this.getFPlayersWhereRole(Rel.OFFICER);
|
||||
List<UPlayer> replacements = this.getUPlayersWhereRole(Rel.OFFICER);
|
||||
if (replacements == null || replacements.isEmpty())
|
||||
{
|
||||
replacements = this.getFPlayersWhereRole(Rel.MEMBER);
|
||||
replacements = this.getUPlayersWhereRole(Rel.MEMBER);
|
||||
}
|
||||
|
||||
if (replacements == null || replacements.isEmpty())
|
||||
@ -862,9 +858,9 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
||||
Factions.get().log("The faction "+this.getTag()+" ("+this.getId()+") has been disbanded since it has no members left.");
|
||||
}
|
||||
|
||||
for (FPlayer fplayer : FPlayerColls.get().get(this).getAllOnline())
|
||||
for (UPlayer uplayer : UPlayerColls.get().get(this).getAllOnline())
|
||||
{
|
||||
fplayer.msg("The faction %s<i> was disbanded.", this.getTag(fplayer));
|
||||
uplayer.msg("The faction %s<i> was disbanded.", this.getTag(uplayer));
|
||||
}
|
||||
|
||||
this.detach();
|
||||
|
@ -76,8 +76,8 @@ public class FactionColl extends Coll<Faction>
|
||||
// Clean the board
|
||||
BoardColls.get().getForUniverse(universe).clean();
|
||||
|
||||
// Clean the fplayers
|
||||
FPlayerColls.get().getForUniverse(universe).clean();
|
||||
// Clean the uplayers
|
||||
UPlayerColls.get().getForUniverse(universe).clean();
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -90,7 +90,7 @@ public class FactionColl extends Coll<Faction>
|
||||
{
|
||||
for (Faction faction : this.getAll())
|
||||
{
|
||||
faction.reindexFPlayers();
|
||||
faction.reindexUPlayers();
|
||||
}
|
||||
}
|
||||
|
||||
@ -193,10 +193,10 @@ public class FactionColl extends Coll<Faction>
|
||||
int landCount = faction.getLandCount();
|
||||
if (!faction.getFlag(FFlag.PEACEFUL) && landCount > 0)
|
||||
{
|
||||
List<FPlayer> players = faction.getFPlayers();
|
||||
List<UPlayer> players = faction.getUPlayers();
|
||||
int playerCount = players.size();
|
||||
double reward = ConfServer.econLandReward * landCount / playerCount;
|
||||
for (FPlayer player : players)
|
||||
for (UPlayer player : players)
|
||||
{
|
||||
Econ.modifyMoney(player, reward, "own " + landCount + " faction land divided among " + playerCount + " members");
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ public class FactionColls extends Colls<FactionColl, Faction>
|
||||
// INDEX
|
||||
// -------------------------------------------- //
|
||||
|
||||
public void reindexFPlayers()
|
||||
public void reindexUPlayers()
|
||||
{
|
||||
for (FactionColl coll : this.getColls())
|
||||
{
|
||||
|
@ -34,15 +34,15 @@ import com.massivecraft.mcore.util.TimeUnit;
|
||||
import com.massivecraft.mcore.util.Txt;
|
||||
|
||||
|
||||
public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipator
|
||||
public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipator
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// META
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static FPlayer get(Object oid)
|
||||
public static UPlayer get(Object oid)
|
||||
{
|
||||
return FPlayerColls.get().get2(oid);
|
||||
return UPlayerColls.get().get2(oid);
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
@ -50,7 +50,7 @@ public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipato
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public FPlayer load(FPlayer that)
|
||||
public UPlayer load(UPlayer that)
|
||||
{
|
||||
this.setFactionId(that.factionId);
|
||||
this.setRole(that.role);
|
||||
@ -151,7 +151,7 @@ public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipato
|
||||
// -------------------------------------------- //
|
||||
|
||||
// GSON need this noarg constructor.
|
||||
public FPlayer()
|
||||
public UPlayer()
|
||||
{
|
||||
this.resetFactionData(false);
|
||||
//this.power = ConfServer.powerStarting;
|
||||
@ -238,8 +238,8 @@ public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipato
|
||||
Faction oldFaction = FactionColls.get().get(this).get(oldFactionId);
|
||||
Faction faction = FactionColls.get().get(this).get(factionId);
|
||||
|
||||
oldFaction.fplayers.remove(this);
|
||||
faction.fplayers.add(this);
|
||||
oldFaction.uplayers.remove(this);
|
||||
faction.uplayers.add(this);
|
||||
|
||||
// Mark as changed
|
||||
this.changed();
|
||||
@ -418,7 +418,7 @@ public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipato
|
||||
if (online)
|
||||
{
|
||||
Player thisPlayer = this.getPlayer();
|
||||
online = (thisPlayer != null && !thisPlayer.isDead() && FPlayer.get(thisPlayer) == this);
|
||||
online = (thisPlayer != null && !thisPlayer.isDead() && UPlayer.get(thisPlayer) == this);
|
||||
}
|
||||
|
||||
// Cache and prepare
|
||||
@ -564,9 +564,9 @@ public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipato
|
||||
{
|
||||
return this.getColorTo(faction)+this.getNameAndTitle();
|
||||
}
|
||||
public String getNameAndTitle(FPlayer fplayer)
|
||||
public String getNameAndTitle(UPlayer uplayer)
|
||||
{
|
||||
return this.getColorTo(fplayer)+this.getNameAndTitle();
|
||||
return this.getColorTo(uplayer)+this.getNameAndTitle();
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
@ -664,7 +664,7 @@ public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipato
|
||||
|
||||
boolean permanent = myFaction.getFlag(FFlag.PERMANENT);
|
||||
|
||||
if (!permanent && this.getRole() == Rel.LEADER && myFaction.getFPlayers().size() > 1)
|
||||
if (!permanent && this.getRole() == Rel.LEADER && myFaction.getUPlayers().size() > 1)
|
||||
{
|
||||
msg("<b>You must give the leader role to someone else first.");
|
||||
return;
|
||||
@ -682,7 +682,7 @@ public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipato
|
||||
if (membershipChangeEvent.isCancelled()) return;
|
||||
|
||||
// Am I the last one in the faction?
|
||||
if (myFaction.getFPlayers().size() == 1)
|
||||
if (myFaction.getUPlayers().size() == 1)
|
||||
{
|
||||
// Transfer all money
|
||||
if (Econ.isEnabled(this))
|
||||
@ -693,9 +693,9 @@ public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipato
|
||||
|
||||
if (myFaction.isNormal())
|
||||
{
|
||||
for (FPlayer fplayer : myFaction.getFPlayersWhereOnline(true))
|
||||
for (UPlayer uplayer : myFaction.getUPlayersWhereOnline(true))
|
||||
{
|
||||
fplayer.msg("%s<i> left %s<i>.", this.describeTo(fplayer, true), myFaction.describeTo(fplayer));
|
||||
uplayer.msg("%s<i> left %s<i>.", this.describeTo(uplayer, true), myFaction.describeTo(uplayer));
|
||||
}
|
||||
|
||||
if (MConf.get().logFactionLeave)
|
||||
@ -706,12 +706,12 @@ public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipato
|
||||
|
||||
this.resetFactionData();
|
||||
|
||||
if (myFaction.isNormal() && !permanent && myFaction.getFPlayers().isEmpty())
|
||||
if (myFaction.isNormal() && !permanent && myFaction.getUPlayers().isEmpty())
|
||||
{
|
||||
// Remove this faction
|
||||
for (FPlayer fplayer : FPlayerColls.get().get(this).getAllOnline())
|
||||
for (UPlayer uplayer : UPlayerColls.get().get(this).getAllOnline())
|
||||
{
|
||||
fplayer.msg("<i>%s<i> was disbanded.", myFaction.describeTo(fplayer, true));
|
||||
uplayer.msg("<i>%s<i> was disbanded.", myFaction.describeTo(uplayer, true));
|
||||
}
|
||||
|
||||
myFaction.detach();
|
||||
@ -751,7 +751,7 @@ public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipato
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (forFaction.getFPlayers().size() < ConfServer.claimsRequireMinFactionMembers)
|
||||
else if (forFaction.getUPlayers().size() < ConfServer.claimsRequireMinFactionMembers)
|
||||
{
|
||||
error = Txt.parse("Factions must have at least <h>%s<b> members to claim land.", ConfServer.claimsRequireMinFactionMembers);
|
||||
}
|
||||
@ -837,10 +837,10 @@ public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipato
|
||||
}
|
||||
|
||||
// announce success
|
||||
Set<FPlayer> informTheseFPlayers = new HashSet<FPlayer>();
|
||||
informTheseFPlayers.add(this);
|
||||
informTheseFPlayers.addAll(forFaction.getFPlayersWhereOnline(true));
|
||||
for (FPlayer fp : informTheseFPlayers)
|
||||
Set<UPlayer> informTheseUPlayers = new HashSet<UPlayer>();
|
||||
informTheseUPlayers.add(this);
|
||||
informTheseUPlayers.addAll(forFaction.getUPlayersWhereOnline(true));
|
||||
for (UPlayer fp : informTheseUPlayers)
|
||||
{
|
||||
fp.msg("<h>%s<i> claimed land for <h>%s<i> from <h>%s<i>.", this.describeTo(fp, true), forFaction.describeTo(fp), currentFaction.describeTo(fp));
|
||||
}
|
@ -8,15 +8,15 @@ import com.massivecraft.mcore.store.MStore;
|
||||
import com.massivecraft.mcore.store.SenderColl;
|
||||
import com.massivecraft.mcore.util.TimeUnit;
|
||||
|
||||
public class FPlayerColl extends SenderColl<FPlayer>
|
||||
public class UPlayerColl extends SenderColl<UPlayer>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public FPlayerColl(String name)
|
||||
public UPlayerColl(String name)
|
||||
{
|
||||
super(name, FPlayer.class, MStore.getDb(ConfServer.dburi), Factions.get());
|
||||
super(name, UPlayer.class, MStore.getDb(ConfServer.dburi), Factions.get());
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
@ -24,7 +24,7 @@ public class FPlayerColl extends SenderColl<FPlayer>
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
protected synchronized String attach(FPlayer entity, Object oid, boolean noteChange)
|
||||
protected synchronized String attach(UPlayer entity, Object oid, boolean noteChange)
|
||||
{
|
||||
String ret = super.attach(entity, oid, noteChange);
|
||||
|
||||
@ -34,15 +34,15 @@ public class FPlayerColl extends SenderColl<FPlayer>
|
||||
|
||||
// ... update the index.
|
||||
Faction faction = entity.getFaction();
|
||||
faction.fplayers.add(entity);
|
||||
faction.uplayers.add(entity);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FPlayer detachId(Object oid)
|
||||
public UPlayer detachId(Object oid)
|
||||
{
|
||||
FPlayer ret = super.detachId(oid);
|
||||
UPlayer ret = super.detachId(oid);
|
||||
if (ret == null) return null;
|
||||
|
||||
// If inited ...
|
||||
@ -50,7 +50,7 @@ public class FPlayerColl extends SenderColl<FPlayer>
|
||||
|
||||
// ... update the index.
|
||||
Faction faction = ret.getFaction();
|
||||
faction.fplayers.remove(ret);
|
||||
faction.uplayers.remove(ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -61,12 +61,12 @@ public class FPlayerColl extends SenderColl<FPlayer>
|
||||
|
||||
public void clean()
|
||||
{
|
||||
for (FPlayer fplayer : this.getAll())
|
||||
for (UPlayer uplayer : this.getAll())
|
||||
{
|
||||
if (FactionColls.get().get(this).containsId(fplayer.getFactionId())) continue;
|
||||
if (FactionColls.get().get(this).containsId(uplayer.getFactionId())) continue;
|
||||
|
||||
Factions.get().log("Reset faction data (invalid faction) for player "+fplayer.getName());
|
||||
fplayer.resetFactionData(false);
|
||||
Factions.get().log("Reset faction data (invalid faction) for player "+uplayer.getName());
|
||||
uplayer.resetFactionData(false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,31 +77,31 @@ public class FPlayerColl extends SenderColl<FPlayer>
|
||||
long now = System.currentTimeMillis();
|
||||
double toleranceMillis = ConfServer.autoLeaveAfterDaysOfInactivity * TimeUnit.MILLIS_PER_DAY;
|
||||
|
||||
for (FPlayer fplayer : this.getAll())
|
||||
for (UPlayer uplayer : this.getAll())
|
||||
{
|
||||
Long lastPlayed = Mixin.getLastPlayed(fplayer.getId());
|
||||
Long lastPlayed = Mixin.getLastPlayed(uplayer.getId());
|
||||
if (lastPlayed == null) continue;
|
||||
|
||||
if (fplayer.isOnline()) continue;
|
||||
if (uplayer.isOnline()) continue;
|
||||
if (now - lastPlayed <= toleranceMillis) continue;
|
||||
|
||||
if (MConf.get().logFactionLeave || MConf.get().logFactionKick)
|
||||
{
|
||||
Factions.get().log("Player "+fplayer.getName()+" was auto-removed due to inactivity.");
|
||||
Factions.get().log("Player "+uplayer.getName()+" was auto-removed due to inactivity.");
|
||||
}
|
||||
|
||||
// if player is faction leader, sort out the faction since he's going away
|
||||
if (fplayer.getRole() == Rel.LEADER)
|
||||
if (uplayer.getRole() == Rel.LEADER)
|
||||
{
|
||||
Faction faction = fplayer.getFaction();
|
||||
Faction faction = uplayer.getFaction();
|
||||
if (faction != null)
|
||||
{
|
||||
fplayer.getFaction().promoteNewLeader();
|
||||
uplayer.getFaction().promoteNewLeader();
|
||||
}
|
||||
}
|
||||
|
||||
fplayer.leave(false);
|
||||
fplayer.detach();
|
||||
uplayer.leave(false);
|
||||
uplayer.detach();
|
||||
}
|
||||
}
|
||||
}
|
@ -19,23 +19,23 @@ import com.massivecraft.mcore.util.MUtil;
|
||||
import com.massivecraft.mcore.util.SenderUtil;
|
||||
import com.massivecraft.mcore.xlib.gson.reflect.TypeToken;
|
||||
|
||||
public class FPlayerColls extends Colls<FPlayerColl, FPlayer>
|
||||
public class UPlayerColls extends Colls<UPlayerColl, UPlayer>
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static FPlayerColls i = new FPlayerColls();
|
||||
public static FPlayerColls get() { return i; }
|
||||
private static UPlayerColls i = new UPlayerColls();
|
||||
public static UPlayerColls get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE: COLLS
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public FPlayerColl createColl(String collName)
|
||||
public UPlayerColl createColl(String collName)
|
||||
{
|
||||
return new FPlayerColl(collName);
|
||||
return new UPlayerColl(collName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -47,11 +47,11 @@ public class FPlayerColls extends Colls<FPlayerColl, FPlayer>
|
||||
@Override
|
||||
public String getBasename()
|
||||
{
|
||||
return Const.COLLECTION_BASENAME_PLAYER;
|
||||
return Const.COLLECTION_BASENAME_UPLAYER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FPlayerColl get(Object o)
|
||||
public UPlayerColl get(Object o)
|
||||
{
|
||||
if (o == null) return null;
|
||||
|
||||
@ -93,17 +93,17 @@ public class FPlayerColls extends Colls<FPlayerColl, FPlayer>
|
||||
if ( ! oldFile.exists()) return;
|
||||
|
||||
// Read the file content through GSON.
|
||||
Type type = new TypeToken<Map<String, FPlayer>>(){}.getType();
|
||||
Map<String, FPlayer> id2fplayer = Factions.get().gson.fromJson(DiscUtil.readCatch(oldFile), type);
|
||||
Type type = new TypeToken<Map<String, UPlayer>>(){}.getType();
|
||||
Map<String, UPlayer> id2fplayer = Factions.get().gson.fromJson(DiscUtil.readCatch(oldFile), type);
|
||||
|
||||
// The Coll
|
||||
FPlayerColl coll = this.getForUniverse(MCore.DEFAULT);
|
||||
UPlayerColl coll = this.getForUniverse(MCore.DEFAULT);
|
||||
|
||||
// Set the data
|
||||
for (Entry<String, FPlayer> entry : id2fplayer.entrySet())
|
||||
for (Entry<String, UPlayer> entry : id2fplayer.entrySet())
|
||||
{
|
||||
String playerId = entry.getKey();
|
||||
FPlayer fplayer = entry.getValue();
|
||||
UPlayer fplayer = entry.getValue();
|
||||
coll.attach(fplayer, playerId);
|
||||
}
|
||||
|
Reference in New Issue
Block a user