当前位置: 首页>>代码示例>>Java>>正文


Java World.hasStorm方法代码示例

本文整理汇总了Java中org.bukkit.World.hasStorm方法的典型用法代码示例。如果您正苦于以下问题:Java World.hasStorm方法的具体用法?Java World.hasStorm怎么用?Java World.hasStorm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.World的用法示例。


在下文中一共展示了World.hasStorm方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onWorldLoad

import org.bukkit.World; //导入方法依赖的package包/类
@EventHandler
public void onWorldLoad(WorldLoadEvent event) {
    World w = event.getWorld();
    if (w.hasStorm())
        w.setStorm(false);
    if (w.isThundering())
        w.setThundering(false);
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:9,代码来源:EnvironmentManager.java

示例2: run

import org.bukkit.World; //导入方法依赖的package包/类
public void run() {
	for (final Player player : Bukkit.getOnlinePlayers()) {
		// Only affect survival and adventure mode players
		if (player.getGameMode() != GameMode.SURVIVAL && player.getGameMode() != GameMode.ADVENTURE) {
			continue;
		}

		// If the player has sunscreen
		if (settings.hasSunscreen(player)) {
			continue;
		}

		// Skip if disabled world.
		final World world = player.getWorld();
		if (settings.isDisabledWorld(world)) {
			continue;
		}

		// If it is raining.
		if (world.hasStorm() || world.isThundering()) {
			continue;
		}

		// If there is a block above them.
		final Location locHead = player.getLocation().add(0, 1, 0);
		final Location locFeet = player.getLocation();

		if (locHead.getY() <= world.getHighestBlockAt(locHead).getY()) {
			continue;
		}

		// If the player is in water
		final Block blockFeet = locFeet.getBlock();
		final Block blockHead = locHead.getBlock();
		if (blockFeet.getType() == Material.WATER || blockFeet.getType() == Material.STATIONARY_WATER
				|| blockHead.getType() == Material.WATER || blockHead.getType() == Material.STATIONARY_WATER) {
			continue;
		}

		// If the light level at the location isn't bright enough
		if (locHead.getBlock().getLightLevel() < 15 && locFeet.getBlock().getLightLevel() < 15) {
			continue;
		}

		// If the player is wearing a helmet.
		if (player.getInventory().getHelmet() != null
				&& player.getInventory().getHelmet().getType() != Material.AIR) {
			continue;
		}

		// Set the player on fire.
		player.setFireTicks(80);
	}
}
 
开发者ID:homiedion,项目名称:Sunscreen,代码行数:55,代码来源:PlayerCombustTask.java


注:本文中的org.bukkit.World.hasStorm方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。