#771: Add clear weather World API

By: Parker Hawke <hawkeboyz2@hotmail.com>
This commit is contained in:
CraftBukkit/Spigot 2020-11-26 10:08:19 +11:00
parent d9f5dbb3e6
commit 7e0df16cfe

View file

@ -1283,6 +1283,7 @@ public class CraftWorld implements World {
public void setStorm(boolean hasStorm) {
world.worldData.setStorm(hasStorm);
setWeatherDuration(0); // Reset weather duration (legacy behaviour)
setClearWeatherDuration(0); // Reset clear weather duration (reset "/weather clear" commands)
}
@Override
@ -1304,6 +1305,7 @@ public class CraftWorld implements World {
public void setThundering(boolean thundering) {
world.worldDataServer.setThundering(thundering);
setThunderDuration(0); // Reset weather duration (legacy behaviour)
setClearWeatherDuration(0); // Reset clear weather duration (reset "/weather clear" commands)
}
@Override
@ -1316,6 +1318,21 @@ public class CraftWorld implements World {
world.worldDataServer.setThunderDuration(duration);
}
@Override
public boolean isClearWeather() {
return !this.hasStorm() && !this.isThundering();
}
@Override
public void setClearWeatherDuration(int duration) {
world.worldDataServer.a(duration); // PAIL rename setClearWeatherDuration
}
@Override
public int getClearWeatherDuration() {
return world.worldDataServer.h(); // PAIL rename getClearWeatherDuration
}
@Override
public long getSeed() {
return world.getSeed();