geforkt von Mirrors/Paper
5228a4f24c
The PluginManager incorrectly used synchronization on firing any event that was marked as synchronous. This synchronized did not even protect any concurrency risk as handlers were already thread safe in terms of mutations during event dispatch. The way it was used, has commonly led to deadlocks on the server, which results in a hard crash. This change removes the synchronize and adds some protection around enable/disable
45 Zeilen
1.6 KiB
Diff
45 Zeilen
1.6 KiB
Diff
From a1591adb339b39f104073b0e8c1294671a2ebf25 Mon Sep 17 00:00:00 2001
|
|
From: cswhite2000 <18whitechristop@gmail.com>
|
|
Date: Tue, 21 Aug 2018 19:44:10 -0700
|
|
Subject: [PATCH] isChunkGenerated API
|
|
|
|
Resolves #1329
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
|
index 0eba3df571..ad5485908d 100644
|
|
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
|
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
|
@@ -85,6 +85,12 @@ public class ChunkProviderServer implements IChunkProvider {
|
|
|
|
}
|
|
|
|
+ // Paper start
|
|
+ public boolean isChunkGenerated(int x, int z) {
|
|
+ return this.chunks.containsKey(ChunkCoordIntPair.asLong(x, z)) || this.chunkLoader.chunkExists(x, z);
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
@Nullable
|
|
public Chunk getLoadedChunkAt(int i, int j) {
|
|
long k = ChunkCoordIntPair.a(i, j);
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
index 567e9acb13..afb141c629 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
@@ -630,6 +630,12 @@ public class CraftWorld implements World {
|
|
return getChunkAt(location.getBlockX() >> 4, location.getBlockZ() >> 4);
|
|
}
|
|
|
|
+ // Paper start
|
|
+ public boolean isChunkGenerated(int x, int z) {
|
|
+ return this.getHandle().getChunkProviderServer().isChunkGenerated(x, z);
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
public ChunkGenerator getGenerator() {
|
|
return generator;
|
|
}
|
|
--
|
|
2.18.0
|
|
|