summaryrefslogtreecommitdiffhomepage
path: root/patches/unapplied/server/0457-Add-setMaxPlayers-API.patch
blob: b3c38092b95151c6daf1c03b3173060a5252e744 (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 cfe2dea64104eeaffd6606fdff0d5a1a2c111329..0e22201853ae2befdc6904e194f8bbc6d57fc9f5 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -155,7 +155,7 @@ public abstract class PlayerList {
     private boolean doWhiteList;
     private final LayeredRegistryAccess<RegistryLayer> registries;
     private final RegistryAccess.Frozen synchronizedRegistries;
-    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 e9c52523142df3a0dd9ae9389c69024eb2fe5386..6af883347c259d043cefd73215d9ce263878e23b 100644
--- 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 {
         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