Package ch.njol.skript.util

Examples of ch.njol.skript.util.WeatherType


  @Override
  public boolean check(final Event e) {
    return worlds.check(e, new Checker<World>() {
      @Override
      public boolean check(final World w) {
        final WeatherType t;
        if (e instanceof WeatherEvent && w.equals(((WeatherEvent) e).getWorld()) && !Delay.isDelayed(e)) {
          t = WeatherType.fromEvent((WeatherEvent) e);
        } else {
          t = WeatherType.fromWorld(w);
        }
View Full Code Here


    return null;
  }
 
  @Override
  public void change(final Event e, final @Nullable Object[] delta, final ChangeMode mode) {
    final WeatherType t = delta == null ? WeatherType.CLEAR : (WeatherType) delta[0];
    for (final World w : getExpr().getArray(e)) {
      assert w != null : getExpr();
      if (getTime() >= 0 && e instanceof WeatherEvent && w.equals(((WeatherEvent) e).getWorld()) && !Delay.isDelayed(e)) {
        if (e instanceof WeatherChangeEvent) {
          if (((WeatherChangeEvent) e).toWeatherState() && t == WeatherType.CLEAR)
            ((WeatherChangeEvent) e).setCancelled(true);
          if (((WeatherChangeEvent) e).getWorld().isThundering() != (t == WeatherType.THUNDER))
            ((WeatherChangeEvent) e).getWorld().setThundering(t == WeatherType.THUNDER);
        } else if (e instanceof ThunderChangeEvent) {
          if (((ThunderChangeEvent) e).toThunderState() && t != WeatherType.THUNDER)
            ((ThunderChangeEvent) e).setCancelled(true);
          if (((ThunderChangeEvent) e).getWorld().hasStorm() != (t != WeatherType.CLEAR))
            ((ThunderChangeEvent) e).getWorld().setStorm(t != WeatherType.CLEAR);
        }
      } else {
        t.setWeather(w);
      }
    }
  }
View Full Code Here

TOP

Related Classes of ch.njol.skript.util.WeatherType

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.