當前位置: 首頁>>代碼示例>>Java>>正文


Java Skull類代碼示例

本文整理匯總了Java中org.bukkit.block.Skull的典型用法代碼示例。如果您正苦於以下問題:Java Skull類的具體用法?Java Skull怎麽用?Java Skull使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Skull類屬於org.bukkit.block包,在下文中一共展示了Skull類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: run

import org.bukkit.block.Skull; //導入依賴的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();
}
 
開發者ID:jiongjionger,項目名稱:NeverLag,代碼行數:19,代碼來源:AntiDamageSkull.java

示例2: getMarkerData

import org.bukkit.block.Skull; //導入依賴的package包/類
@Nullable
private String getMarkerData(@Nonnull Skull skull) {
    if (skull.getOwningPlayer() != null) {
        String markerData = skull.getOwningPlayer().getName();
        if (markerData == null) {
            log.warning("owning player name null?!");
            markerData = skull.getOwner();
            if (markerData == null) {
                log.warning("just set it to undefined...");
                markerData = "undefined";
            }
        }
        return markerData;
    } else {
        return null;
    }
}
 
開發者ID:VoxelGamesLib,項目名稱:VoxelGamesLibv2,代碼行數:18,代碼來源:MapScanner.java

示例3: delScoreHead

import org.bukkit.block.Skull; //導入依賴的package包/類
public boolean delScoreHead(Skull head, String arenaName) {
    boolean result = true;
    Arena arena = arenas.get(arenaName);
    if (arena != null) {
        if (arena.scoreHeads != null && !arena.scoreHeads.isEmpty()) {
            Location lastLoc = arena.scoreHeads.get(arena.scoreHeads.size() - 1).getLocation();
            if (Tools.compareLocationBlocks(lastLoc, head.getLocation()) != 0) {
                result = false;
            } else {
                arena.scoreHeads.remove(arena.scoreHeads.size() - 1);
                if (arena.scoreHeads.isEmpty()) {
                    arena.scoreHeads = null;
                }
            }
        }
    }
    return result;
}
 
開發者ID:ddonofrio,項目名稱:libelula,代碼行數:19,代碼來源:ArenaManager.java

示例4: onBlockPlace

import org.bukkit.block.Skull; //導入依賴的package包/類
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onBlockPlace(BlockPlaceEvent e) {
    setupEvents setupEvent = setupPlayers.get(e.getPlayer());
    switch (setupEvent) {
        case HEADS:
            if (e.getBlock().getType() == Material.SKULL) {
                //Skull skull = new CraftSkull(e.getBlock());
                Skull skull = (Skull) e.getBlock().getState();
                plugin.am.addScoreHead(skull,
                        setupPlayersArena.get(e.getPlayer()));
                e.getPlayer().sendMessage(plugin.lm.getText("score-heads-added"));
                e.getPlayer().sendMessage(plugin.lm.getText("listen-setup-finish"));
            }
            break;
    }
}
 
開發者ID:ddonofrio,項目名稱:libelula,代碼行數:17,代碼來源:EventManager.java

示例5: onBlockBreak

import org.bukkit.block.Skull; //導入依賴的package包/類
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onBlockBreak(BlockBreakEvent e) {
    setupEvents setupEvent = setupPlayers.get(e.getPlayer());
    switch (setupEvent) {
        case HEADS:
            if (e.getBlock().getType() == Material.SKULL) {
                //Skull skull = new CraftSkull(e.getBlock());
                Skull skull = (Skull) e.getBlock().getState();
                if (plugin.am.delScoreHead(skull,
                        setupPlayersArena.get(e.getPlayer()))) {
                    e.getPlayer().sendMessage(plugin.lm.getText("score-heads-removed"));
                    e.getPlayer().sendMessage(plugin.lm.getText("listen-setup-finish"));
                } else {
                    e.getPlayer().sendMessage(plugin.lm.getText("score-heads-desordered-del"));
                    e.setCancelled(true);
                }
            }
            break;
    }
}
 
開發者ID:ddonofrio,項目名稱:libelula,代碼行數:21,代碼來源:EventManager.java

示例6: updateTexture

import org.bukkit.block.Skull; //導入依賴的package包/類
private static void updateTexture(final Location l) throws Exception {
	Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance, new Runnable() {
		
		@Override
		public void run() {
			try {
				Block b = l.getBlock();
				int charge = getCharge(b), capacity = getMaxCharge(b);
				if (b.getState() instanceof Skull) {
					if (charge < (int) (capacity * 0.25D)) CustomSkull.setSkull(b, "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTEzNjFlNTc2YjQ5M2NiZmRmYWUzMjg2NjFjZWRkMWFkZDU1ZmFiNGU1ZWI0MThiOTJjZWJmNjI3NWY4YmI0In19fQ==");
					else if (charge < (int) (capacity * 0.5D)) CustomSkull.setSkull(b, "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMzA1MzIzMzk0YTdkOTFiZmIzM2RmMDZkOTJiNjNjYjQxNGVmODBmMDU0ZDA0NzM0ZWEwMTVhMjNjNTM5In19fQ==");
					else if (charge < (int) (capacity * 0.75D)) CustomSkull.setSkull(b, "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNTU4NDQzMmFmNmYzODIxNjcxMjAyNThkMWVlZThjODdjNmU3NWQ5ZTQ3OWU3YjBkNGM3YjZhZDQ4Y2ZlZWYifX19");
					else CustomSkull.setSkull(b, "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvN2EyNTY5NDE1YzE0ZTMxYzk4ZWM5OTNhMmY5OWU2ZDY0ODQ2ZGIzNjdhMTNiMTk5OTY1YWQ5OWM0MzhjODZjIn19fQ==");
				}
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	});
}
 
開發者ID:TheBusyBiscuit,項目名稱:Slimefun4,代碼行數:21,代碼來源:ChargableBlock.java

示例7: move

import org.bukkit.block.Skull; //導入依賴的package包/類
@SuppressWarnings("deprecation")
private void move(Block b, BlockFace face, Block block) throws Exception {
	if (block.getY() < 0 || block.getY() > block.getWorld().getMaxHeight()) return;

	if (block.getType() == Material.AIR) {
		block.setType(Material.SKULL);
		block.setData((byte) 1);

		Skull skull = (Skull) block.getState();
		skull.setRotation(face);
		skull.update(true, false);
		CustomSkull.setSkull(block, CustomSkull.getTexture(getItem()));
		b.setType(Material.AIR);
		BlockStorage.moveBlockInfo(b, block);
	}
}
 
開發者ID:TheBusyBiscuit,項目名稱:Slimefun4,代碼行數:17,代碼來源:ProgrammableAndroid.java

示例8: set

import org.bukkit.block.Skull; //導入依賴的package包/類
@SuppressWarnings("deprecation")
public boolean set(Block block) {
    Skull skull = (Skull) block.getState();
    if(skullOwnerName != null){
        skull.setOwner(skullOwnerName);
    }
    skull.setSkullType(skullType);
    skull.setRotation(skullRotation);
    skull.setRawData((byte) skullStanding);
    // Texture update
    if(skullTextureValue != null){
        setSkullWithNonPlayerProfile(skullTextureValue, skullTextureSignature, skullOwnerUUID, skullOwnerName, skull);
    }
    skull.update(true, false);
    return true;
}
 
開發者ID:tastybento,項目名稱:acidisland,代碼行數:17,代碼來源:SkullBlock.java

示例9: updateTexture

import org.bukkit.block.Skull; //導入依賴的package包/類
private static void updateTexture(final Location l)
        throws Exception
    {
        Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance, new Runnable() {

            private final Location val$l;

            public void run()
            {
                try
                {
                    Block b = l.getBlock();
                    int charge = ChargableBlock.getCharge(b);
                    int capacity = ChargableBlock.getMaxCharge(b);
                    if(b.getState() instanceof Skull)
                        if(charge < (int)((double)capacity * 0.25D))
                            CustomSkull.setSkull(b, "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTEzNjFlNTc2YjQ5M2NiZmRmYWUzMjg2NjFjZWRkMWFkZDU1ZmFiNGU1ZWI0MThiOTJjZWJmNjI3NWY4YmI0In19fQ==");
                        else
                        if(charge < (int)((double)capacity * 0.5D))
                            CustomSkull.setSkull(b, "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMzA1MzIzMzk0YTdkOTFiZmIzM2RmMDZkOTJiNjNjYjQxNGVmODBmMDU0ZDA0NzM0ZWEwMTVhMjNjNTM5In19fQ==");
                        else
                        if(charge < (int)((double)capacity * 0.75D))
                            CustomSkull.setSkull(b, "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNTU4NDQzMmFmNmYzODIxNjcxMjAyNThkMWVlZThjODdjNmU3NWQ5ZTQ3OWU3YjBkNGM3YjZhZDQ4Y2ZlZWYifX19");
                        else
                            CustomSkull.setSkull(b, "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvN2EyNTY5NDE1YzE0ZTMxYzk4ZWM5OTNhMmY5OWU2ZDY0ODQ2ZGIzNjdhMTNiMTk5OTY1YWQ5OWM0MzhjODZjIn19fQ==");
                }
                catch(Exception e)
                {
                    e.printStackTrace();
                }
            }

            
            {
                l = location;
                super();
            }
        }
);
    }
 
開發者ID:StarWishsama,項目名稱:Slimefun4-Chinese-Version,代碼行數:41,代碼來源:ChargableBlock.java

示例10: setCustomSkull

import org.bukkit.block.Skull; //導入依賴的package包/類
/**
 * Set the given texture to a skull placed in the world
 *
 * @param texture Base64 texture
 */
public static void setCustomSkull(Block block, String texture)
{
    block.setType(Material.SKULL);

    Skull skullData = (Skull) block.getState();
    skullData.setSkullType(SkullType.PLAYER);

    World world = ((CraftWorld) block.getWorld()).getHandle();
    ((TileEntitySkull) world.getTileEntity(new BlockPosition(block.getX(), block.getY(), block.getZ()))).setGameProfile(ItemUtils.getHeadCustomizedGameProfile(texture));

    block.getState().update(true);
}
 
開發者ID:SamaGames,項目名稱:SamaGamesAPI,代碼行數:18,代碼來源:BlockUtils.java

示例11: checkChunk

import org.bukkit.block.Skull; //導入依賴的package包/類
private void checkChunk(ChunkPosition pos, @Nullable Chunk chunk) {
    if(repairedChunks.add(pos)) {
        if(chunk == null) {
            chunk = pos.getChunk(match.getWorld());
        }

        for(BlockState state : chunk.getTileEntities()) {
            if(state instanceof Skull) {
                if(!NMSHacks.isSkullCached((Skull) state)) {
                    Location loc = state.getLocation();
                    broadcastDeveloperWarning("Uncached skull \"" + ((Skull) state).getOwner() + "\" at " + loc.getBlockX() + ", " + loc.getBlockY() + ", " + loc.getBlockZ());
                }
            }
        }

        // Replace formerly invisible half-iron-door blocks with barriers
        for(Block ironDoor : chunk.getBlocks(Material.IRON_DOOR_BLOCK)) {
            BlockFace half = (ironDoor.getData() & 8) == 0 ? BlockFace.DOWN : BlockFace.UP;
            if(ironDoor.getRelative(half.getOppositeFace()).getType() != Material.IRON_DOOR_BLOCK) {
                ironDoor.setType(Material.BARRIER, false);
            }
        }

        // Remove all block 36 and remember the ones at y=0 so VoidFilter can check them
        for(Block block36 : chunk.getBlocks(Material.PISTON_MOVING_PIECE)) {
            if(block36.getY() == 0) {
                block36Locations.add(block36.getX(), block36.getY(), block36.getZ());
            }
            block36.setType(Material.AIR, false);
        }
    }
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:33,代碼來源:WorldProblemMatchModule.java

示例12: setSkullWithNonPlayerProfile

import org.bukkit.block.Skull; //導入依賴的package包/類
@SuppressWarnings("deprecation")
public static void setSkullWithNonPlayerProfile(String skinURL, String name, Block skullBlock) {
    if (skullBlock.getState() instanceof Skull) {
        Skull skull = (Skull) skullBlock.getState();
        try {
            setSkullProfile(skull, getNonPlayerProfile(skinURL, name));
        } catch (Exception e) {
            e.printStackTrace();
        }
        skullBlock.getWorld().refreshChunk(skullBlock.getChunk().getX(), skullBlock.getChunk().getZ());
    }
}
 
開發者ID:MinecraftMarket,項目名稱:MinecraftMarket-Plugin,代碼行數:13,代碼來源:SkullUtils.java

示例13: setSkullProfile

import org.bukkit.block.Skull; //導入依賴的package包/類
private static void setSkullProfile(Skull skull, GameProfile someGameProfile) {
    ReflectionUtils.RefClass classCraftWorld = ReflectionUtils.getRefClass("{cb}.CraftWorld");
    ReflectionUtils.RefMethod methodGetHandle = classCraftWorld.getMethod("getHandle");
    Object world = methodGetHandle.of(skull.getWorld()).call();
    ReflectionUtils.RefClass classBlockPosition = ReflectionUtils.getRefClass("{nms}.BlockPosition");
    ReflectionUtils.RefConstructor constructorBlockPosition = classBlockPosition.getConstructor(int.class, int.class, int.class);
    ReflectionUtils.RefClass classWorldServer = ReflectionUtils.getRefClass("{nms}.WorldServer");
    ReflectionUtils.RefMethod methodGetTileEntity = classWorldServer.getMethod("getTileEntity", classBlockPosition.getRealClass());
    Object tileSkull = methodGetTileEntity.of(world).call(constructorBlockPosition.create(skull.getX(), skull.getY(), skull.getZ()));
    ReflectionUtils.RefClass classTileEntitySkull = ReflectionUtils.getRefClass("{nms}.TileEntitySkull");
    ReflectionUtils.RefMethod methodSetGameProfile = classTileEntitySkull.getMethod("setGameProfile", GameProfile.class);
    methodSetGameProfile.of(tileSkull).call(someGameProfile);
}
 
開發者ID:MinecraftMarket,項目名稱:MinecraftMarket-Plugin,代碼行數:14,代碼來源:SkullUtils.java

示例14: fixSkull

import org.bukkit.block.Skull; //導入依賴的package包/類
private void fixSkull(Block block) {
	if (block != null && Material.SKULL == block.getType()) {
		Skull skull = (Skull) block.getState();
		if (skull.getSkullType() != SkullType.SKELETON) {
			final FixSkullTask task = new FixSkullTask(block.getLocation(), skull.getSkullType(), skull.getOwner());
			Bukkit.getServer().getScheduler().runTaskLater(NeverLag.getInstance(), task, 1L);
		}
	}
}
 
開發者ID:jiongjionger,項目名稱:NeverLag,代碼行數:10,代碼來源:AntiDamageSkull.java

示例15: onPlayerInteract

import org.bukkit.block.Skull; //導入依賴的package包/類
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onPlayerInteract(PlayerInteractEvent event) {
    if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
        Player player = event.getPlayer();
        BlockState state = event.getClickedBlock().getState();
        if (state instanceof Skull) {
            Skull skull = (Skull) state;
            player.sendMessage(ChatColor.YELLOW + "This is " + ChatColor.WHITE
                    + (skull.getSkullType() == SkullType.PLAYER && skull.hasOwner() ? skull.getOwner() : "a " + WordUtils.capitalizeFully(skull.getSkullType().name()) + " skull") + ChatColor.YELLOW
                    + '.');
        }
    }
}
 
開發者ID:funkemunky,項目名稱:HCFCore,代碼行數:14,代碼來源:SkullListener.java


注:本文中的org.bukkit.block.Skull類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。