mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-22 18:45:29 +01:00
Remove possible NPE from trait plotting
This commit is contained in:
parent
8054667482
commit
dd53b5eefa
@ -101,7 +101,7 @@ public class CitizensTraitFactory implements TraitFactory {
|
||||
|
||||
public void addPlotters(Graph graph) {
|
||||
for (Map.Entry<String, TraitInfo> entry : registered.entrySet()) {
|
||||
if (INTERNAL_TRAITS.contains(entry.getKey()))
|
||||
if (INTERNAL_TRAITS.contains(entry.getKey()) || entry.getKey() == null)
|
||||
continue;
|
||||
final Class<? extends Trait> traitClass = entry.getValue().getTraitClass();
|
||||
graph.addPlotter(new Metrics.Plotter(entry.getKey()) {
|
||||
@ -109,9 +109,10 @@ public class CitizensTraitFactory implements TraitFactory {
|
||||
public int getValue() {
|
||||
int numberUsingTrait = 0;
|
||||
for (NPC npc : CitizensAPI.getNPCRegistry()) {
|
||||
if (npc.hasTrait(traitClass))
|
||||
if (npc.hasTrait(traitClass)) {
|
||||
++numberUsingTrait;
|
||||
}
|
||||
}
|
||||
return numberUsingTrait;
|
||||
}
|
||||
});
|
||||
|
@ -89,6 +89,9 @@ public class Skin {
|
||||
setNPCTexture(entity, localData);
|
||||
|
||||
// check if NPC prefers to use cached skin over the latest skin.
|
||||
if (entity.getNPC().data().has("player-skin-use-latest")) {
|
||||
entity.getNPC().data().remove("player-skin-use-latest");
|
||||
}
|
||||
if (!entity.getNPC().data().get(NPC.PLAYER_SKIN_USE_LATEST, Setting.NPC_SKIN_USE_LATEST.asBoolean())) {
|
||||
// cache preferred
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user