@Override public WeatherType getWeather() { if (getWorld().isThundering()) { return WeatherTypes.THUNDER_STORM; } else if (getWorld().hasStorm()) { return WeatherTypes.RAIN; } return WeatherTypes.CLEAR; }
@Override public boolean execute(CommandSender sender, String currentAlias, String[] args) { if (!testPermission(sender)) return true; World world = null; if (args.length == 1) { world = Bukkit.getWorld(args[0]); if (world == null) { sender.sendMessage(ChatColor.RED + "No world exists with the name '" + args[0] + "'"); return true; } } else if (sender instanceof Player) { world = ((Player) sender).getWorld(); } else { world = Bukkit.getWorlds().get(0); } Command.broadcastCommandMessage(sender, "Toggling downfall " + (world.hasStorm() ? "off" : "on") + " for world '" + world.getName() + "'"); world.setStorm(!world.hasStorm()); return true; }
@Override public boolean execute(CommandSender sender, String label, String[] args, CommandMessages commandMessages) { if (!testPermission(sender, commandMessages.getPermissionMessage())) { return true; } final World world = CommandUtils.getWorld(sender); world.setThundering(!world.hasStorm()); world.setStorm(!world.hasStorm()); new LocalizedStringImpl("toggledownfall.done", commandMessages.getResourceBundle()) .send(sender); return true; }
@Override public boolean hasStorm() { if(world != null) { return world.hasStorm(); } else { return false; } } /* World is thundering */
@Override public boolean isStorming() { return w.hasStorm(); }
@Override public boolean check(String playerID) { World world = PlayerConverter.getPlayer(playerID).getWorld(); switch (weather) { case "sun": case "clear": if (!world.isThundering() && !world.hasStorm()) { return true; } break; case "rain": case "rainy": if (world.hasStorm()) { return true; } break; case "storm": case "thunder": if (world.isThundering()) { return true; } break; } return false; }
@Override public SpellResult perform(CastContext context) { World world = context.getWorld(); if (world == null) { return SpellResult.WORLD_REQUIRED; } boolean hasStorm = world.hasStorm(); boolean makeStorm = weatherString.equals("storm"); if (weatherString.equals("cycle")) { makeStorm = !hasStorm; } if (makeStorm) { world.setStorm(true); world.setThundering(true); } else { world.setStorm(false); world.setThundering(false); } return makeStorm ? SpellResult.CAST : SpellResult.ALTERNATE; }
@Override public boolean execute(CommandSender sender, String currentAlias, String[] args) { if (!testPermission(sender)) return true; World world = null; if (args.length == 1) { world = Bukkit.getWorld(args[0]); if (world == null) { sender.sendMessage(ChatColor.RED + "No world exists with the name '" + args[0] + "'"); return true; } } else if (sender instanceof Player) { world = ((Player) sender).getWorld(); } else { world = Bukkit.getWorlds().get(0); } Command.broadcastCommandMessage(sender, "Toggling downfall " + (world.hasStorm() ? "off" : "on") + " for world '" + world.getName() + "'"); world.setStorm(!world.hasStorm()); return true; }
@Override public SpellResult onCast(ConfigurationSection parameters) { World world = getWorld(); boolean hasStorm = world.hasStorm(); if (hasStorm) { world.setStorm(false); world.setThundering(false); /* boolean hasThunder = world.isThundering(); if (hasThunder) { } else { world.setThundering(true); castMessage("You anger the storm"); } */ } else { world.setStorm(true); // This is mainly so we can have different cast messages and effects, but is a bit of a hack. return SpellResult.ALTERNATE; } return SpellResult.CAST; }
/** * Periodically create storms based on the current temperature */ @Override public void run() { for (World world : Bukkit.getWorlds()) { //Storm: WorldClimateEngine worldEngine = ClimateEngine.getInstance().getClimateEngine(world.getUID()); if (isAllowed(worldEngine, WeatherData.STORM)) { world.setStorm(true); int duration = (int) weatherDistribution.get(WeatherData.DURATION).getValue(worldEngine.getTemperature()); world.setWeatherDuration(duration); } //Thunder (if storming): if (world.hasStorm() && isAllowed(worldEngine, WeatherData.THUNDER)) { world.setThundering(true); int duration = (int) weatherDistribution.get(WeatherData.DURATION).getValue(worldEngine.getTemperature()); world.setThunderDuration(duration); } //Lightning strike (if storming): // - Random player selected (must be outdoors) if (world.hasStorm() && isAllowed(worldEngine, WeatherData.STRIKE_PLAYER)) { Location location = getOutdoorPlayerLocation(world); if (location != null) { world.strikeLightning(location); } } } }
double rawBiteChance = 1.0 / (player.getWorld().hasStorm() ? 300 : 500); Location location = fishingManager.getHookLocation();
case SNOWY_TAIGA_MOUNTAINS: case SNOWY_TUNDRA: weather = (scan_loc.getWorld().hasStorm()) ? plugin.getLanguage().getString("WEATHER_SNOW") : plugin.getLanguage().getString("WEATHER_COLD"); break; default: weather = (scan_loc.getWorld().hasStorm()) ? plugin.getLanguage().getString("WEATHER_RAIN") : plugin.getLanguage().getString("WEATHER_CLEAR"); break;
case SNOWY_TAIGA_HILLS: case SNOWY_TAIGA_MOUNTAINS: weather = (scan_loc.getWorld().hasStorm()) ? plugin.getLanguage().getString("WEATHER_SNOW") : plugin.getLanguage().getString("WEATHER_COLD"); break; default: weather = (scan_loc.getWorld().hasStorm()) ? plugin.getLanguage().getString("WEATHER_RAIN") : plugin.getLanguage().getString("WEATHER_CLEAR"); break;
case SNOWY_TAIGA_HILLS: case SNOWY_TAIGA_MOUNTAINS: weather = (scan_loc.getWorld().hasStorm()) ? plugin.getLanguage().getString("WEATHER_SNOW") : plugin.getLanguage().getString("WEATHER_COLD"); break; default: weather = (scan_loc.getWorld().hasStorm()) ? plugin.getLanguage().getString("WEATHER_RAIN") : plugin.getLanguage().getString("WEATHER_CLEAR"); break;