aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0488-Add-setMaxPlayers-API.patch
blob: 25631acf0dc4f9431cd3a3ceefa7aa902a9818d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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
index 98c70121c53e42e3c9bc7403eed83335f567bc74..ba46e9eafab188455d49f1a555e38b0ebe66fcf9 100644
--- 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 {
     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;
     private boolean allowCheatsForAllPlayers;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 54598af96488c47b613de8eb8eb0bf31ea84743f..5e3397c8066dacdc1ebcbef57ecf4af0596cc02d 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -673,6 +673,13 @@ public final class CraftServer implements Server {
         return this.playerList.getMaxPlayers();
     }
 
+    // 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