public function setWeather(int $wea, int $duration = 12000) { $this->level->getServer()->getPluginManager()->callEvent($ev = new WeatherChangeEvent($this->level, $wea, $duration)); if (!$ev->isCancelled()) { $this->weatherNow = $ev->getWeather(); $this->strength1 = mt_rand(90000, 110000); $this->strength2 = mt_rand(30000, 40000); $this->duration = $ev->getDuration(); $this->changeWeather($wea, $this->strength1, $this->strength2); } }
public function setWeather(int $wea, int $duration = 12000) { $this->level->getServer()->getPluginManager()->callEvent($ev = new WeatherChangeEvent($this->level, $wea, $duration)); if (!$ev->isCancelled()) { $this->weatherNow = $ev->getWeather(); $this->strength1 = mt_rand(90000, 110000); //If we're clearing the weather, it doesn't matter what strength values we set $this->strength2 = mt_rand(30000, 40000); $this->duration = $ev->getDuration(); $this->sendWeatherToAll(); } }