Set playerhead async

This commit is contained in:
Aria 2019-09-08 02:10:24 +02:00
parent 603bbd5210
commit 63e63083f0

View File

@ -88,14 +88,14 @@ public class EditableFriendList extends EditableInventory {
ItemStack disp = super.display(inv, n);
ItemMeta meta = disp.getItemMeta();
/*
* run async to save performance
*/
if (meta instanceof SkullMeta) {
((SkullMeta) meta).setOwningPlayer(friend);
disp.setItemMeta(meta);
}
if (meta instanceof SkullMeta) {
Bukkit.getScheduler().runTaskAsynchronously(MMOCore.plugin, () -> {
((SkullMeta) meta).setOwningPlayer(friend);
disp.setItemMeta(meta);
});
}
return NBTItem.get(disp).add(new ItemTag("uuid", friend.getUniqueId().toString())).toItem();
}
}
@ -217,6 +217,13 @@ public class EditableFriendList extends EditableInventory {
return;
}
if (playerData.getUniqueId().equals(target.getUniqueId())) {
player.sendMessage(MMOCore.plugin.configManager.getSimpleMessage("yourself", "player", target.getName()));
player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1);
open();
return;
}
playerData.sendFriendRequest(PlayerData.get(target));
player.sendMessage(MMOCore.plugin.configManager.getSimpleMessage("sent-friend-request", "player", target.getName()));
player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1);