Paper/patches/server/0488-Add-setMaxPlayers-API.patch

38 lines
1.8 KiB
Diff
Raw Normal View History

2021-06-11 14:02:28 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mariell Hoversholm <proximyst@proximyst.com>
Date: Sat, 22 Aug 2020 23:59:30 +0200
Subject: [PATCH] Add #setMaxPlayers API
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
2021-11-29 12:55:13 +01:00
index c75218775bb5e9745b863ef1db5280a4a3f2bed9..a1077445ab7d416dc61db85742e447193642b919 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -144,7 +144,7 @@ public abstract class PlayerList {
2021-06-11 14:02:28 +02:00
public final PlayerDataStorage playerIo;
private boolean doWhiteList;
private final RegistryAccess.RegistryHolder registryHolder;
- protected final int maxPlayers;
+ protected int maxPlayers; public final void setMaxPlayers(int maxPlayers) { this.maxPlayers = maxPlayers; } // Paper - remove final and add setter
private int viewDistance;
private int simulationDistance;
2021-06-11 14:02:28 +02:00
private boolean allowCheatsForAllPlayers;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index f71b244b4d8afa1d109061de5c23f32f67539a93..80843004e01ae8ce66823daa1062c997f135baf3 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -672,6 +672,13 @@ public final class CraftServer implements Server {
2021-06-14 12:42:08 +02:00
return this.playerList.getMaxPlayers();
2021-06-11 14:02:28 +02:00
}
+ // Paper start
+ @Override
+ public void setMaxPlayers(int maxPlayers) {
+ this.playerList.setMaxPlayers(maxPlayers);
+ }
+ // Paper end
+
// NOTE: These are dependent on the corresponding call in MinecraftServer
// so if that changes this will need to as well
@Override