Fix keep-spawn-loaded stopping force-loaded chunks from loading

Also, cleanup the patch a little bit
This commit is contained in:
Shane Freeder 2020-12-01 13:23:44 +00:00
parent bfa122ae6a
commit 9119af508c
14 changed files with 75 additions and 60 deletions

View File

@ -21,25 +21,29 @@ index a9a3dbbe7608d1f0dc122fe8d49928e7e3fa1438..e9c03546c42657dd5f5d4c6f71bd7e0c
+ } + }
} }
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 44991803a489a42842f79ce51bdd53a73ef35d71..12866eec621d9ae8801d50bdda13e757f303010e 100644 index 44991803a489a42842f79ce51bdd53a73ef35d71..7d9a3375d289deccdfa0f4caa8a2088550c560aa 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -605,6 +605,14 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -597,35 +597,36 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
// CraftBukkit start
public void loadSpawn(WorldLoadListener worldloadlistener, WorldServer worldserver) {
- if (!worldserver.getWorld().getKeepSpawnInMemory()) {
- return;
- }
+ ChunkProviderServer chunkproviderserver = worldserver.getChunkProvider(); // Paper
// WorldServer worldserver = this.E();
this.forceTicks = true; this.forceTicks = true;
// CraftBukkit end // CraftBukkit end
+ if (worldserver.getWorld().getKeepSpawnInMemory()) { // Paper
+ // Paper start - configurable spawn reason
+ int radiusBlocks = worldserver.paperConfig.keepLoadedRange;
+ int radiusChunks = radiusBlocks / 16 + ((radiusBlocks & 15) != 0 ? 1 : 0);
+ int totalChunks = ((radiusChunks) * 2 + 1);
+ totalChunks *= totalChunks;
+ worldloadlistener.setChunkRadius(radiusBlocks / 16);
+ // Paper end
+
MinecraftServer.LOGGER.info("Preparing start region for dimension {}", worldserver.getDimensionKey().a()); MinecraftServer.LOGGER.info("Preparing start region for dimension {}", worldserver.getDimensionKey().a());
BlockPosition blockposition = worldserver.getSpawn(); BlockPosition blockposition = worldserver.getSpawn();
@@ -613,14 +621,12 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas worldloadlistener.a(new ChunkCoordIntPair(blockposition));
- ChunkProviderServer chunkproviderserver = worldserver.getChunkProvider();
+ //ChunkProviderServer chunkproviderserver = worldserver.getChunkProvider(); // Paper - move up
chunkproviderserver.getLightEngine().a(500); chunkproviderserver.getLightEngine().a(500);
this.nextTick = SystemUtils.getMonotonicMillis(); this.nextTick = SystemUtils.getMonotonicMillis();
@ -50,15 +54,26 @@ index 44991803a489a42842f79ce51bdd53a73ef35d71..12866eec621d9ae8801d50bdda13e757
- // this.nextTick = SystemUtils.getMonotonicMillis() + 10L; - // this.nextTick = SystemUtils.getMonotonicMillis() + 10L;
- this.executeModerately(); - this.executeModerately();
- // CraftBukkit end - // CraftBukkit end
+ // Paper start - Configurable spawn radius - }
+ if (worldserver.keepSpawnInMemory) { -
+ worldserver.addTicketsForSpawn(radiusBlocks, blockposition); + // Paper start - configurable spawn reason
} + int radiusBlocks = worldserver.paperConfig.keepLoadedRange;
+ // Paper end + int radiusChunks = radiusBlocks / 16 + ((radiusBlocks & 15) != 0 ? 1 : 0);
+ int totalChunks = ((radiusChunks) * 2 + 1);
+ totalChunks *= totalChunks;
+ worldloadlistener.setChunkRadius(radiusBlocks / 16);
+
+ worldserver.addTicketsForSpawn(radiusBlocks, blockposition);
+ LOGGER.info("Loaded " + chunkproviderserver.b() + " spawn chunks for world " + worldserver.getWorld().getName()); // Paper + LOGGER.info("Loaded " + chunkproviderserver.b() + " spawn chunks for world " + worldserver.getWorld().getName()); // Paper
+ // Paper end
// CraftBukkit start // CraftBukkit start
// this.nextTick = SystemUtils.getMonotonicMillis() + 10L; // this.nextTick = SystemUtils.getMonotonicMillis() + 10L;
this.executeModerately();
// Iterator iterator = this.worldServer.values().iterator();
+ }
if (true) {
WorldServer worldserver1 = worldserver;
diff --git a/src/main/java/net/minecraft/server/WorldLoadListener.java b/src/main/java/net/minecraft/server/WorldLoadListener.java diff --git a/src/main/java/net/minecraft/server/WorldLoadListener.java b/src/main/java/net/minecraft/server/WorldLoadListener.java
index d6762d3853b55b639047f455351150a1cbc9399a..7b6f5b2da0a76661a0e047ee7002aa07cdd4a8b1 100644 index d6762d3853b55b639047f455351150a1cbc9399a..7b6f5b2da0a76661a0e047ee7002aa07cdd4a8b1 100644
--- a/src/main/java/net/minecraft/server/WorldLoadListener.java --- a/src/main/java/net/minecraft/server/WorldLoadListener.java

View File

@ -62,7 +62,7 @@ index 0c5a14d98f824591c553684191b32ccb507ebe2f..4140de8bcd1ee93f77574d892d32e7c7
public void close() throws IOException { public void close() throws IOException {
// CraftBukkit start // CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 12866eec621d9ae8801d50bdda13e757f303010e..4a184a28ac6b55e59a57ad832392f3d19a48ac0e 100644 index 7d9a3375d289deccdfa0f4caa8a2088550c560aa..8e2971458b4fbac7d288c190245bb0f8e1c84d7a 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -152,6 +152,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -152,6 +152,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@ -73,7 +73,7 @@ index 12866eec621d9ae8801d50bdda13e757f303010e..4a184a28ac6b55e59a57ad832392f3d1
public CommandDispatcher vanillaCommandDispatcher; public CommandDispatcher vanillaCommandDispatcher;
private boolean forceTicks; private boolean forceTicks;
// CraftBukkit end // CraftBukkit end
@@ -1142,14 +1143,24 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -1137,14 +1138,24 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.serverPing.b().a(agameprofile); this.serverPing.b().a(agameprofile);
} }

View File

@ -2950,10 +2950,10 @@ index dacb8563bc823c8f6f1e1e10f2b8b9894819374f..80a95441ec2b8394b74818ab74de070b
DedicatedServer dedicatedserver1 = new DedicatedServer(optionset, datapackconfiguration1, thread, iregistrycustom_dimension, convertable_conversionsession, resourcepackrepository, datapackresources, null, dedicatedserversettings, DataConverterRegistry.a(), minecraftsessionservice, gameprofilerepository, usercache, WorldLoadListenerLogger::new); DedicatedServer dedicatedserver1 = new DedicatedServer(optionset, datapackconfiguration1, thread, iregistrycustom_dimension, convertable_conversionsession, resourcepackrepository, datapackresources, null, dedicatedserversettings, DataConverterRegistry.a(), minecraftsessionservice, gameprofilerepository, usercache, WorldLoadListenerLogger::new);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 4a184a28ac6b55e59a57ad832392f3d19a48ac0e..416658a2ddfb11c4a6929807b4e9d8bd8f708e2d 100644 index 8e2971458b4fbac7d288c190245bb0f8e1c84d7a..10be85be566d486a486e2e0a61b3aa33858cab27 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -806,7 +806,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -801,7 +801,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.getUserCache().b(false); // Paper this.getUserCache().b(false); // Paper
} }
// Spigot end // Spigot end

View File

@ -73,10 +73,10 @@ index 63aa474c73f506737cb5de31977bffcd17d4dc11..b6703378e21a6cd7e140fd35756a20d4
itemstack.d(this.D()); itemstack.d(this.D());
if (this.tag != null) { if (this.tag != null) {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index bf3da57c1e709acb3fa9243fb3bb6eaf0613f145..7edc7bfe804a9b450d5873444923d26ffaa96ba0 100644 index f12bd4b34745a67477cc7a28b5c8dfaf970bbb61..b1408a72194b7a3743cdcfd88afd22cbe8d89eaa 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1246,6 +1246,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -1241,6 +1241,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
while (iterator.hasNext()) { while (iterator.hasNext()) {
WorldServer worldserver = (WorldServer) iterator.next(); WorldServer worldserver = (WorldServer) iterator.next();
worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper

View File

@ -28,10 +28,10 @@ index 1b49c214998a5a9b424472df040d634d9fcc0c4a..d7e22e1bf886800adbe8ed7baa3349e5
+ } + }
} }
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index e57bda6223966171f15e0c6c24680a54c0edd83d..8e2300e22ca76562acf29c42c0025b4d4c2689b1 100644 index f5120de89959d6f4df94bfd37657f390e9892f55..1647c36c2b8f81be59ed48eb329977331aa709b1 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -660,7 +660,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -655,7 +655,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.executeModerately(); this.executeModerately();
// CraftBukkit end // CraftBukkit end
worldloadlistener.b(); worldloadlistener.b();

View File

@ -135,10 +135,10 @@ index dea7ff47f7a2934708d887c2c40f9328b78fc84e..e31ebda893112b932ee314fc72263fc1
protected boolean executeNext() { protected boolean executeNext() {
// CraftBukkit start - process pending Chunk loadCallback() and unloadCallback() after each run task // CraftBukkit start - process pending Chunk loadCallback() and unloadCallback() after each run task
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 8e2300e22ca76562acf29c42c0025b4d4c2689b1..664daf13341285a7e24c67a62e765627d79ee578 100644 index 1647c36c2b8f81be59ed48eb329977331aa709b1..3149caeee2ad6e31806530b794f265315105ef5a 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -940,6 +940,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -935,6 +935,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
// Paper end // Paper end
tickSection = curTime; tickSection = curTime;
} }
@ -146,7 +146,7 @@ index 8e2300e22ca76562acf29c42c0025b4d4c2689b1..664daf13341285a7e24c67a62e765627
// Spigot end // Spigot end
//MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit // Paper - don't overwrite current tick time //MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit // Paper - don't overwrite current tick time
@@ -1009,7 +1010,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -1004,7 +1005,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
} }
@ -155,7 +155,7 @@ index 8e2300e22ca76562acf29c42c0025b4d4c2689b1..664daf13341285a7e24c67a62e765627
// CraftBukkit start // CraftBukkit start
if (isOversleep) return canOversleep();// Paper - because of our changes, this logic is broken if (isOversleep) return canOversleep();// Paper - because of our changes, this logic is broken
return this.forceTicks || this.isEntered() || SystemUtils.getMonotonicMillis() < (this.X ? this.W : this.nextTick); return this.forceTicks || this.isEntered() || SystemUtils.getMonotonicMillis() < (this.X ? this.W : this.nextTick);
@@ -1039,6 +1040,23 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -1034,6 +1035,23 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
}); });
} }
@ -179,7 +179,7 @@ index 8e2300e22ca76562acf29c42c0025b4d4c2689b1..664daf13341285a7e24c67a62e765627
@Override @Override
protected TickTask postToMainThread(Runnable runnable) { protected TickTask postToMainThread(Runnable runnable) {
return new TickTask(this.ticks, runnable); return new TickTask(this.ticks, runnable);
@@ -1125,6 +1143,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -1120,6 +1138,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
// Paper start - move oversleep into full server tick // Paper start - move oversleep into full server tick
isOversleep = true;MinecraftTimings.serverOversleep.startTiming(); isOversleep = true;MinecraftTimings.serverOversleep.startTiming();
this.awaitTasks(() -> { this.awaitTasks(() -> {
@ -187,7 +187,7 @@ index 8e2300e22ca76562acf29c42c0025b4d4c2689b1..664daf13341285a7e24c67a62e765627
return !this.canOversleep(); return !this.canOversleep();
}); });
isOversleep = false;MinecraftTimings.serverOversleep.stopTiming(); isOversleep = false;MinecraftTimings.serverOversleep.stopTiming();
@@ -1203,13 +1222,16 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -1198,13 +1217,16 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
} }
protected void b(BooleanSupplier booleansupplier) { protected void b(BooleanSupplier booleansupplier) {
@ -204,7 +204,7 @@ index 8e2300e22ca76562acf29c42c0025b4d4c2689b1..664daf13341285a7e24c67a62e765627
this.methodProfiler.exitEnter("levels"); this.methodProfiler.exitEnter("levels");
Iterator iterator = this.getWorlds().iterator(); Iterator iterator = this.getWorlds().iterator();
@@ -1220,7 +1242,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -1215,7 +1237,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
processQueue.remove().run(); processQueue.remove().run();
} }
MinecraftTimings.processQueueTimer.stopTiming(); // Spigot MinecraftTimings.processQueueTimer.stopTiming(); // Spigot
@ -213,7 +213,7 @@ index 8e2300e22ca76562acf29c42c0025b4d4c2689b1..664daf13341285a7e24c67a62e765627
MinecraftTimings.timeUpdateTimer.startTiming(); // Spigot // Paper MinecraftTimings.timeUpdateTimer.startTiming(); // Spigot // Paper
// Send time updates to everyone, it will get the right time from the world the player is in. // Send time updates to everyone, it will get the right time from the world the player is in.
// Paper start - optimize time updates // Paper start - optimize time updates
@@ -1262,9 +1284,11 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -1257,9 +1279,11 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.methodProfiler.enter("tick"); this.methodProfiler.enter("tick");
try { try {

View File

@ -87,7 +87,7 @@ index 01d7ad6778d4bbef6e07f7529f40dd9da6cd2ea8..6f0c5a2d33001f59e560ec239c0edbd3
version = getInt("config-version", 20); version = getInt("config-version", 20);
set("config-version", 20); set("config-version", 20);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 664daf13341285a7e24c67a62e765627d79ee578..dc9207189ed49f0fa45170042215584ddb274233 100644 index 3149caeee2ad6e31806530b794f265315105ef5a..0c469ad1fd477fdb6181c657b7b9e193c790246d 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -107,6 +107,11 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -107,6 +107,11 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@ -102,7 +102,7 @@ index 664daf13341285a7e24c67a62e765627d79ee578..dc9207189ed49f0fa45170042215584d
@Nullable @Nullable
private KeyPair H; private KeyPair H;
@Nullable @Nullable
@@ -1214,6 +1219,12 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -1209,6 +1214,12 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.ag = this.ag * 0.8F + (float) l / 1000000.0F * 0.19999999F; this.ag = this.ag * 0.8F + (float) l / 1000000.0F * 0.19999999F;
long i1 = SystemUtils.getMonotonicNanos(); long i1 = SystemUtils.getMonotonicNanos();
@ -115,7 +115,7 @@ index 664daf13341285a7e24c67a62e765627d79ee578..dc9207189ed49f0fa45170042215584d
this.circularTimer.a(i1 - i); this.circularTimer.a(i1 - i);
this.methodProfiler.exit(); this.methodProfiler.exit();
org.spigotmc.WatchdogThread.tick(); // Spigot org.spigotmc.WatchdogThread.tick(); // Spigot
@@ -2186,4 +2197,30 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -2181,4 +2192,30 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
public ITextFilter a(EntityPlayer entityplayer) { public ITextFilter a(EntityPlayer entityplayer) {
return null; return null;
} }

View File

@ -109,7 +109,7 @@ index bc15da4640a4a6107c9c186a01ce76df87511b41..27db247aa40e0516302c74b9bf00c631
} }
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index dc9207189ed49f0fa45170042215584ddb274233..3658b99ee4686f5b02191a59e3d64fe596b343ec 100644 index 0c469ad1fd477fdb6181c657b7b9e193c790246d..fe88179037f1a56cec3543910cfab67b0e2ebbe4 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -159,7 +159,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -159,7 +159,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@ -130,7 +130,7 @@ index dc9207189ed49f0fa45170042215584ddb274233..3658b99ee4686f5b02191a59e3d64fe5
public static <S extends MinecraftServer> S a(Function<Thread, S> function) { public static <S extends MinecraftServer> S a(Function<Thread, S> function) {
AtomicReference<S> atomicreference = new AtomicReference(); AtomicReference<S> atomicreference = new AtomicReference();
Thread thread = new Thread(() -> { Thread thread = new Thread(() -> {
@@ -736,6 +738,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -731,6 +733,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
// CraftBukkit start // CraftBukkit start
private boolean hasStopped = false; private boolean hasStopped = false;
@ -138,7 +138,7 @@ index dc9207189ed49f0fa45170042215584ddb274233..3658b99ee4686f5b02191a59e3d64fe5
private final Object stopLock = new Object(); private final Object stopLock = new Object();
public final boolean hasStopped() { public final boolean hasStopped() {
synchronized (stopLock) { synchronized (stopLock) {
@@ -750,6 +753,19 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -745,6 +748,19 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
if (hasStopped) return; if (hasStopped) return;
hasStopped = true; hasStopped = true;
} }
@ -158,7 +158,7 @@ index dc9207189ed49f0fa45170042215584ddb274233..3658b99ee4686f5b02191a59e3d64fe5
// CraftBukkit end // CraftBukkit end
MinecraftServer.LOGGER.info("Stopping server"); MinecraftServer.LOGGER.info("Stopping server");
MinecraftTimings.stopServer(); // Paper MinecraftTimings.stopServer(); // Paper
@@ -815,7 +831,18 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -810,7 +826,18 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.getUserCache().b(false); // Paper this.getUserCache().b(false); // Paper
} }
// Spigot end // Spigot end
@ -177,7 +177,7 @@ index dc9207189ed49f0fa45170042215584ddb274233..3658b99ee4686f5b02191a59e3d64fe5
} }
public String getServerIp() { public String getServerIp() {
@@ -908,6 +935,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -903,6 +930,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
protected void w() { protected void w() {
try { try {
@ -185,7 +185,7 @@ index dc9207189ed49f0fa45170042215584ddb274233..3658b99ee4686f5b02191a59e3d64fe5
if (this.init()) { if (this.init()) {
this.nextTick = SystemUtils.getMonotonicMillis(); this.nextTick = SystemUtils.getMonotonicMillis();
this.serverPing.setMOTD(new ChatComponentText(this.motd)); this.serverPing.setMOTD(new ChatComponentText(this.motd));
@@ -915,6 +943,18 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -910,6 +938,18 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.a(this.serverPing); this.a(this.serverPing);
// Spigot start // Spigot start
@ -204,7 +204,7 @@ index dc9207189ed49f0fa45170042215584ddb274233..3658b99ee4686f5b02191a59e3d64fe5
org.spigotmc.WatchdogThread.hasStarted = true; // Paper org.spigotmc.WatchdogThread.hasStarted = true; // Paper
Arrays.fill( recentTps, 20 ); Arrays.fill( recentTps, 20 );
long start = System.nanoTime(), curTime, tickSection = start; // Paper - Further improve server tick loop long start = System.nanoTime(), curTime, tickSection = start; // Paper - Further improve server tick loop
@@ -970,6 +1010,12 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -965,6 +1005,12 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.a((CrashReport) null); this.a((CrashReport) null);
} }
} catch (Throwable throwable) { } catch (Throwable throwable) {
@ -217,7 +217,7 @@ index dc9207189ed49f0fa45170042215584ddb274233..3658b99ee4686f5b02191a59e3d64fe5
MinecraftServer.LOGGER.error("Encountered an unexpected exception", throwable); MinecraftServer.LOGGER.error("Encountered an unexpected exception", throwable);
// Spigot Start // Spigot Start
if ( throwable.getCause() != null ) if ( throwable.getCause() != null )
@@ -1001,14 +1047,14 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -996,14 +1042,14 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
} catch (Throwable throwable1) { } catch (Throwable throwable1) {
MinecraftServer.LOGGER.error("Exception stopping the server", throwable1); MinecraftServer.LOGGER.error("Exception stopping the server", throwable1);
} finally { } finally {
@ -235,7 +235,7 @@ index dc9207189ed49f0fa45170042215584ddb274233..3658b99ee4686f5b02191a59e3d64fe5
} }
} }
@@ -1064,6 +1110,12 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -1059,6 +1105,12 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@Override @Override
protected TickTask postToMainThread(Runnable runnable) { protected TickTask postToMainThread(Runnable runnable) {
@ -248,7 +248,7 @@ index dc9207189ed49f0fa45170042215584ddb274233..3658b99ee4686f5b02191a59e3d64fe5
return new TickTask(this.ticks, runnable); return new TickTask(this.ticks, runnable);
} }
@@ -1306,6 +1358,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -1301,6 +1353,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
try { try {
crashreport = CrashReport.a(throwable, "Exception ticking world"); crashreport = CrashReport.a(throwable, "Exception ticking world");
} catch (Throwable t) { } catch (Throwable t) {
@ -256,7 +256,7 @@ index dc9207189ed49f0fa45170042215584ddb274233..3658b99ee4686f5b02191a59e3d64fe5
throw new RuntimeException("Error generating crash report", t); throw new RuntimeException("Error generating crash report", t);
} }
// Spigot End // Spigot End
@@ -1763,7 +1816,8 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -1758,7 +1811,8 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.resourcePackRepository.a(collection); this.resourcePackRepository.a(collection);
this.saveData.a(a(this.resourcePackRepository)); this.saveData.a(a(this.resourcePackRepository));
datapackresources.i(); datapackresources.i();

View File

@ -44,10 +44,10 @@ index e9bc1d22825850a1f1ef3267428c19847d4c8ab8..4965d0fbc123071a2f2f44f559336f7a
List<Entity> list = this.tracker.getPassengers(); List<Entity> list = this.tracker.getPassengers();
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 3658b99ee4686f5b02191a59e3d64fe596b343ec..674cb4556b5714e9d45a76795f2f3a15095be6a6 100644 index fe88179037f1a56cec3543910cfab67b0e2ebbe4..a91a581b25b19d62949f641847b633208672fb1e 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1532,6 +1532,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -1527,6 +1527,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
} }
} }

View File

@ -10,10 +10,10 @@ Adds a 5 second grace period for any async tasks to finish and warns
if any are still running after that delay just as reload does. if any are still running after that delay just as reload does.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 674cb4556b5714e9d45a76795f2f3a15095be6a6..c249a1c3bc9013a1e769d026f4826a8edb31f076 100644 index a91a581b25b19d62949f641847b633208672fb1e..450c04c5a1153ea9d11d005f3be623bbf8b26ce6 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -772,6 +772,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -767,6 +767,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
// CraftBukkit start // CraftBukkit start
if (this.server != null) { if (this.server != null) {
this.server.disablePlugins(); this.server.disablePlugins();

View File

@ -39,10 +39,10 @@ index f5792b999ce42acb13ae9a62ceb2ddec39abe209..5504facd2e453238caa71d98743be541
@Override @Override
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index c249a1c3bc9013a1e769d026f4826a8edb31f076..1aabd16cd23a2bcdd6e29de63fca36226c05c428 100644 index 450c04c5a1153ea9d11d005f3be623bbf8b26ce6..157f8f5e5255312b916aef200810ad387fac915f 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1525,11 +1525,14 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -1520,11 +1520,14 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
} }
} }

View File

@ -37,10 +37,10 @@ index 66920fa15720976a84a33ce498b8ca6f5ad5dee3..59d47a9f75450573b26b82b6f432af7b
public NetworkManager networkManager; // Paper public NetworkManager networkManager; // Paper
public final MinecraftServer server; public final MinecraftServer server;
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 1aabd16cd23a2bcdd6e29de63fca36226c05c428..c52de0ad2496888e462bef6c9f751d03dbb6e550 100644 index 157f8f5e5255312b916aef200810ad387fac915f..dd34782b85ccf7f9f4dedd72f9220f12475a46d2 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1227,9 +1227,15 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -1222,9 +1222,15 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
//if (autosavePeriod > 0 && this.ticks % autosavePeriod == 0) { // CraftBukkit // Paper - move down //if (autosavePeriod > 0 && this.ticks % autosavePeriod == 0) { // CraftBukkit // Paper - move down
//MinecraftServer.LOGGER.debug("Autosave started"); // Paper //MinecraftServer.LOGGER.debug("Autosave started"); // Paper
serverAutoSave = (autosavePeriod > 0 && this.ticks % autosavePeriod == 0); // Paper serverAutoSave = (autosavePeriod > 0 && this.ticks % autosavePeriod == 0); // Paper

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Cache block data strings
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index c52de0ad2496888e462bef6c9f751d03dbb6e550..43dbd070e00037fac31d3f122df2d51566b4d55f 100644 index dd34782b85ccf7f9f4dedd72f9220f12475a46d2..c214f32af5723b9b0f6f6e0e768fb653962b8043 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1832,6 +1832,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -1827,6 +1827,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.getPlayerList().reload(); this.getPlayerList().reload();
this.customFunctionData.a(this.dataPackResources.a()); this.customFunctionData.a(this.dataPackResources.a());
this.ak.a(this.dataPackResources.h()); this.ak.a(this.dataPackResources.h());
@ -17,7 +17,7 @@ index c52de0ad2496888e462bef6c9f751d03dbb6e550..43dbd070e00037fac31d3f122df2d515
if (this.isMainThread()) { if (this.isMainThread()) {
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
index d79946ecc15c7a822267b8fa58323e6c1bc2ab6d..f44fc4a95954e0745fbcd6d06b79acc37699c77a 100644 index 41a32f2c77f2e7b79a067a0ce15c894e53ed8709..590236ccc6c15f8c4ad15913fb3ac36d28414318 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java --- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java +++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
@@ -476,9 +476,39 @@ public class CraftBlockData implements BlockData { @@ -476,9 +476,39 @@ public class CraftBlockData implements BlockData {

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Fix deop kicking non-whitelisted player when white list is
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 43dbd070e00037fac31d3f122df2d51566b4d55f..d0ffe5790e98b65cd6035ad529e7da8172de9029 100644 index c214f32af5723b9b0f6f6e0e768fb653962b8043..0108a1a68572df562349688e93f8134cb14d6116 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1897,6 +1897,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -1892,6 +1892,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
if (this.aN()) { if (this.aN()) {
PlayerList playerlist = commandlistenerwrapper.getServer().getPlayerList(); PlayerList playerlist = commandlistenerwrapper.getServer().getPlayerList();
WhiteList whitelist = playerlist.getWhitelist(); WhiteList whitelist = playerlist.getWhitelist();