public boolean strikeLightning(Entity entity) { // CraftBukkit start LightningStrikeEvent lightning = new LightningStrikeEvent(this.getWorld(), (org.bukkit.entity.LightningStrike) entity.getBukkitEntity()); this.getServer().getPluginManager().callEvent(lightning); if (lightning.isCancelled()) { return false; } // CraftBukkit end if (super.strikeLightning(entity)) { this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entity.locX, entity.locY, entity.locZ, 512.0D, dimension, new PacketPlayOutSpawnEntityWeather(entity)); // CraftBukkit - Use dimension return true; } else { return false; } }
@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); } } }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void light(LightningStrikeEvent evt) { Location target = evt.getLightning().getLocation(); World world = target.getWorld(); for (Location each : locs) { if (each.getWorld() != world) return; Block self = world.getBlockAt(each); if (self == null) { locs.remove(target); return; } Structure s = StructureChangeListener.match(self); if (s == null || !(s instanceof StructureConductor)) { locs.remove(target); return; } if (target.distance(each) <= 50) { evt.setCancelled(true); world.strikeLightning(each); } } }
public boolean strikeLightning(Entity entity) { // CraftBukkit start LightningStrikeEvent lightning = new LightningStrikeEvent(this.getWorld(), (org.bukkit.entity.LightningStrike) entity.getBukkitEntity()); this.getServer().getPluginManager().callEvent(lightning); if (lightning.isCancelled()) { return false; } if (super.strikeLightning(entity)) { this.server.getPlayerList().sendPacketNearby(entity.locX, entity.locY, entity.locZ, 512.0D, this.dimension, new PacketPlayOutSpawnEntityWeather(entity)); // CraftBukkit end return true; } else { return false; } }
public boolean strikeLightning(Entity entity) { // CraftBukkit start LightningStrikeEvent lightning = new LightningStrikeEvent(this.getWorld(), (org.bukkit.entity.LightningStrike) entity.getBukkitEntity()); this.getServer().getPluginManager().callEvent(lightning); if (lightning.isCancelled()) { return false; } if (super.strikeLightning(entity)) { this.server.getPlayerList().sendPacketNearby(entity.locX, entity.locY, entity.locZ, 512.0D, this.dimension, new Packet71Weather(entity)); // CraftBukkit end return true; } else { return false; } }
public boolean addWeatherEffect(Entity p_72942_1_) { // Cauldron start - vanilla compatibility if (p_72942_1_ instanceof net.minecraft.entity.effect.EntityLightningBolt) { // CraftBukkit start LightningStrikeEvent lightning = new LightningStrikeEvent(this.getWorld(), (org.bukkit.entity.LightningStrike) p_72942_1_.getBukkitEntity()); this.getServer().getPluginManager().callEvent(lightning); if (lightning.isCancelled()) { return false; } // CraftBukkit end } // Cauldron end if (super.addWeatherEffect(p_72942_1_)) { this.mcServer.getConfigurationManager().sendToAllNear(p_72942_1_.posX, p_72942_1_.posY, p_72942_1_.posZ, 512.0D, this.provider.dimensionId, new S2CPacketSpawnGlobalEntity(p_72942_1_)); return true; } else { return false; } }
@EventHandler(priority = EventPriority.HIGHEST) public void onLightningStrike(final LightningStrikeEvent event) { final ProtectHolder settings = prot.getSettings(); if (!event.isCancelled() && settings.getData().isDisableLighting()) { event.setCancelled(true); } }
@EventHandler public void onLightNing(LightningStrikeEvent e) { if (ConfigGServerEvent.getConfig().getBoolean("Server.Disable.LightningStrike.Disable")) { if (!ConfigGServerEvent.getConfig().getBoolean("Server.Disable.LightningStrike.World.All_World")) { if (WorldUtils.getWLS().contains(e.getLightning().getWorld().getName())) { e.setCancelled(true); } } else { e.setCancelled(true); } } }
@HookHandler(priority = Priority.CRITICAL) public void onLightningStrike(final LightningStrikeHook hook) { server.getPluginManager().callEvent( new LightningStrikeEvent(new CanaryWorld(hook.getLightningBolt().getWorld()), new CanaryLightningStrike(hook.getLightningBolt())) { @Override public void setCancelled(boolean cancelled) { super.setCancelled(cancelled); //LightningStrikeHook isn't a CancelableHook :( } }); }
@EventHandler public void onLightning(LightningStrikeEvent e){ RedProtect.get().logger.debug("RPBlockListener - Is LightningStrikeEvent event"); Location l = e.getLightning().getLocation(); Region r = RedProtect.get().rm.getTopRegion(l); if (r != null && !r.canFire()){ e.setCancelled(true); } }
@EventHandler(ignoreCancelled = true) public void onLightningStrike(LightningStrikeEvent evt) { evt.setCancelled(Utils.nextBool()); }
@EventHandler public void onLightningStrike(LightningStrikeEvent event) { callHandlers("weather.lightningStrike", event); }
@EventHandler public void onLightningStrike(LightningStrikeEvent event) { event.setCancelled(true); }