org.bukkit.event.weather.LightningStrikeEvent Java Examples

The following examples show how to use org.bukkit.event.weather.LightningStrikeEvent. 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: BlockListener.java    From RedProtect with GNU General Public License v3.0 5 votes vote down vote up
@EventHandler(ignoreCancelled = true)
public void onLightning(LightningStrikeEvent e) {
    RedProtect.get().logger.debug(LogLevel.BLOCKS, "BlockListener - Is LightningStrikeEvent event");
    Location l = e.getLightning().getLocation();
    Region r = RedProtect.get().rm.getTopRegion(l);
    if (r != null && !r.canFire()) {
        e.setCancelled(true);
    }
}
 
Example #2
Source File: LivingEntityShopListener.java    From Shopkeepers with GNU General Public License v3.0 5 votes vote down vote up
@EventHandler(ignoreCancelled = true)
void onLightningStrike(LightningStrikeEvent event) {
	// workaround: preventing lightning strikes near villager shopkeepers
	// because they would turn into witches
	Location loc = event.getLightning().getLocation();
	for (Entity entity : Utils.getNearbyEntities(loc, VILLAGER_ZAP_RADIUS, EntityType.VILLAGER)) {
		if (plugin.isShopkeeper(entity)) {
			event.setCancelled(true);
		}
	}
}
 
Example #3
Source File: WorldFreeze.java    From CardinalPGM with MIT License 4 votes vote down vote up
@EventHandler
public void onLightningStrike(LightningStrikeEvent event) {
    event.setCancelled(true);
}