当前位置: 首页>>代码示例>>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;未经允许,请勿转载。