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

feat: console can now apply any cosmetic to a player

This commit is contained in:
LoJoSho
2024-10-24 20:34:17 -05:00
parent ad382e5d9e
commit 1e6734bf6f

View File

@@ -43,10 +43,14 @@ public class CosmeticCommand implements CommandExecutor {
@Override @Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String @NotNull [] args) { public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String @NotNull [] args) {
boolean silent = false; boolean silent = false;
boolean console = false;
if (!(sender instanceof Player)) {
console = true;
}
if (args.length == 0) { if (args.length == 0) {
if (!(sender instanceof Player)) { if (console) {
// Console
return true; return true;
} }
if (!sender.hasPermission("hmccosmetics.cmd.default")) { if (!sender.hasPermission("hmccosmetics.cmd.default")) {
@@ -140,7 +144,7 @@ public class CosmeticCommand implements CommandExecutor {
CosmeticUser user = CosmeticUsers.getUser(player); CosmeticUser user = CosmeticUsers.getUser(player);
if (!user.canEquipCosmetic(cosmetic)) { if (!user.canEquipCosmetic(cosmetic) && !console) {
if (!silent) MessagesUtil.sendMessage(player, "no-cosmetic-permission"); if (!silent) MessagesUtil.sendMessage(player, "no-cosmetic-permission");
return true; return true;
} }