本文整理匯總了Java中org.bukkit.inventory.meta.SkullMeta.setOwner方法的典型用法代碼示例。如果您正苦於以下問題:Java SkullMeta.setOwner方法的具體用法?Java SkullMeta.setOwner怎麽用?Java SkullMeta.setOwner使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.inventory.meta.SkullMeta
的用法示例。
在下文中一共展示了SkullMeta.setOwner方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createHeadPlayer
import org.bukkit.inventory.meta.SkullMeta; //導入方法依賴的package包/類
public static ItemStack createHeadPlayer(String displayname, String username, List<String> lore) {
ItemStack playerHead = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
SkullMeta sm = (SkullMeta)playerHead.getItemMeta();
sm.setOwner(username);
ArrayList<String> colorLore = new ArrayList<>();
if (lore != null) {
lore.forEach(str -> colorLore.add(Utils.colorize(str)));
sm.setLore(colorLore);
}
sm.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS, ItemFlag.HIDE_ATTRIBUTES,
ItemFlag.HIDE_DESTROYS, ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_PLACED_ON, ItemFlag.HIDE_UNBREAKABLE);
sm.setDisplayName(Utils.colorize(displayname));
playerHead.setItemMeta(sm);
return playerHead;
}
示例2: onPlayerDeath
import org.bukkit.inventory.meta.SkullMeta; //導入方法依賴的package包/類
/**
* Drop player head on kill
*
* @param event Event
*/
@EventHandler
public void onPlayerDeath(PlayerDeathEvent event)
{
ItemStack head = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
SkullMeta skullMeta = (SkullMeta)head.getItemMeta();
skullMeta.setOwner(event.getEntity().getName());
skullMeta.setDisplayName(ChatColor.AQUA + "Tête de " + event.getEntity().getName());
head.setItemMeta(skullMeta);
event.getDrops().add(head);
List<PotionEffect> effectList = new ArrayList<>();
effectList.addAll(event.getEntity().getActivePotionEffects());
this.effects.put(event.getEntity().getName(), effectList);
}
示例3: createPlayerHead
import org.bukkit.inventory.meta.SkullMeta; //導入方法依賴的package包/類
private ItemStack createPlayerHead(Player player)
{
AbstractPlayerData playerData = SamaGamesAPI.get().getPlayerManager().getPlayerData(player.getUniqueId());
ItemStack stack = new ItemStack(Material.SKULL_ITEM, 1, (short) SkullType.PLAYER.ordinal());
SkullMeta meta = (SkullMeta) stack.getItemMeta();
meta.setOwner(player.getName());
meta.setDisplayName(PlayerUtils.getFullyFormattedPlayerName(player));
List<String> lore = new ArrayList<>();
lore.add(ChatColor.GRAY + "Pièces : " + ChatColor.GOLD + NumberUtils.format(playerData.getCoins()));
lore.add(ChatColor.GRAY + "Perles : " + ChatColor.GREEN + NumberUtils.format(this.hub.getInteractionManager().getGraouManager().getPlayerPearls(player.getUniqueId()).size()));
lore.add(ChatColor.GRAY + "Poussière d'" + ChatColor.AQUA + "\u272F" + ChatColor.GRAY + " : " + ChatColor.AQUA + NumberUtils.format(playerData.getPowders()));
meta.setLore(lore);
stack.setItemMeta(meta);
return stack;
}
示例4: getSkullFromURL
import org.bukkit.inventory.meta.SkullMeta; //導入方法依賴的package包/類
public static ItemStack getSkullFromURL(String url, String name)
throws Exception {
ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
SkullMeta sm = (SkullMeta) skull.getItemMeta();
sm.setOwner("NacOJerk");
skull.setItemMeta(sm);
url = Base64Coder.encodeString("{textures:{SKIN:{url:\"" + url
+ "\"}}}");
GameProfile gp = new GameProfile(UUID.randomUUID(), name);
gp.getProperties().put("textures", new Property("textures", url));
Object isskull = asNMSCopy(skull);
Object nbt = getNMS("NBTTagCompound").getConstructor().newInstance();
Method serialize = getNMS("GameProfileSerializer").getMethod(
"serialize", getNMS("NBTTagCompound"), GameProfile.class);
serialize.invoke(null, nbt, gp);
Object nbtr = isskull.getClass().getMethod("getTag").invoke(isskull);
nbtr.getClass().getMethod("set", String.class, getNMS("NBTBase"))
.invoke(nbtr, "SkullOwner", nbt);
isskull.getClass().getMethod("setTag", getNMS("NBTTagCompound"))
.invoke(isskull, nbtr);
skull = asBukkitCopy(isskull);
return skull;
}
示例5: spawnTracker
import org.bukkit.inventory.meta.SkullMeta; //導入方法依賴的package包/類
private void spawnTracker() {
Player p = (Player) getTarget();
ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
SkullMeta sm = (SkullMeta) skull.getItemMeta();
sm.setOwner(playerWithTrackerHead);
skull.setItemMeta(sm);
World w = p.getWorld();
armorStand = w.spawnEntity(p.getLocation(), EntityType.ARMOR_STAND);
/*slime = w.spawnEntity(p.getLocation(), EntityType.SLIME);
((Slime) slime).setInvulnerable(true);
((Slime) slime).setAI(false);
((Slime) slime).setSize(2);
slime.setPassenger(armorStand);*/
p.setPassenger(armorStand);
((ArmorStand) armorStand).setHelmet(skull);
((ArmorStand) armorStand).setVisible(false);
((ArmorStand) armorStand).setSmall(true);
((ArmorStand) armorStand).setBodyPose(new EulerAngle(0.0, 3.57, 0.0));
}
示例6: setInventory
import org.bukkit.inventory.meta.SkullMeta; //導入方法依賴的package包/類
public static void setInventory(Player p){
p.getInventory().clear();
ItemStack skull = ItemUtils.createItemstack(Material.SKULL_ITEM, 1, (byte)3, "&aJouw Profiel &3(Rechter Klik)", "&7&oTODO"); //TODO: MAKE LORE
SkullMeta skullMeta = (SkullMeta) skull.getItemMeta();
skullMeta.setOwner(p.getName());
skull.setItemMeta(skullMeta);
ItemUtils.createInventoryDisplay(p, skull, 1);
ItemUtils.createInventoryDisplay(p, Material.MINECART, 1, (byte)0, "&aAttracties &3(Rechter Klik)", "&7&oTODO", 2); //TODO: MAKE LORE
if(p.hasPermission("pretparkcore.controlrides")) {
ItemUtils.createInventoryDisplay(p, Material.COMMAND_MINECART, 1, (byte) 0, "&aAttractie Besturing &3(Rechter Klik)", "&7&oTODO", 3); //TODO: MAKE LORE
}
ItemUtils.createInventoryDisplay(p, Material.CHEST, 1, (byte) 0, "&aSwag Menu &3(Rechter Klik)", "&7Upgrade je swag naar &lOVER 9000!", 9); //TODO: MAKE LORE
p.getInventory().setHelmet(new ItemStack(Vars.helmet.get(p.getName())));
p.getInventory().setChestplate(new ItemStack(Vars.chest.get(p.getName())));
p.getInventory().setLeggings(new ItemStack(Vars.legs.get(p.getName())));
p.getInventory().setBoots(new ItemStack(Vars.boots.get(p.getName())));
}
示例7: getSkull
import org.bukkit.inventory.meta.SkullMeta; //導入方法依賴的package包/類
/**
* Gets the skull for this player UUID
* @param playerUUID
* @return Player skull item
*/
private ItemStack getSkull(UUID playerUUID) {
String playerName = plugin.getPlayers().getName(playerUUID);
if (DEBUG)
plugin.getLogger().info("DEBUG: name of warp = " + playerName);
ItemStack playerSkull = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
if (playerName == null) {
if (DEBUG)
plugin.getLogger().warning("Warp for Player: UUID " + playerUUID.toString() + " is unknown on this server, skipping...");
return null;
//playerName = playerUUID.toString().substring(0, 10);
}
SkullMeta meta = (SkullMeta) playerSkull.getItemMeta();
meta.setOwner(playerName);
meta.setDisplayName(ChatColor.WHITE + playerName);
playerSkull.setItemMeta(meta);
return playerSkull;
}
示例8: commandUse
import org.bukkit.inventory.meta.SkullMeta; //導入方法依賴的package包/類
public boolean commandUse(CommandSender sender, String[] args) {
Variables var = Necessities.getVar();
if (args.length == 0) {
sender.sendMessage(var.getEr() + "Error: " + var.getErMsg() + "You must enter a player to get their head.");
return true;
}
if (sender instanceof Player) {
Player p = (Player) sender;
ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
SkullMeta meta = (SkullMeta) skull.getItemMeta();
meta.setOwner(args[0]);
skull.setItemMeta(meta);
p.getInventory().addItem(skull);
p.sendMessage(var.getMessages() + "You have been given 1 head of " + var.getObj() + args[0]);
} else
sender.sendMessage(var.getEr() + "Error: " + var.getErMsg() + "You do not have an inventory.");
return true;
}
示例9: voteNo
import org.bukkit.inventory.meta.SkullMeta; //導入方法依賴的package包/類
public void voteNo(Player player) {
removePlayer(player);
ItemStack head = new ItemStack(Material.SKULL_ITEM);
head.setDurability((short)3);
SkullMeta skull = (SkullMeta) head.getItemMeta();
skull.setOwner(player.getName());
head.setItemMeta(skull);
ItemMeta im = head.getItemMeta();
im.setDisplayName(ChatColor.DARK_RED + player.getName());
ArrayList<String> lore = new ArrayList<String>();
lore.add("Voting NO");
im.setLore(lore);
head.setItemMeta(im);
getChest().setItem(getNextNoSlot(), head);
player.openInventory(getChest());
}
示例10: voteYes
import org.bukkit.inventory.meta.SkullMeta; //導入方法依賴的package包/類
public void voteYes(Player player) {
removePlayer(player);
ItemStack head = new ItemStack(Material.SKULL_ITEM);
head.setDurability((short)3);
SkullMeta skull = (SkullMeta) head.getItemMeta();
skull.setOwner(player.getName());
head.setItemMeta(skull);
ItemMeta im = head.getItemMeta();
im.setDisplayName(ChatColor.GREEN + player.getName());
ArrayList<String> lore = new ArrayList<String>();
lore.add("Voting YES");
im.setLore(lore);
head.setItemMeta(im);
getChest().setItem(getNextYesSlot(), head);
player.openInventory(getChest());
}
示例11: handlePlayer
import org.bukkit.inventory.meta.SkullMeta; //導入方法依賴的package包/類
public boolean handlePlayer(BytecraftPlayer player, String[] args)
{
if(!player.getRank().canSpawnHeads()){
player.sendMessage(getInvalidPermsMessage());
return true;
}
if (args.length == 1) {
ItemStack item = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3);
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
itemMeta.setOwner(args[0]);
itemMeta.setDisplayName(ChatColor.YELLOW + args[0] + "'s head");
item.setItemMeta(itemMeta);
PlayerInventory inventory = player.getInventory();
inventory.addItem(item);
player.sendMessage(ChatColor.YELLOW + "You received the head of "
+ args[0]);
}
else {
player.sendMessage(ChatColor.RED + "Type /head <player>");
}
return true;
}
示例12: handlePlayer
import org.bukkit.inventory.meta.SkullMeta; //導入方法依賴的package包/類
@Override
public boolean handlePlayer(TregminePlayer player, String args[])
{
if (player.getRank().canGetPlayerHead()){
if (args.length == 1) {
ItemStack item = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3);
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
itemMeta.setOwner(args[0]);
itemMeta.setDisplayName(ChatColor.YELLOW + args[0] + "'s head");
item.setItemMeta(itemMeta);
PlayerInventory inventory = player.getInventory();
inventory.addItem(item);
player.sendMessage(ChatColor.YELLOW + "You received the head of " + args[0]);
} else {
player.sendMessage(ChatColor.RED + "Type /head <player>");
}
} else {
player.sendMessage(ChatColor.RED + "Only admins can use this command!");
}
return true;
}
示例13: turnSkelToNpc
import org.bukkit.inventory.meta.SkullMeta; //導入方法依賴的package包/類
private void turnSkelToNpc(Skeleton skel, String player) {
ItemStack head = new ItemStack(Material.SKULL_ITEM);
head.setDurability((short)3);
SkullMeta meta = (SkullMeta) head.getItemMeta();
meta.setOwner(player);
head.setItemMeta(meta);
head.setAmount(1);
skel.getEquipment().setHelmet(head);
skel.getEquipment().setHelmetDropChance(0);
ItemStack chestplate = new ItemStack(Material.IRON_CHESTPLATE);
chestplate.setAmount(1);
skel.getEquipment().setChestplate(chestplate);
skel.getEquipment().setChestplateDropChance(0);
ItemStack leggings = new ItemStack(Material.IRON_LEGGINGS);
leggings.setAmount(1);
skel.getEquipment().setLeggings(leggings);
skel.getEquipment().setLeggingsDropChance(0);
ItemStack shoes = new ItemStack(Material.IRON_BOOTS);
skel.getEquipment().setBoots(shoes);
skel.getEquipment().setBootsDropChance(0);
skel.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, Integer.MAX_VALUE, 30));
skel.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, Integer.MAX_VALUE, 30));
skel.setCustomName(player);
skel.setCustomNameVisible(true);
}
示例14: signRightClickhead
import org.bukkit.inventory.meta.SkullMeta; //導入方法依賴的package包/類
@EventHandler
public void signRightClickhead(PlayerInteractEvent s) {
if(s.getAction() == Action.RIGHT_CLICK_BLOCK) {
if(s.getClickedBlock().getState().getType() == Material.SIGN || s.getClickedBlock().getState().getType() == Material.SIGN_POST || s.getClickedBlock().getState().getType() == Material.WALL_SIGN) {
//log.info("This is a sign...");
Sign sign = (Sign) s.getClickedBlock().getState();
if(sign.getLine(0).contains("[GetYourHead]")) {
//log.info("Launching dispatch command....");
ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short)3);
SkullMeta skullmeta = (SkullMeta)skull.getItemMeta();
skullmeta.setOwner(s.getPlayer().getName());
skull.setItemMeta(skullmeta);
skull.setAmount(1);
if(s.getPlayer().getItemInHand().getType() == Material.AIR) {
s.getPlayer().getInventory().setItemInHand(skull);
sendMessage(s.getPlayer(), ChatColor.GOLD + "[GetYourHead] " + ChatColor.GREEN + "your head has been added in your hand!");
} else {
sendMessage(s.getPlayer(), ChatColor.GOLD + "[GetYourHead] " + ChatColor.RED + "your hands need to be empty!");
}
s.setCancelled(true);
}
}
}
}
示例15: onDeath
import org.bukkit.inventory.meta.SkullMeta; //導入方法依賴的package包/類
@Override
public void onDeath(ZvPPlayer player, PlayerDeathEvent event) {
super.onDeath(player, event);
this.playerDrops.put(player, new ArrayList<ItemStack>(event.getDrops()));
event.getDrops().clear();
Entity entitiy = getArena().getWorld().spawnEntity(player.getLocation(), EntityType.ZOMBIE);
if (entitiy != null) {
getArena().getDifficultyTool().customizeEntity(entitiy);
}
ItemStack playerSkull = new ItemStack(Material.SKULL_ITEM);
playerSkull.setDurability((short) 3);
SkullMeta meta = (SkullMeta) playerSkull.getItemMeta();
meta.setOwner(player.getName());
playerSkull.setItemMeta(meta);
Zombie z = (Zombie) entitiy;
z.setBaby(false);
z.getEquipment().setHelmet(playerSkull);
z.setMaxHealth(2 * 20);
getArena().updatePlayerBoards();
}