attempt to fix resetplayer breaking if you dont enter an argument

(I dont know if this works, I straight up copied and pasted code lol)
This commit is contained in:
ginlang 2022-03-29 17:56:08 +01:00 committed by GitHub
parent 5df6d4cfed
commit 8217d9be33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -16,7 +16,10 @@ public class Command_resetplayer extends FreedomCommand {
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
OfflinePlayer target = null;
String searchString = args[0];
if (args.length == 0)
{
throw new FormatException("Invalid number of arguments.");
}
for (OfflinePlayer offlinePlayer : Bukkit.getOfflinePlayers()) {
if(offlinePlayer.getName().equalsIgnoreCase(searchString)) {
target = offlinePlayer;