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