mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-15 05:41:51 +08:00
Fixed NPE related to Factions #451
This commit is contained in:
parent
d5027cfc46
commit
4612ccd13f
@ -68,10 +68,14 @@ public class FactionsData extends PluginData {
|
||||
|
||||
if (mPlayer.hasFaction()) {
|
||||
Faction faction = mPlayer.getFaction();
|
||||
String leadername = faction.getLeader().getName();
|
||||
if (faction == null) {
|
||||
continue;
|
||||
}
|
||||
MPlayer leader = faction.getLeader();
|
||||
String leaderName = leader != null ? leader.getName() : "";
|
||||
String factionName = faction.isNone() ? "-" : faction.getName();
|
||||
|
||||
userFactions.put(uuid, mPlayer.getName().equals(leadername) ? "<b>" + factionName + "</b>" : factionName);
|
||||
userFactions.put(uuid, mPlayer.getName().equals(leaderName) ? "<b>" + factionName + "</b>" : factionName);
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,16 +85,15 @@ public class FactionsData extends PluginData {
|
||||
return analysisContainer;
|
||||
}
|
||||
|
||||
public final List<Faction> getTopFactions() {
|
||||
List<Faction> topFactions = new ArrayList<>();
|
||||
topFactions.addAll(FactionColl.get().getAll());
|
||||
private List<Faction> getTopFactions() {
|
||||
List<Faction> topFactions = new ArrayList<>(FactionColl.get().getAll());
|
||||
topFactions.remove(FactionColl.get().getWarzone());
|
||||
topFactions.remove(FactionColl.get().getSafezone());
|
||||
topFactions.remove(FactionColl.get().getNone());
|
||||
List<String> hide = Settings.HIDE_FACTIONS.getStringList();
|
||||
topFactions.sort(new FactionComparator());
|
||||
return topFactions.stream()
|
||||
.filter(faction -> !hide.contains(faction.getName()))
|
||||
.sorted(new FactionComparator())
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user