本文整理汇总了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;
}