PaperMC/patches/api/0216-Add-setMaxPlayers-API.patch

49 lines
1.7 KiB
Diff
Raw Normal View History

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: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
2022-07-21 21:53:04 +02:00
index 1f2d25a48bfd67f770560e6284e0be27b6b4df38..bd7c7d1cc25f1bc246944de2ffc20cadaacd1d29 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
2022-06-08 18:13:02 +02:00
@@ -207,6 +207,17 @@ public final class Bukkit {
2021-06-11 14:02:28 +02:00
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
2022-07-21 21:53:04 +02:00
index 88eab327d5854fd853b1adb5b4f04a2bcfd66849..f05dc6c186c94b940ea69d7ebc32451cc38f7fcf 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -159,6 +159,15 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
2021-06-11 14:02:28 +02:00
*/
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.
*