/** * Send a lighting strike to a collection of players. * * @param players The players to send the lightning strike to. * @param location The location of the lightning strike. * @param sound True to add sound to the strike, otherwise false. * @return True if successful, false if no lightning NMS handler was present. */ public static boolean strike(Collection<Player> players, Location location, boolean sound) { PreCon.notNull(players); PreCon.notNull(location); loadHandler(); if (_handler != null) { _handler.lightningStrike(players, location, sound); return true; } return false; }
/** * Send a lightning strike to all players within a specified block radius. * * @param location The location of the lightning strike. * @param radius The radius. * @param sound True to add sound to the strike, otherwise false. * @return The players that the lightning strike was sent to. */ public static Collection<Player> strike(Location location, double radius, boolean sound) { PreCon.notNull(location); PreCon.positiveNumber(radius); loadHandler(); if (_handler == null) { location.getWorld().strikeLightningEffect(location); return location.getWorld().getPlayers(); } else { return _handler.lightningStrike(location, radius, sound); } }
/** * Send a lightning strike to all players within a specified block radius and add the players to * the specified output collection. * * @param location The location of the lightning strike. * @param radius The radius. * @param output The output collection. * @param sound True to add sound to the strike, otherwise false. * @return The output collection. */ public static <T extends Collection<Player>> T strike( Location location, double radius, boolean sound, T output) { PreCon.notNull(location); PreCon.positiveNumber(radius); PreCon.notNull(output); loadHandler(); if (_handler == null) { location.getWorld().strikeLightningEffect(location); output.addAll(location.getWorld().getPlayers()); } else { _handler.lightningStrike(location, radius, sound, output); } return output; }