aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0505-Add-setMaxPlayers-API.patch
blob: ad2a5bcffd87ad42a13612f71a1e47e461526316 (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 9a73364f4d56f3a7cecb27bc8034166b8f5731b9..4d1d5dacb175e7059a6af036432ef891bcf77970 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -145,7 +145,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 boolean allowCheatsForAllPlayers;
     private static final boolean ALLOW_LOGOUTIVATOR = false;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 81effb4bc34d3cb4325510c1b0de39956961c427..ab7eae6483a8981f6324f9da671b3d41667c3768 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -636,6 +636,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