Skip to content

Commit e21bf45

Browse files
committed
fix chunk-gc plugin ticket config
1 parent 480b2ed commit e21bf45

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--- a/net/minecraft/server/level/Ticket.java
2+
+++ b/net/minecraft/server/level/Ticket.java
3+
@@ -8,6 +_,7 @@
4+
import net.minecraft.util.ExtraCodecs;
5+
6+
public class Ticket {
7+
+ public static int PLUGIN_TYPE_TIMEOUT = 600; // Paper - chunk-gc config
8+
public static final MapCodec<Ticket> CODEC = RecordCodecBuilder.mapCodec(
9+
instance -> instance.group(
10+
BuiltInRegistries.TICKET_TYPE.byNameCodec().fieldOf("type").forGetter(Ticket::getType),
11+
@@ -21,7 +_,7 @@
12+
private long ticksLeft;
13+
14+
public Ticket(TicketType type, int ticketLevel) {
15+
- this(type, ticketLevel, type.timeout());
16+
+ this(type, ticketLevel, TicketType.PLUGIN == type ? PLUGIN_TYPE_TIMEOUT : type.timeout()); // Paper - chunk-gc config
17+
}
18+
19+
private Ticket(TicketType type, int ticketLevel, long ticksLeft) {

paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
import net.minecraft.server.dedicated.DedicatedServerSettings;
6565
import net.minecraft.server.level.ServerLevel;
6666
import net.minecraft.server.level.ServerPlayer;
67-
import net.minecraft.server.level.TicketType;
67+
import net.minecraft.server.level.Ticket;
6868
import net.minecraft.server.players.IpBanListEntry;
6969
import net.minecraft.server.players.PlayerList;
7070
import net.minecraft.server.players.ServerOpListEntry;
@@ -475,7 +475,7 @@ public CraftPlayer apply(ServerPlayer player) {
475475
this.overrideSpawnLimits();
476476
console.autosavePeriod = this.configuration.getInt("ticks-per.autosave");
477477
this.warningState = WarningState.value(this.configuration.getString("settings.deprecated-verbose"));
478-
TicketType.PLUGIN.timeout = this.configuration.getInt("chunk-gc.period-in-ticks");
478+
Ticket.PLUGIN_TYPE_TIMEOUT = this.configuration.getInt("chunk-gc.period-in-ticks");
479479
this.minimumAPI = ApiVersion.getOrCreateVersion(this.configuration.getString("settings.minimum-api"));
480480
this.loadIcon();
481481
this.loadCompatibilities();
@@ -1043,7 +1043,7 @@ public void reload() {
10431043
this.console.setMotd(config.motd);
10441044
this.overrideSpawnLimits();
10451045
this.warningState = WarningState.value(this.configuration.getString("settings.deprecated-verbose"));
1046-
TicketType.PLUGIN.timeout = this.configuration.getInt("chunk-gc.period-in-ticks");
1046+
Ticket.PLUGIN_TYPE_TIMEOUT = this.configuration.getInt("chunk-gc.period-in-ticks");
10471047
this.minimumAPI = ApiVersion.getOrCreateVersion(this.configuration.getString("settings.minimum-api"));
10481048
this.printSaveWarning = false;
10491049
this.console.autosavePeriod = this.configuration.getInt("ticks-per.autosave");

0 commit comments

Comments
 (0)