Paper/Spigot-Server-Patches/0549-Add-setMaxPlayers-API.patch
2021-05-15 23:42:36 +00:00

38 Zeilen
1.8 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/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index d3f3dc4ad2c758482b7a8d5c07caa526ce1e3424..8bd55e3d2b5142081a7dfe1dbbd36f2f995e5856 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 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 1e0546a14506a41d1a7b74d306b992cfbdf6e0cf..53254ad9e775e9e78da238a54be7d3fc4b8a6ced 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -618,6 +618,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