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