Paper/Spigot-Server-Patches/0558-Add-setMaxPlayers-API.patch

38 Zeilen
1.7 KiB
Diff

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/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index f9eb17cb6eda0b343240240720495751cf605385..33915eeb0229c0739d69b0ee2cb2251c9d99f87a 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -67,7 +67,7 @@ public abstract class PlayerList {
public final WorldNBTStorage playerFileData;
private boolean hasWhitelist;
private final IRegistryCustom.Dimension s;
- 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 EnumGamemode u;
private boolean v;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 7d83cf39ae4b78588a2cb5decccf53edfd448735..5f5b39b3b7e56e935d1f964fbfc3385a65b7e178 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -614,6 +614,13 @@ public final class CraftServer implements Server {
return 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