use of org.bukkit.inventory.meta.SkullMeta in project EliteMobs by MagmaGuy.
the class LootGUI method lootNavigationConstructor.
private void lootNavigationConstructor(Inventory inventory) {
ItemStack arrowLeft = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
SkullMeta arrowLeftSkullMeta = (SkullMeta) arrowLeft.getItemMeta();
arrowLeftSkullMeta.setOwner("MHF_ArrowLeft");
arrowLeftSkullMeta.setDisplayName("Previous Loot Page");
arrowLeft.setItemMeta(arrowLeftSkullMeta);
inventory.setItem(27, arrowLeft);
ItemStack arrowRight = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
SkullMeta arrowRightSkullMeta = (SkullMeta) arrowRight.getItemMeta();
arrowRightSkullMeta.setOwner("MHF_ArrowRight");
arrowRightSkullMeta.setDisplayName("Next Loot Page");
arrowRight.setItemMeta(arrowRightSkullMeta);
inventory.setItem(35, arrowRight);
}
use of org.bukkit.inventory.meta.SkullMeta in project acidisland by tastybento.
the class TopTen method getSkull.
static ItemStack getSkull(int rank, Long long1, UUID player) {
if (DEBUG)
plugin.getLogger().info("DEBUG: Getting the skull");
String playerName = plugin.getPlayers().getName(player);
if (DEBUG) {
plugin.getLogger().info("DEBUG: playername = " + playerName);
plugin.getLogger().info("DEBUG: second chance = " + plugin.getPlayers().getName(player));
}
ItemStack playerSkull = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
if (playerName == null)
return null;
SkullMeta meta = (SkullMeta) playerSkull.getItemMeta();
if (topTenHeads.containsKey(player)) {
playerSkull = topTenHeads.get(player);
meta = (SkullMeta) playerSkull.getItemMeta();
}
meta.setDisplayName((plugin.myLocale(player).topTenGuiHeading.replace("[name]", plugin.getGrid().getIslandName(player))).replace("[rank]", String.valueOf(rank)));
// meta.setDisplayName(ChatColor.YELLOW + "" + ChatColor.BOLD + "<!> " + ChatColor.YELLOW + "Island: " + ChatColor.GOLD + ChatColor.UNDERLINE + plugin.getGrid().getIslandName(player) + ChatColor.GRAY + " (#" + rank + ")");
List<String> lore = new ArrayList<String>();
lore.add(ChatColor.YELLOW + plugin.myLocale(player).levelislandLevel + " " + long1);
if (plugin.getPlayers().inTeam(player)) {
final List<UUID> pMembers = plugin.getPlayers().getMembers(player);
// Need to make this a vertical list, because some teams are very large and it'll go off the screen otherwise
List<String> memberList = new ArrayList<>();
for (UUID members : pMembers) {
memberList.add(ChatColor.AQUA + plugin.getPlayers().getName(members));
}
lore.addAll(memberList);
}
meta.setLore(lore);
playerSkull.setItemMeta(meta);
return playerSkull;
}
use of org.bukkit.inventory.meta.SkullMeta in project MagicPlugin by elBukkit.
the class MagicController method getSkull.
@Override
@Nonnull
public ItemStack getSkull(Entity entity, String itemName) {
byte data = 3;
String ownerName = null;
switch(entity.getType()) {
case CREEPER:
data = 4;
break;
case ZOMBIE:
data = 2;
break;
case SKELETON:
Skeleton skeleton = (Skeleton) entity;
data = (byte) (skeleton.getSkeletonType() == Skeleton.SkeletonType.NORMAL ? 0 : 1);
break;
case PLAYER:
ownerName = entity.getName();
break;
default:
ownerName = getMobSkin(entity.getType());
}
ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short) 0, data);
ItemMeta meta = skull.getItemMeta();
if (itemName != null) {
meta.setDisplayName(itemName);
}
if (meta instanceof SkullMeta && ownerName != null) {
SkullMeta skullData = (SkullMeta) meta;
skullData.setOwner(ownerName);
}
skull.setItemMeta(meta);
return skull;
}
use of org.bukkit.inventory.meta.SkullMeta in project MagicPlugin by elBukkit.
the class PlayerSelectAction method start.
@Override
public SpellResult start(CastContext context) {
Mage mage = context.getMage();
MageController controller = context.getController();
Player player = mage.getPlayer();
if (player == null) {
return SpellResult.PLAYER_REQUIRED;
}
List<Player> allPlayers = null;
players.clear();
if (allowCrossWorld) {
allPlayers = new ArrayList<>(controller.getPlugin().getServer().getOnlinePlayers());
} else {
allPlayers = context.getLocation().getWorld().getPlayers();
}
Collections.sort(allPlayers, new Comparator<Player>() {
@Override
public int compare(Player p1, Player p2) {
return p1.getDisplayName().compareTo(p2.getDisplayName());
}
});
int index = 0;
for (Player targetPlayer : allPlayers) {
if (!context.getTargetsCaster() && targetPlayer == player)
continue;
if (targetPlayer.hasPotionEffect(PotionEffectType.INVISIBILITY))
continue;
if (!context.canTarget(targetPlayer))
continue;
players.put(index++, new WeakReference<>(targetPlayer));
}
if (players.size() == 0)
return SpellResult.NO_TARGET;
String inventoryTitle = context.getMessage("title", "Select Player");
int invSize = ((players.size() + 9) / 9) * 9;
Inventory displayInventory = CompatibilityUtils.createInventory(null, invSize, inventoryTitle);
for (Map.Entry<Integer, WeakReference<Player>> entry : players.entrySet()) {
Player targetPlayer = entry.getValue().get();
if (targetPlayer == null)
continue;
String name = targetPlayer.getName();
String displayName = targetPlayer.getDisplayName();
@SuppressWarnings("deprecation") ItemStack playerItem = new ItemStack(Material.SKULL_ITEM, 1, (short) 0, (byte) 3);
ItemMeta meta = playerItem.getItemMeta();
meta.setDisplayName(displayName);
if (meta instanceof SkullMeta) {
SkullMeta skullData = (SkullMeta) meta;
skullData.setOwner(name);
}
if (!name.equals(displayName)) {
List<String> lore = new ArrayList<>();
lore.add(name);
meta.setLore(lore);
}
playerItem.setItemMeta(meta);
displayInventory.setItem(entry.getKey(), playerItem);
}
active = true;
mage.activateGUI(this, displayInventory);
return SpellResult.NO_ACTION;
}
use of org.bukkit.inventory.meta.SkullMeta in project MagicPlugin by elBukkit.
the class ShrinkBlockAction method dropHead.
@SuppressWarnings("deprecation")
protected void dropHead(Location location, String ownerName, String itemName, byte data) {
ItemStack shrunkenHead = new ItemStack(Material.SKULL_ITEM, 1, (short) 0, data);
ItemMeta meta = shrunkenHead.getItemMeta();
if (itemName != null) {
meta.setDisplayName(itemName);
}
if (meta instanceof SkullMeta && ownerName != null) {
SkullMeta skullData = (SkullMeta) meta;
skullData.setOwner(ownerName);
}
shrunkenHead.setItemMeta(meta);
location.getWorld().dropItemNaturally(location, shrunkenHead);
}
Aggregations