From 95747d5649a73ce7b0bc35ffd10aa234015c15fd Mon Sep 17 00:00:00 2001 From: RednedEpic Date: Sat, 19 Mar 2022 22:35:41 -0500 Subject: [PATCH] Add maxPlayers API --- .../src/main/java/org/geysermc/geyser/api/GeyserApi.java | 9 +++++++++ core/src/main/java/org/geysermc/geyser/GeyserImpl.java | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/GeyserApi.java b/api/geyser/src/main/java/org/geysermc/geyser/api/GeyserApi.java index e103d0525..4366e9ed6 100644 --- a/api/geyser/src/main/java/org/geysermc/geyser/api/GeyserApi.java +++ b/api/geyser/src/main/java/org/geysermc/geyser/api/GeyserApi.java @@ -123,6 +123,15 @@ public interface GeyserApi extends GeyserApiBase { */ BedrockListener bedrockListener(); + /** + * Gets the maximum number of players that + * can join this Geyser instance. + * + * @return the maximum number of players that + * can join this Geyser instance + */ + int maxPlayers(); + /** * Gets the current {@link GeyserApiBase} instance. * diff --git a/core/src/main/java/org/geysermc/geyser/GeyserImpl.java b/core/src/main/java/org/geysermc/geyser/GeyserImpl.java index a4787127f..54be9f79d 100644 --- a/core/src/main/java/org/geysermc/geyser/GeyserImpl.java +++ b/core/src/main/java/org/geysermc/geyser/GeyserImpl.java @@ -591,6 +591,11 @@ public class GeyserImpl implements GeyserApi { return this.bedrockListener; } + @Override + public int maxPlayers() { + return this.getConfig().getMaxPlayers(); + } + public static GeyserImpl start(PlatformType platformType, GeyserBootstrap bootstrap) { if (instance == null) { return new GeyserImpl(platformType, bootstrap);