9
0
mirror of https://github.com/HibiscusMC/HMCCosmetics.git synced 2025-12-19 15:09:19 +00:00

feat: better handling of invalid cosmetics for dye subcommand

This commit is contained in:
Logan
2025-08-18 20:44:16 -05:00
parent bb08fb108c
commit 27a6c1bd54

View File

@@ -310,13 +310,17 @@ public class CosmeticCommand implements CommandExecutor {
return true;
}
String rawSlot = args[1];
final String rawSlot = args[1];
if (!CosmeticSlot.contains(rawSlot)) {
if (!silent) MessagesUtil.sendMessage(player, "invalid-slot");
return true;
}
CosmeticSlot slot = CosmeticSlot.valueOf(rawSlot);
Cosmetic cosmetic = user.getCosmetic(slot);
final CosmeticSlot slot = CosmeticSlot.valueOf(rawSlot); // This is checked above. While IDEs may say the slot might be null, it will not be.
final Cosmetic cosmetic = user.getCosmetic(slot);
if (cosmetic == null) {
if (!silent) MessagesUtil.sendMessage(player, "invalid-slot");
return true;
}
if (args.length >= 3) {
if (args[2].isEmpty()) {