Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.earth2me.essentials.commands;

import com.earth2me.essentials.CommandSource;
import org.bukkit.Server;

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(sender.tl("setmaxplayersBelowZero"));
}

server.setMaxPlayers(maxPlayers);
sender.sendMessage(sender.tl("setmaxplayersSuccess", maxPlayers));
} catch (NumberFormatException e) {
throw new Exception(sender.tl("setmaxplayersInvalid"));
}
}

}
7 changes: 7 additions & 0 deletions Essentials/src/main/resources/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1162,6 +1162,13 @@ setjailCommandDescription=Creates a jail where you specified named [jailname].
setjailCommandUsage=/<command> <jailname>
setjailCommandUsage1=/<command> <jailname>
setjailCommandUsage1Description=Sets the jail with the specified name to your location
setmaxplayersCommandDescription=Set the max player limit
setmaxplayersCommandUsage=/<command> <number>
setmaxplayersCommandUsage1=/<command> <number>
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=/<command> <world> [center|minrange|maxrange] [value]
settprCommandUsage1=/<command> <world> center
Expand Down
6 changes: 6 additions & 0 deletions Essentials/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,10 @@ commands:
description: Creates a jail where you specified named [jailname].
usage: /<command> <jailname>
aliases: [esetjail,createjail,ecreatejail]
setmaxplayers:
description: Set the max player limit
usage: /<command> <number>
aliases: [esetmaxplayers]
settpr:
description: Set the random teleport location and parameters.
usage: /<command> [center|minrange|maxrange] [value]
Expand Down Expand Up @@ -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:
Expand Down
Loading