Skip to content
Open
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
Expand Up @@ -6,6 +6,7 @@
import dev.chaws.automaticinventory.messaging.Messages;
import dev.chaws.automaticinventory.utilities.Chat;
import dev.chaws.automaticinventory.utilities.Level;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
Expand All @@ -25,6 +26,12 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command

var playerConfig = PlayerConfig.fromPlayer(player);

// Guard to prevent out of index error
if (args.length < 1) {
Chat.sendMessage(player, ChatColor.GOLD, "Usage: /autosort [chest|inv]");
return false;
}

var optionName = args[0].toLowerCase();
if (optionName.startsWith("chest")) {
if (!AutomaticInventory.hasPermission(Features.SortChests, player)) {
Expand Down