Exemple #1
0
  @Override
  public void updateWeather(Weather oldWeather, Weather newWeather) {
    org.spout.vanilla.event.world.WeatherChangeEvent event =
        Spout.getEventManager()
            .callEvent(
                new org.spout.vanilla.event.world.WeatherChangeEvent(this, oldWeather, newWeather));
    if (event.isCancelled()) {
      return;
    }
    this.getWorld().getDataMap().put(Data.WEATHER, newWeather);

    byte reason =
        (newWeather.equals(Weather.RAIN) || newWeather.equals(Weather.THUNDERSTORM))
            ? ChangeGameStateMessage.BEGIN_RAINING
            : ChangeGameStateMessage.END_RAINING;
    broadcastMessage(new ChangeGameStateMessage(reason));
  }
 @EventHandler
 public Message onWeatherChanged(WeatherChangeEvent event) {
   Weather newWeather = event.getNewWeather();
   if (newWeather.equals(Weather.RAIN) || newWeather.equals(Weather.THUNDERSTORM)) {
     return new PlayerGameStateMessage(PlayerGameStateMessage.BEGIN_RAINING);
   } else {
     return new PlayerGameStateMessage(PlayerGameStateMessage.END_RAINING);
   }
 }