geforkt von Mirrors/Paper
Fix the CraftWorld weather methods duplicating events.
Dieser Commit ist enthalten in:
Ursprung
0643caa888
Commit
93e7b199bd
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde/net/minecraft/server/WorldData.java 2015-01-05 09:50:01.989188327 +1100
|
||||
+++ src/main/java/net/minecraft/server/WorldData.java 2015-01-05 09:50:01.993188321 +1100
|
||||
--- ../work/decompile-8eb82bde/net/minecraft/server/WorldData.java 2015-01-13 20:36:38.880978444 +1100
|
||||
+++ src/main/java/net/minecraft/server/WorldData.java 2015-01-13 20:36:38.880978444 +1100
|
||||
@@ -1,6 +1,9 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
public class WorldData {
|
||||
|
||||
@@ -395,6 +398,16 @@
|
||||
@@ -395,6 +398,18 @@
|
||||
}
|
||||
|
||||
public void setThundering(boolean flag) {
|
||||
@ -22,12 +22,14 @@
|
||||
+ if (thunder.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ setThunderDuration(0); // Will force a time reset
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.s = flag;
|
||||
}
|
||||
|
||||
@@ -411,6 +424,16 @@
|
||||
@@ -411,6 +426,18 @@
|
||||
}
|
||||
|
||||
public void setStorm(boolean flag) {
|
||||
@ -39,12 +41,14 @@
|
||||
+ if (weather.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ setWeatherDuration(0); // Will force a time reset
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.q = flag;
|
||||
}
|
||||
|
||||
@@ -645,4 +668,12 @@
|
||||
@@ -645,4 +672,12 @@
|
||||
static boolean q(WorldData worlddata) {
|
||||
return worlddata.x;
|
||||
}
|
||||
|
@ -751,20 +751,7 @@ public class CraftWorld implements World {
|
||||
}
|
||||
|
||||
public void setStorm(boolean hasStorm) {
|
||||
CraftServer server = world.getServer();
|
||||
|
||||
WeatherChangeEvent weather = new WeatherChangeEvent(this, hasStorm);
|
||||
server.getPluginManager().callEvent(weather);
|
||||
if (!weather.isCancelled()) {
|
||||
world.worldData.setStorm(hasStorm);
|
||||
|
||||
// These numbers are from Minecraft
|
||||
if (hasStorm) {
|
||||
setWeatherDuration(rand.nextInt(12000) + 12000);
|
||||
} else {
|
||||
setWeatherDuration(rand.nextInt(168000) + 12000);
|
||||
}
|
||||
}
|
||||
world.worldData.setStorm(hasStorm);
|
||||
}
|
||||
|
||||
public int getWeatherDuration() {
|
||||
@ -780,21 +767,7 @@ public class CraftWorld implements World {
|
||||
}
|
||||
|
||||
public void setThundering(boolean thundering) {
|
||||
if (thundering && !hasStorm()) setStorm(true);
|
||||
CraftServer server = world.getServer();
|
||||
|
||||
ThunderChangeEvent thunder = new ThunderChangeEvent(this, thundering);
|
||||
server.getPluginManager().callEvent(thunder);
|
||||
if (!thunder.isCancelled()) {
|
||||
world.worldData.setThundering(thundering);
|
||||
|
||||
// These numbers are from Minecraft
|
||||
if (thundering) {
|
||||
setThunderDuration(rand.nextInt(12000) + 3600);
|
||||
} else {
|
||||
setThunderDuration(rand.nextInt(168000) + 12000);
|
||||
}
|
||||
}
|
||||
world.worldData.setThundering(thundering);
|
||||
}
|
||||
|
||||
public int getThunderDuration() {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren