3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 12:30:06 +01:00
Paper/patches/server/0459-Add-setMaxPlayers-API.patch

38 Zeilen
1.8 KiB
Diff

2021-06-11 14:02:28 +02:00
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 5d6128932e1af0445cf928fac6d6b91226a18de6..fdd7f80fe912d4f75e7c42a2dd97160031f857b7 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -151,7 +151,7 @@ public abstract class PlayerList {
2021-06-11 14:02:28 +02:00
private boolean doWhiteList;
2022-12-07 21:16:54 +01:00
private final LayeredRegistryAccess<RegistryLayer> registries;
private final RegistryAccess.Frozen synchronizedRegistries;
2021-06-11 14:02:28 +02:00
- 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;
2021-06-11 14:02:28 +02:00
private boolean allowCheatsForAllPlayers;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
2023-02-19 15:57:10 +01:00
index 796f0f96811534895623a0a3de04ea33f276ce47..facd84b0a2a6dcde32ca47fc5a1b9058c41c5ec4 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
2023-02-19 15:57:10 +01:00
@@ -669,6 +669,13 @@ public final class CraftServer implements Server {
2021-06-14 12:42:08 +02:00
return this.playerList.getMaxPlayers();
2021-06-11 14:02:28 +02:00
}
+ // 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