Java Code Examples for org.bukkit.World#setStorm()

The following examples show how to use org.bukkit.World#setStorm() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TimeFirework.java    From NBTEditor with GNU General Public License v3.0 6 votes vote down vote up
@Override
public final void onExplode(FireworkPlayerDetails details) {
	final Location loc = details.getFirework().getLocation();
	if (!_changing && loc.getY() > 255) {
		_changing = true;
		final World world = loc.getWorld();
		world.setStorm(false);
		world.playSound(loc, Sound.ENTITY_LIGHTNING_BOLT_THUNDER, 100, 0);
		final BukkitTask[] task = new BukkitTask[1];
		task[0] = Bukkit.getScheduler().runTaskTimer(getPlugin(), new Runnable() {
			@Override
			public void run() {
				long time = world.getFullTime() + 250;
				world.setFullTime(time);
				if (Math.abs(_finalTime - Math.abs(time%24000)) < 500) {
					world.playSound(loc, Sound.ENTITY_LIGHTNING_BOLT_THUNDER, 100, 0);
					task[0].cancel();
					_changing = false;
				}
			}
		}, 0, 5);
	}
}
 
Example 2
Source File: WeatherEvent.java    From BetonQuest with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected Void execute(String playerID) {
    World world = PlayerConverter.getPlayer(playerID).getWorld();
    world.setStorm(storm);
    world.setThundering(thunder);
    return null;
}