Paper/patches/api/0214-Add-setMaxPlayers-API.patch
2021-12-31 19:05:42 -08:00

49 lines
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:25 +0200
Subject: [PATCH] Add #setMaxPlayers API
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 0a29ddee94051e398780b9fa07e5ce2b46c51b97..dee9bcd9caee7c900a38c92d5e967cdaaf875a08 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -186,6 +186,17 @@ public final class Bukkit {
return server.getMaxPlayers();
}
+ // Paper start
+ /**
+ * Set the maximum amount of players which can login to this server.
+ *
+ * @param maxPlayers the amount of players this server allows
+ */
+ public static void setMaxPlayers(int maxPlayers) {
+ server.setMaxPlayers(maxPlayers);
+ }
+ // Paper end
+
/**
* Get the game port that the server runs on.
*
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index a8e187a3f386210c712ab7d620d6a4aa91bf42f8..a3f6a2bbc1d4626b657acc1e108c04ce8d0d577c 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -157,6 +157,15 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
public int getMaxPlayers();
+ // Paper start
+ /**
+ * Set the maximum amount of players which can login to this server.
+ *
+ * @param maxPlayers the amount of players this server allows
+ */
+ public void setMaxPlayers(int maxPlayers);
+ // Paper end
+
/**
* Get the game port that the server runs on.
*