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


Java Material.SKULL屬性代碼示例

本文整理匯總了Java中org.bukkit.Material.SKULL屬性的典型用法代碼示例。如果您正苦於以下問題:Java Material.SKULL屬性的具體用法?Java Material.SKULL怎麽用?Java Material.SKULL使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.bukkit.Material的用法示例。


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

示例1: run

@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,代碼行數:18,代碼來源:AntiDamageSkull.java

示例2: NoSkullCrash

@EventHandler(priority = EventPriority.LOWEST)
public void NoSkullCrash(BlockFromToEvent evt) {
    if (noSkullCrash) {
    	if(evt.isCancelled()) {
    		return;
    	}
        if (evt.getToBlock().getType() == Material.SKULL) {
            evt.setCancelled(true);
        }
    }
}
 
開發者ID:GelandiAssociation,項目名稱:EscapeLag,代碼行數:11,代碼來源:SkullCrashPatch.java

示例3: onPlayerInteractEvent

@EventHandler
public void onPlayerInteractEvent(PlayerInteractEvent event)
{
    if (event.getClickedBlock() != null)
    {
        Material material = event.getClickedBlock().getType();

        if (material == Material.SIGN || material == Material.SIGN_POST || material == Material.WALL_SIGN)
        {
            Sign sign = (Sign) event.getClickedBlock().getState();

            if (sign.hasMetadata("game") && sign.hasMetadata("map"))
            {
                AbstractGame game = this.hub.getGameManager().getGameByIdentifier(sign.getMetadata("game").get(0).asString());
                GameSign gameSign = game.getGameSignsByMap(sign.getMetadata("map").get(0).asString()).get(0);

                if (SamaGamesAPI.get().getPermissionsManager().hasPermission(event.getPlayer(), "hub.debug.sign") && event.getPlayer().isSneaking())
                {
                    gameSign.developperClick(event.getPlayer());
                    return;
                }

                gameSign.click(event.getPlayer());
            }
        }
        else if (material == Material.SKULL)
        {
            Optional<AbstractGame> optional = this.hub.getGameManager().getGames().values().stream().filter(game -> game.getWebsiteDescriptionSkull().getBlock().getLocation().equals(event.getClickedBlock().getLocation())).findAny();

            if (optional.isPresent() && optional.get().getWebsiteDescriptionURL() != null)
                optional.get().showRulesWarning(event.getPlayer());
        }
    }
}
 
開發者ID:SamaGames,項目名稱:Hub,代碼行數:34,代碼來源:PlayerListener.java

示例4: fixSkull

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,代碼行數:9,代碼來源:AntiDamageSkull.java

示例5: onBlockFromTo

@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onBlockFromTo(BlockFromToEvent e) {
	if (cm.isAntiCrashSkull && VersionUtils.isLowerThan(VersionUtils.V1_9) && e.getToBlock().getType() == Material.SKULL) {
		e.setCancelled(true);
	}
}
 
開發者ID:jiongjionger,項目名稱:NeverLag,代碼行數:6,代碼來源:AntiCrashSkull.java

示例6: searchForMarkers

/**
 * Searches the map for "markers". Most of the time these are implemented as tile entities (skulls)
 *
 * @param map    the map to scan
 * @param center the center location
 * @param range  the range in where to scan
 */
public void searchForMarkers(@Nonnull Map map, @Nonnull Vector3D center, int range, @Nonnull UUID gameid) {
    World world = Bukkit.getWorld(map.getLoadedName(gameid));
    if (world == null) {
        throw new MapException("Could not find world " + map.getLoadedName(gameid) + "(" + map.getInfo().getName() + ")" + ". Is it loaded?");
    }

    List<Marker> markers = new ArrayList<>();
    List<ChestMarker> chestMarkers = new ArrayList<>();

    int startX = (int) center.getX();
    int startY = (int) center.getZ();

    int minX = Math.min(startX - range, startX + range);
    int minZ = Math.min(startY - range, startY + range);

    int maxX = Math.max(startX - range, startX + range);
    int maxZ = Math.max(startY - range, startY + range);

    for (int x = minX; x <= maxX; x += 16) {
        for (int z = minZ; z <= maxZ; z += 16) {
            Chunk chunk = world.getChunkAt(x >> 4, z >> 4);
            for (BlockState te : chunk.getTileEntities()) {
                if (te.getType() == Material.SKULL) {
                    Skull skull = (Skull) te;
                    if (skull.getSkullType() == SkullType.PLAYER) {
                        String markerData = getMarkerData(skull);
                        if (markerData == null) continue;
                        MarkerDefinition markerDefinition = mapHandler.createMarkerDefinition(markerData);
                        markers.add(new Marker(new Vector3D(skull.getX(), skull.getY(), skull.getZ()),
                                DirectionUtil.directionToYaw(skull.getRotation()),
                                markerData, markerDefinition));
                    }
                } else if (te.getType() == Material.CHEST) {
                    Chest chest = (Chest) te;
                    String name = chest.getBlockInventory().getName();
                    ItemStack[] items = new ItemStack[chest.getBlockInventory()
                            .getStorageContents().length];
                    for (int i = 0; i < items.length; i++) {
                        ItemStack is = chest.getBlockInventory().getItem(i);
                        if (is == null) {
                            items[i] = new ItemStack(Material.AIR);
                        } else {
                            items[i] = is;
                        }
                    }
                    chestMarkers
                            .add(new ChestMarker(new Vector3D(chest.getX(), chest.getY(), chest.getZ()), name,
                                    items));
                }
            }
        }
    }

    map.setMarkers(markers);
    map.setChestMarkers(chestMarkers);
}
 
開發者ID:VoxelGamesLib,項目名稱:VoxelGamesLibv2,代碼行數:63,代碼來源:MapScanner.java


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