mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-11-05 18:31:25 +01: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()) {
|
if (mPlayer.hasFaction()) {
|
||||||
Faction faction = mPlayer.getFaction();
|
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();
|
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;
|
return analysisContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final List<Faction> getTopFactions() {
|
private List<Faction> getTopFactions() {
|
||||||
List<Faction> topFactions = new ArrayList<>();
|
List<Faction> topFactions = new ArrayList<>(FactionColl.get().getAll());
|
||||||
topFactions.addAll(FactionColl.get().getAll());
|
|
||||||
topFactions.remove(FactionColl.get().getWarzone());
|
topFactions.remove(FactionColl.get().getWarzone());
|
||||||
topFactions.remove(FactionColl.get().getSafezone());
|
topFactions.remove(FactionColl.get().getSafezone());
|
||||||
topFactions.remove(FactionColl.get().getNone());
|
topFactions.remove(FactionColl.get().getNone());
|
||||||
List<String> hide = Settings.HIDE_FACTIONS.getStringList();
|
List<String> hide = Settings.HIDE_FACTIONS.getStringList();
|
||||||
topFactions.sort(new FactionComparator());
|
|
||||||
return topFactions.stream()
|
return topFactions.stream()
|
||||||
.filter(faction -> !hide.contains(faction.getName()))
|
.filter(faction -> !hide.contains(faction.getName()))
|
||||||
|
.sorted(new FactionComparator())
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user