Skip to content

Commit

Permalink
Add: Filtering undefined or non-standard commands
Browse files Browse the repository at this point in the history
  • Loading branch information
eofitg committed Jun 15, 2023
1 parent 6d4478a commit 5ae7499
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
return true;
}
if (args.length > 2) {
return false;
sender.sendMessage(ChatColor.RED + "Invalid command.");
return true;
}
if (args.length == 0) {
sender.sendMessage(ChatColor.RED + "Empty parameters.");
Expand All @@ -37,10 +38,13 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
UserDataConfig userDataConfig = new UserDataConfig(player, player.getUniqueId().toString(), playerName);
userDataConfig.reset();
userDataConfig.save();
return true;
}
}
sender.sendMessage(ChatColor.BLUE + "Player " + args[1] + "'s state has reset.");
} else {
sender.sendMessage(ChatColor.RED + "Invalid command.");
}
return true;
}

switch (childCmd) {
Expand Down

0 comments on commit 5ae7499

Please sign in to comment.