A few optimizations.
This commit is contained in:
parent
44dc04e3e1
commit
37565463ad
@ -164,6 +164,8 @@ public interface Faction extends EconomyParticipator {
|
|||||||
|
|
||||||
public boolean removeFPlayer(FPlayer fplayer);
|
public boolean removeFPlayer(FPlayer fplayer);
|
||||||
|
|
||||||
|
public int getSize();
|
||||||
|
|
||||||
public Set<FPlayer> getFPlayers();
|
public Set<FPlayer> getFPlayers();
|
||||||
|
|
||||||
public Set<FPlayer> getFPlayersWhereOnline(boolean online);
|
public Set<FPlayer> getFPlayersWhereOnline(boolean online);
|
||||||
|
@ -307,8 +307,8 @@ public abstract class MCommand<T extends MPlugin> {
|
|||||||
public String replaceFactionTags(String s, Faction faction) {
|
public String replaceFactionTags(String s, Faction faction) {
|
||||||
boolean raidable = faction.getLandRounded() > faction.getPower();
|
boolean raidable = faction.getLandRounded() > faction.getPower();
|
||||||
FPlayer fLeader = faction.getFPlayerAdmin();
|
FPlayer fLeader = faction.getFPlayerAdmin();
|
||||||
String online = String.valueOf(faction.getFPlayersWhereOnline(true).size());
|
String online = String.valueOf(faction.getOnlinePlayers().size());
|
||||||
String members = String.valueOf(faction.getFPlayers().size());
|
String members = String.valueOf(faction.getSize());
|
||||||
String leader = fLeader == null ? "Server" : fLeader.getName().substring(0, fLeader.getName().length() > 14 ? 13 : fLeader.getName().length());
|
String leader = fLeader == null ? "Server" : fLeader.getName().substring(0, fLeader.getName().length() > 14 ? 13 : fLeader.getName().length());
|
||||||
return s.replace("{power}", String.valueOf(faction.getPowerRounded())).replace("{maxPower}", String.valueOf(faction.getPowerMaxRounded())).replace("{leader}", leader).replace("{chunks}", String.valueOf(faction.getLandRounded())).replace("{raidable}", String.valueOf(raidable)).replace("{warps}", String.valueOf(faction.getWarps().size())).replace("{online}", online).replace("{members}", members);
|
return s.replace("{power}", String.valueOf(faction.getPowerRounded())).replace("{maxPower}", String.valueOf(faction.getPowerMaxRounded())).replace("{leader}", leader).replace("{chunks}", String.valueOf(faction.getLandRounded())).replace("{raidable}", String.valueOf(raidable)).replace("{warps}", String.valueOf(faction.getWarps().size())).replace("{online}", online).replace("{members}", members);
|
||||||
}
|
}
|
||||||
|
@ -458,6 +458,10 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getSize() {
|
||||||
|
return fplayers.size();
|
||||||
|
}
|
||||||
|
|
||||||
public Set<FPlayer> getFPlayers() {
|
public Set<FPlayer> getFPlayers() {
|
||||||
// return a shallow copy of the FPlayer list, to prevent tampering and
|
// return a shallow copy of the FPlayer list, to prevent tampering and
|
||||||
// concurrency issues
|
// concurrency issues
|
||||||
@ -466,6 +470,9 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
|
|
||||||
public Set<FPlayer> getFPlayersWhereOnline(boolean online) {
|
public Set<FPlayer> getFPlayersWhereOnline(boolean online) {
|
||||||
Set<FPlayer> ret = new HashSet<FPlayer>();
|
Set<FPlayer> ret = new HashSet<FPlayer>();
|
||||||
|
if (!this.isNormal()) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
for (FPlayer fplayer : fplayers) {
|
for (FPlayer fplayer : fplayers) {
|
||||||
if (fplayer.isOnline() == online) {
|
if (fplayer.isOnline() == online) {
|
||||||
|
Loading…
Reference in New Issue
Block a user