SPIGOT-3304: Respect duration from Vanilla /weather

This commit is contained in:
md_5 2017-06-09 16:17:08 +10:00
parent 2c34c38d7a
commit ed8c725d19
2 changed files with 6 additions and 8 deletions

View File

@ -20,7 +20,7 @@
protected WorldData() { protected WorldData() {
this.f = WorldType.NORMAL; this.f = WorldType.NORMAL;
@@ -437,6 +443,18 @@ @@ -437,6 +443,16 @@
} }
public void setThundering(boolean flag) { public void setThundering(boolean flag) {
@ -32,14 +32,12 @@
+ if (thunder.isCancelled()) { + if (thunder.isCancelled()) {
+ return; + return;
+ } + }
+
+ setThunderDuration(0); // Will force a time reset
+ } + }
+ // CraftBukkit end + // CraftBukkit end
this.v = flag; this.v = flag;
} }
@@ -453,6 +471,18 @@ @@ -453,6 +469,16 @@
} }
public void setStorm(boolean flag) { public void setStorm(boolean flag) {
@ -51,14 +49,12 @@
+ if (weather.isCancelled()) { + if (weather.isCancelled()) {
+ return; + return;
+ } + }
+
+ setWeatherDuration(0); // Will force a time reset
+ } + }
+ // CraftBukkit end + // CraftBukkit end
this.t = flag; this.t = flag;
} }
@@ -598,6 +628,12 @@ @@ -598,6 +624,12 @@
public void setDifficulty(EnumDifficulty enumdifficulty) { public void setDifficulty(EnumDifficulty enumdifficulty) {
this.C = enumdifficulty; this.C = enumdifficulty;
@ -71,7 +67,7 @@
} }
public boolean isDifficultyLocked() { public boolean isDifficultyLocked() {
@@ -716,4 +752,12 @@ @@ -716,4 +748,12 @@
public void a(DimensionManager dimensionmanager, NBTTagCompound nbttagcompound) { public void a(DimensionManager dimensionmanager, NBTTagCompound nbttagcompound) {
this.N.put(dimensionmanager, nbttagcompound); this.N.put(dimensionmanager, nbttagcompound);
} }

View File

@ -771,6 +771,7 @@ public class CraftWorld implements World {
public void setStorm(boolean hasStorm) { public void setStorm(boolean hasStorm) {
world.worldData.setStorm(hasStorm); world.worldData.setStorm(hasStorm);
setWeatherDuration(0); // Reset weather duration (legacy behaviour)
} }
public int getWeatherDuration() { public int getWeatherDuration() {
@ -787,6 +788,7 @@ public class CraftWorld implements World {
public void setThundering(boolean thundering) { public void setThundering(boolean thundering) {
world.worldData.setThundering(thundering); world.worldData.setThundering(thundering);
setThunderDuration(0); // Reset weather duration (legacy behaviour)
} }
public int getThunderDuration() { public int getThunderDuration() {