Skip to content

Commit

Permalink
Add skull null check
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Feb 10, 2019
1 parent 3682fae commit 8ed08f0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion main/src/main/java/net/citizensnpcs/Citizens.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.Callable;

import org.bstats.bukkit.Metrics;
Expand Down Expand Up @@ -79,13 +80,16 @@ public class Citizens extends JavaPlugin implements CitizensPlugin {
private final SkullMetaProvider skullMetaProvider = new SkullMetaProvider() {
@Override
public String getTexture(SkullMeta meta) {
if (NMS.getProfile(meta) == null)
return null;
return Iterables.getFirst(NMS.getProfile(meta).getProperties().get("textures"), new Property("", ""))
.getValue();
}

@Override
public void setTexture(String string, SkullMeta meta) {
NMS.setProfile(meta, new GameProfile(meta.getOwningPlayer().getUniqueId(), string));
UUID uuid = meta.getOwningPlayer() == null ? UUID.randomUUID() : meta.getOwningPlayer().getUniqueId();
NMS.setProfile(meta, new GameProfile(uuid, string));
}
};
private CitizensSpeechFactory speechFactory;
Expand Down

0 comments on commit 8ed08f0

Please sign in to comment.