From 301fd6a3491ae6cac4dbfb14e805b01ca8f09520 Mon Sep 17 00:00:00 2001 From: lojosho Date: Thu, 20 Mar 2025 15:27:30 -0500 Subject: [PATCH] chore: move console commands to addCosmetic --- .../hibiscusmc/hmccosmetics/command/CosmeticCommand.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/command/CosmeticCommand.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/command/CosmeticCommand.java index 70b41d75..a67d9e6d 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/command/CosmeticCommand.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/command/CosmeticCommand.java @@ -144,6 +144,11 @@ public class CosmeticCommand implements CommandExecutor { CosmeticUser user = CosmeticUsers.getUser(player); + if (user == null) { + if (!silent) MessagesUtil.sendMessage(sender, "invalid-player"); + return true; + } + if (!user.canEquipCosmetic(cosmetic) && !console) { if (!silent) MessagesUtil.sendMessage(player, "no-cosmetic-permission"); return true; @@ -156,7 +161,7 @@ public class CosmeticCommand implements CommandExecutor { if (!silent) MessagesUtil.sendMessage(player, "equip-cosmetic", placeholders); - user.addPlayerCosmetic(cosmetic, color); + user.addCosmetic(cosmetic, color); user.updateCosmetic(cosmetic.getSlot()); return true; } @@ -325,7 +330,7 @@ public class CosmeticCommand implements CommandExecutor { if (!silent) MessagesUtil.sendMessage(player, "invalid-color"); return true; } - user.addPlayerCosmetic(cosmetic, color); // #FFFFFF + user.addCosmetic(cosmetic, color); // #FFFFFF } else { DyeMenu.openMenu(user, cosmetic); }