本文整理匯總了Java中org.bukkit.SkullType類的典型用法代碼示例。如果您正苦於以下問題:Java SkullType類的具體用法?Java SkullType怎麽用?Java SkullType使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
SkullType類屬於org.bukkit包,在下文中一共展示了SkullType類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: run
import org.bukkit.SkullType; //導入依賴的package包/類
@Override
public void run() {
if (loc == null) {
return;
}
Block b = loc.getBlock();
if (b.getType() != Material.SKULL) {
return;
}
Skull skull = (Skull) b.getState();
if (type == SkullType.PLAYER) {
skull.setSkullType(type);
skull.setOwner(owner);
} else {
skull.setSkullType(type);
}
skull.update();
}
示例2: getSkullType
import org.bukkit.SkullType; //導入依賴的package包/類
static SkullType getSkullType(int id) {
switch (id) {
case 0:
return SkullType.SKELETON;
case 1:
return SkullType.WITHER;
case 2:
return SkullType.ZOMBIE;
case 3:
return SkullType.PLAYER;
case 4:
return SkullType.CREEPER;
default:
throw new AssertionError(id);
}
}
示例3: setOwner
import org.bukkit.SkullType; //導入依賴的package包/類
public boolean setOwner(String name) {
if (name == null || name.length() > MAX_OWNER_LENGTH) {
return false;
}
GameProfile profile = MinecraftServer.getServer().func_152358_ax().func_152655_a (name);
if (profile == null) {
return false;
}
if (skullType != SkullType.PLAYER) {
skullType = SkullType.PLAYER;
}
this.profile = profile;
return true;
}
示例4: update
import org.bukkit.SkullType; //導入依賴的package包/類
@Override
public boolean update(boolean force, boolean applyPhysics) {
boolean result = super.update(force, applyPhysics);
if (result) {
if (skullType == SkullType.PLAYER) {
skull.func_152106_a(profile);
} else {
skull.func_152107_a(getSkullType(skullType));
}
skull.func_145903_a(rotation);
skull.markDirty();
}
return result;
}
示例5: createPlayerHead
import org.bukkit.SkullType; //導入依賴的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;
}
示例6: createSkullItemStack
import org.bukkit.SkullType; //導入依賴的package包/類
public static ItemStack createSkullItemStack(String uuid, String textureValue, String textureSignature) {
WrappedGameProfile wrappedProfile = new WrappedGameProfile(UUID.fromString(uuid), null);
wrappedProfile.getProperties().put("textures", new WrappedSignedProperty("textures", textureValue, textureSignature));
ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short) SkullType.PLAYER.ordinal());
SkullMeta sm = (SkullMeta) skull.getItemMeta();
Field profileField = null;
try {
profileField = sm.getClass().getDeclaredField("profile");
profileField.setAccessible(true);
profileField.set(sm, wrappedProfile.getHandle());
} catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e1) {
e1.printStackTrace();
}
skull.setItemMeta(sm);
return skull;
}
示例7: createMemberMenu
import org.bukkit.SkullType; //導入依賴的package包/類
public static List<Inventory> createMemberMenu(Clans clan){
Clan clanProfile = new Clan(clan);
List<Inventory> pages = new ArrayList<Inventory>();
int page = 1;
pages.add(Bukkit.createInventory(null, 54, "Page "+page));
List<ca.damocles.accountsystem.Character> clansmen = clanProfile.getClansmen();
for(ca.damocles.accountsystem.Character members : clansmen){
ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short)SkullType.PLAYER.ordinal());
SkullMeta meta = (SkullMeta) skull.getItemMeta();
meta.setOwningPlayer(Bukkit.getOfflinePlayer(members.uuid));
skull.setItemMeta(meta);
if(pages.get(pages.size()-1).firstEmpty() == -1){
page = page+1;
pages.add(Bukkit.createInventory(null, 54, "Page "+page));
pages.get(pages.size()-1).addItem(skull);
}else{
pages.get(pages.size()-1).addItem(skull);
}
members.getPlayer().updateInventory();
}
return pages;
}
示例8: setOwner
import org.bukkit.SkullType; //導入依賴的package包/類
public boolean setOwner(String name) {
if (name == null || name.length() > MAX_OWNER_LENGTH) {
return false;
}
GameProfile profile = MinecraftServer.getServer().getUserCache().getProfile(name);
if (profile == null) {
return false;
}
if (skullType != SkullType.PLAYER) {
skullType = SkullType.PLAYER;
}
this.profile = profile;
return true;
}
示例9: update
import org.bukkit.SkullType; //導入依賴的package包/類
@Override
public boolean update(boolean force, boolean applyPhysics) {
boolean result = super.update(force, applyPhysics);
if (result) {
if (skullType == SkullType.PLAYER) {
skull.setGameProfile(profile);
} else {
skull.setSkullType(getSkullType(skullType));
}
skull.setRotation(rotation);
skull.update();
}
return result;
}