Package org.spout.vanilla.data

Examples of org.spout.vanilla.data.Weather


    float secondsUntilWeatherChange = sky.getData().get(VanillaData.WEATHER_CHANGE_TIME);
    secondsUntilWeatherChange -= dt;
    if (forceWeatherUpdate.compareAndSet(true, false) || secondsUntilWeatherChange <= 0) {
      this.sky.updateWeather(getCurrent(), getForecast());
      sky.getData().put(VanillaData.WORLD_WEATHER, getForecast());
      final Weather current = getCurrent();
      Weather forecast = current;
      while (forecast == current) {
        // When Rain/Snow or Thunderstorms occur, always go to Clear after.
        if (current == Weather.RAIN || current == Weather.THUNDERSTORM) {
          forecast = Weather.CLEAR;
        } else {
View Full Code Here


    event.getMessages().add(new PlayerGameStateMessage(event.getReason(), event.getGameMode()));
  }

  @EventHandler
  public void onWeatherChanged(WeatherChangeEvent event) {
    Weather newWeather = event.getNewWeather();
    if (newWeather.equals(Weather.RAIN) || newWeather.equals(Weather.THUNDERSTORM)) {
      event.getMessages().add(new PlayerGameStateMessage(PlayerGameStateMessage.BEGIN_RAINING));
    } else {
      event.getMessages().add(new PlayerGameStateMessage(PlayerGameStateMessage.END_RAINING));
    }
  }
View Full Code Here

  }

  @CommandDescription (aliases = "weather", usage = "<0|1|2|clear|rain|thunder> (0 = CLEAR, 1 = RAIN/SNOW, 2 = THUNDERSTORM) [world]", desc = "Changes the weather")
  @Permissible ("vanilla.command.weather")
  public void weather(CommandSource source, CommandArguments args) throws CommandException {
    Weather weather = args.popEnumValue("weather", Weather.class);
    World world = args.popWorld("world", source);
    args.assertCompletelyParsed();

    Sky sky = world.get(Sky.class);
    if (sky == null) {
      throw new CommandException("The sky of world '" + world.getName() + "' is not available.");
    }

    sky.setWeather(weather);
    String message;
    switch (weather) {
      case RAIN:
        message = plugin.getPrefix() + ChatStyle.GREEN + "Weather set to " + ChatStyle.WHITE + "RAIN/SNOW" + ChatStyle.GREEN + ".";
        break;
      default:
        message = plugin.getPrefix() + ChatStyle.GREEN + "Weather set to " + ChatStyle.WHITE + weather.name() + ChatStyle.GREEN + ".";
        break;
    }
    if (getEngine() instanceof Client) {
      source.sendMessage(message);
    } else {
View Full Code Here

TOP

Related Classes of org.spout.vanilla.data.Weather

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.