Re-add chunk GC for plugin chunk loads

This commit is contained in:
md_5 2019-07-03 10:29:02 +10:00
parent 5815136865
commit 375969a674
3 changed files with 25 additions and 1 deletions

View File

@ -1,5 +1,14 @@
--- a/net/minecraft/server/TicketType.java
+++ b/net/minecraft/server/TicketType.java
@@ -6,7 +6,7 @@
private final String i;
private final Comparator<T> j;
- private final long k;
+ private long k; // PAIL
public static final TicketType<Unit> START = a("start", (unit, unit1) -> {
return 0;
});
@@ -19,6 +19,7 @@
public static final TicketType<BlockPosition2D> PORTAL = a("portal", Comparator.comparingLong(BlockPosition2D::b));
public static final TicketType<Integer> POST_TELEPORT = a("post_teleport", Integer::compareTo, 5);
@ -8,3 +17,14 @@
public static <T> TicketType<T> a(String s, Comparator<T> comparator) {
return new TicketType<>(s, comparator, 0L);
@@ -45,4 +46,10 @@
public long b() {
return this.k;
}
+
+ // CraftBukkit start
+ public void setLoadPeriod(int ticks) {
+ this.k = ticks;
+ }
+ // CraftBukkit end
}

View File

@ -49,7 +49,6 @@ import net.minecraft.server.BlockPosition;
import net.minecraft.server.BossBattleCustom;
import net.minecraft.server.CommandDispatcher;
import net.minecraft.server.CommandListenerWrapper;
import net.minecraft.server.CraftingManager;
import net.minecraft.server.DedicatedPlayerList;
import net.minecraft.server.DedicatedServer;
import net.minecraft.server.DedicatedServerProperties;
@ -70,6 +69,7 @@ import net.minecraft.server.MobEffects;
import net.minecraft.server.PlayerList;
import net.minecraft.server.ServerCommand;
import net.minecraft.server.TagsServer;
import net.minecraft.server.TicketType;
import net.minecraft.server.Vec3D;
import net.minecraft.server.WorldData;
import net.minecraft.server.WorldMap;
@ -306,6 +306,7 @@ public final class CraftServer implements Server {
ambientSpawn = configuration.getInt("spawn-limits.ambient");
console.autosavePeriod = configuration.getInt("ticks-per.autosave");
warningState = WarningState.value(configuration.getString("settings.deprecated-verbose"));
TicketType.PLUGIN.setLoadPeriod(configuration.getInt("chunk-gc.period-in-ticks"));
minimumAPI = configuration.getString("settings.minimum-api");
loadIcon();
}
@ -716,6 +717,7 @@ public final class CraftServer implements Server {
waterAnimalSpawn = configuration.getInt("spawn-limits.water-animals");
ambientSpawn = configuration.getInt("spawn-limits.ambient");
warningState = WarningState.value(configuration.getString("settings.deprecated-verbose"));
TicketType.PLUGIN.setLoadPeriod(configuration.getInt("chunk-gc.period-in-ticks"));
minimumAPI = configuration.getString("settings.minimum-api");
printSaveWarning = false;
console.autosavePeriod = configuration.getInt("ticks-per.autosave");

View File

@ -28,6 +28,8 @@ spawn-limits:
animals: 10
water-animals: 15
ambient: 15
chunk-gc:
period-in-ticks: 600
ticks-per:
animal-spawns: 400
monster-spawns: 1