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/6] 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 0000000000..48c0da9844 --- /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/6] 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 bc243b36b8..2f357c803f 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/6] 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 68496ebbbd..835c40004f 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: From 2e131ecd8068f8509cbf52f065d7dc294204602d Mon Sep 17 00:00:00 2001 From: Mickey42302 <46900084+Mickey42302@users.noreply.github.com> Date: Tue, 29 Sep 2026 21:13:29 -0400 Subject: [PATCH 4/6] Add messages for player limit commands --- Essentials/src/main/resources/messages.properties | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Essentials/src/main/resources/messages.properties b/Essentials/src/main/resources/messages.properties index 2f357c803f..ae706a004f 100644 --- a/Essentials/src/main/resources/messages.properties +++ b/Essentials/src/main/resources/messages.properties @@ -1166,6 +1166,9 @@ setmaxplayersCommandDescription=Set the max player limit setmaxplayersCommandUsage=/ setmaxplayersCommandUsage1=/ setmaxplayersCommandUsage1Description=Sets the max player limit to the specified number +setmaxplayersBelowZero=The player limit cannot be set below 0. +setmaxplayersSuccess=The player limit has been set to {0}. +setmaxplayersInvalid=Invalid player limit. settprCommandDescription=Set the random teleport location and parameters. settprCommandUsage=/ [center|minrange|maxrange] [value] settprCommandUsage1=/ center From 45f492cc88beda045cd060d96e8bf304986333e9 Mon Sep 17 00:00:00 2001 From: Mickey42302 <46900084+Mickey42302@users.noreply.github.com> Date: Tue, 29 Sep 2026 21:14:50 -0400 Subject: [PATCH 5/6] Use translations for /setmaxplayers --- .../earth2me/essentials/commands/Commandsetmaxplayers.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandsetmaxplayers.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandsetmaxplayers.java index 48c0da9844..dd60530225 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandsetmaxplayers.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandsetmaxplayers.java @@ -19,13 +19,13 @@ public void run(final Server server, final CommandSource sender, final String co try { final int maxPlayers = Integer.parseInt(args[0]); if (maxPlayers < 0) { - throw new Exception("The player limit cannot be set below 0."); + throw new Exception(sender.tl("setmaxplayersBelowZero")); } server.setMaxPlayers(maxPlayers); - sender.sendMessage("Player limit updated to " + maxPlayers + "."); + sender.sendMessage(sender.tl("setmaxplayersSuccess", maxPlayers)); } catch (NumberFormatException e) { - throw new Exception("Invalid number."); + throw new Exception(sender.tl("setmaxplayersInvalid")); } } From fa758dab3abdd227c7fd2fb331c26d28e3facd36 Mon Sep 17 00:00:00 2001 From: Mickey42302 <46900084+Mickey42302@users.noreply.github.com> Date: Tue, 29 Sep 2026 21:20:35 -0400 Subject: [PATCH 6/6] Remove tab completion from setmaxplayers command Removed tab completion options for the setmaxplayers command. --- .../essentials/commands/Commandsetmaxplayers.java | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandsetmaxplayers.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandsetmaxplayers.java index dd60530225..871d4379d2 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandsetmaxplayers.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandsetmaxplayers.java @@ -3,8 +3,6 @@ import com.earth2me.essentials.CommandSource; import org.bukkit.Server; -import java.util.List; - public class Commandsetmaxplayers extends EssentialsCommand { public Commandsetmaxplayers() { super("setmaxplayers"); @@ -29,12 +27,4 @@ public void run(final Server server, final CommandSource sender, final String co } } - @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; - } - } }