mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-02 17:32:03 +01:00
60 lines
3.7 KiB
Diff
60 lines
3.7 KiB
Diff
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||
|
From: Aikar <aikar@aikar.co>
|
||
|
Date: Mon, 19 Sep 2016 23:16:39 -0400
|
||
|
Subject: [PATCH] Incremental Auto Saving
|
||
|
|
||
|
Process auto save every tick instead of once per auto tick interval, so that chunk saves will distribute over many ticks instead of all at once.
|
||
|
|
||
|
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||
|
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||
|
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||
|
@@ -0,0 +0,0 @@ public class Chunk {
|
||
|
if (this.t && this.world.getTime() != this.lastSaved || this.s) {
|
||
|
return true;
|
||
|
}
|
||
|
- } else if (this.t && this.world.getTime() >= this.lastSaved + MinecraftServer.getServer().autosavePeriod * 4) { // Spigot - Only save if we've passed 2 auto save intervals without modification
|
||
|
+ } else if (this.t && this.world.getTime() >= this.lastSaved + MinecraftServer.getServer().autosavePeriod) { // Spigot // Paper - Remove broken change
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||
|
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||
|
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||
|
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
|
||
|
this.saveChunk(chunk);
|
||
|
chunk.f(false);
|
||
|
++i;
|
||
|
- if (i == 24 && !flag && false) { // Spigot
|
||
|
+ if (i == 24 && !flag) { // Spigot - // Paper - Incremental Auto Save - cap to 24 per tick
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||
|
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
|
||
|
this.q.b().a(agameprofile);
|
||
|
}
|
||
|
|
||
|
- if (autosavePeriod > 0 && this.ticks % autosavePeriod == 0) { // CraftBukkit
|
||
|
+ if (autosavePeriod > 0 /*&& this.ticks % autosavePeriod == 0*/) { // CraftBukkit // Paper - Incremental Auto Saving
|
||
|
MinecraftTimings.worldSaveTimer.startTiming(); // Spigot
|
||
|
this.methodProfiler.a("save");
|
||
|
this.v.savePlayers();
|
||
|
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||
|
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||
|
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||
|
@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler {
|
||
|
ChunkProviderServer chunkproviderserver = this.getChunkProviderServer();
|
||
|
|
||
|
if (chunkproviderserver.e()) {
|
||
|
- org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); // CraftBukkit
|
||
|
+ if (flag) org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); // CraftBukkit // Paper - Incremental Auto Saving - Only fire event on full save
|
||
|
if (iprogressupdate != null) {
|
||
|
iprogressupdate.a("Saving level");
|
||
|
}
|
||
|
--
|