From 7543c87475367b3e1a04dc8ab9b9c0145c636717 Mon Sep 17 00:00:00 2001 From: Mickey42302 <46900084+Mickey42302@users.noreply.github.com> Date: Sat, 5 Sep 2026 16:46:47 -0400 Subject: [PATCH 1/3] Add files via upload --- .../commands/Commandsetmaxplayers.java | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Essentials/src/main/java/com/earth2me/essentials/commands/Commandsetmaxplayers.java diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandsetmaxplayers.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandsetmaxplayers.java new file mode 100644 index 00000000000..48c0da98440 --- /dev/null +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandsetmaxplayers.java @@ -0,0 +1,40 @@ +package com.earth2me.essentials.commands; + +import com.earth2me.essentials.CommandSource; +import org.bukkit.Server; + +import java.util.List; + +public class Commandsetmaxplayers extends EssentialsCommand { + public Commandsetmaxplayers() { + super("setmaxplayers"); + } + + @Override + public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception { + if (args.length == 0) { + throw new NotEnoughArgumentsException(); + } + + try { + final int maxPlayers = Integer.parseInt(args[0]); + if (maxPlayers < 0) { + throw new Exception("The player limit cannot be set below 0."); + } + + server.setMaxPlayers(maxPlayers); + sender.sendMessage("Player limit updated to " + maxPlayers + "."); + } catch (NumberFormatException e) { + throw new Exception("Invalid number."); + } + } + + @Override + protected List getTabCompleteOptions(final Server server, final CommandSource sender, final String commandLabel, final String[] args) { + if (args.length == 1) { + return getPlayers(sender); + } else { + return COMMON_DATE_DIFFS; + } + } +} From 2226dc1a674b71df804104e9af5a25b817326580 Mon Sep 17 00:00:00 2001 From: Mickey42302 <46900084+Mickey42302@users.noreply.github.com> Date: Sat, 5 Sep 2026 16:48:11 -0400 Subject: [PATCH 2/3] Add setmaxplayers command details to messages.properties Added descriptions and usage instructions for setmaxplayers command. --- Essentials/src/main/resources/messages.properties | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Essentials/src/main/resources/messages.properties b/Essentials/src/main/resources/messages.properties index bc243b36b8e..2f357c803f8 100644 --- a/Essentials/src/main/resources/messages.properties +++ b/Essentials/src/main/resources/messages.properties @@ -1162,6 +1162,10 @@ setjailCommandDescription=Creates a jail where you specified named [jailname]. setjailCommandUsage=/ setjailCommandUsage1=/ setjailCommandUsage1Description=Sets the jail with the specified name to your location +setmaxplayersCommandDescription=Set the max player limit +setmaxplayersCommandUsage=/ +setmaxplayersCommandUsage1=/ +setmaxplayersCommandUsage1Description=Sets the max player limit to the specified number settprCommandDescription=Set the random teleport location and parameters. settprCommandUsage=/ [center|minrange|maxrange] [value] settprCommandUsage1=/ center From b383a958cf23a697e2386b1e6d88920a87cd6786 Mon Sep 17 00:00:00 2001 From: Mickey42302 <46900084+Mickey42302@users.noreply.github.com> Date: Sat, 5 Sep 2026 16:48:31 -0400 Subject: [PATCH 3/3] Add setmaxplayers command and permissions --- Essentials/src/main/resources/plugin.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Essentials/src/main/resources/plugin.yml b/Essentials/src/main/resources/plugin.yml index 68496ebbbdf..835c40004f5 100644 --- a/Essentials/src/main/resources/plugin.yml +++ b/Essentials/src/main/resources/plugin.yml @@ -431,6 +431,10 @@ commands: description: Creates a jail where you specified named [jailname]. usage: / aliases: [esetjail,createjail,ecreatejail] + setmaxplayers: + description: Set the max player limit + usage: / + aliases: [esetmaxplayers] settpr: description: Set the random teleport location and parameters. usage: / [center|minrange|maxrange] [value] @@ -1209,6 +1213,8 @@ permissions: description: Allows access to delete other players homes with the /delhome command essentials.setjail: description: Allows access to the /setjail command + essentials.setmaxplayers: + description: Allows access to the /setmaxplayers command essentials.setwarp: description: Allows access to the /setwarp command essentials.setworth: