Show player skins in friend gui

This commit is contained in:
Shaun Bennett 2015-02-06 23:40:06 -05:00
parent ed8638ae9f
commit b85494a037
2 changed files with 14 additions and 0 deletions

View File

@ -119,6 +119,7 @@ public class FriendsGUI implements Listener
ItemBuilder builder = new ItemBuilder(Material.SKULL_ITEM, 1, (short) (friend.Online ? 3 : 0));
builder.setTitle(C.cWhite + C.Bold + friend.Name);
builder.setPlayerHead(friend.Name);
builder.addLore(C.cGray + C.Bold + "Status: " + (friend.Online ? C.cDGreen + "Online" : C.cRed + "Offline"));
@ -252,6 +253,7 @@ public class FriendsGUI implements Listener
ItemBuilder builder = new ItemBuilder(Material.SKULL_ITEM, 1, (short) (friend.Online ? 3 : 0));
builder.setTitle(C.cWhite + C.Bold + friend.Name);
builder.setPlayerHead(friend.Name);
builder.addLore(C.cGray + C.Bold + "Status: " + (friend.Online ? C.cDGreen + "Online" : C.cRed + "Offline"));

View File

@ -14,6 +14,7 @@ import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import org.bukkit.inventory.meta.SkullMeta;
import org.bukkit.potion.Potion;
public class ItemBuilder
@ -48,6 +49,7 @@ public class ItemBuilder
// private Potion potion;
private String _title = null;
private boolean _unbreakable;
private String _playerHeadName = null;
public ItemBuilder(ItemStack item)
{
@ -172,6 +174,10 @@ public class ItemBuilder
{
((LeatherArmorMeta) meta).setColor(this._color);
}
else if (meta instanceof SkullMeta && _playerHeadName != null)
{
((SkullMeta) meta).setOwner(_playerHeadName);
}
meta.spigot().setUnbreakable(isUnbreakable());
item.setItemMeta(meta);
}
@ -357,4 +363,10 @@ public class ItemBuilder
this._unbreakable = setUnbreakable;return this;
}
public ItemBuilder setPlayerHead(String playerName)
{
_playerHeadName = playerName;
return this;
}
}