I know that the assert keyword should be used when we want to make a bug come out, but is it ok to use it in situations like the one that follows? The redirectAdd method only receives args whose length is more than 3, I added it for anyone who will read the method in the future to give some logical context, is it ok or it's better if I remove it and add a comment instead?
The code I'm referring to:
private static boolean redirectAdd(Player player, String[] args, ItemStack mainHandItem) {
assert args.length > 3;
if (args.length == 4) {
//more actions & another return
} else if (args.length == 5) {
//more actions & another return
} else if (args.length == 6) {
//more actions & another return
} else {
player.sendMessage(ChatColor.RED + "There are too many arguments! The last should be " + args[5] + "");
return false;
}
}