From 7d471c60d65f871f5abcfc2036802fb1d47b94b9 Mon Sep 17 00:00:00 2001 From: Oliver Date: Sun, 24 Nov 2024 00:25:39 +0100 Subject: [PATCH] add `--slim` flag to `/npc skin` command --- src/main/java/de/oliver/fancynpcs/commands/npc/SkinCMD.java | 6 ++++-- src/main/resources/languages/default.yml | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/oliver/fancynpcs/commands/npc/SkinCMD.java b/src/main/java/de/oliver/fancynpcs/commands/npc/SkinCMD.java index 81f3cf52..4dc73764 100644 --- a/src/main/java/de/oliver/fancynpcs/commands/npc/SkinCMD.java +++ b/src/main/java/de/oliver/fancynpcs/commands/npc/SkinCMD.java @@ -11,6 +11,7 @@ import org.bukkit.entity.Player; import org.incendo.cloud.annotations.Argument; import org.incendo.cloud.annotations.Command; +import org.incendo.cloud.annotations.Flag; import org.incendo.cloud.annotations.Permission; import org.incendo.cloud.annotations.suggestion.Suggestions; import org.incendo.cloud.context.CommandContext; @@ -32,7 +33,8 @@ public enum SkinCMD { public void onSkin( final @NotNull CommandSender sender, final @NotNull Npc npc, - final @NotNull @Argument(suggestions = "SkinCMD/skin") String skin + final @NotNull @Argument(suggestions = "SkinCMD/skin") String skin, + final @Flag("slim") boolean slim ) { if (npc.getData().getType() != EntityType.PLAYER) { translator.translate("command_unsupported_npc_type").send(sender); @@ -63,7 +65,7 @@ public void onSkin( translator.translate("command_npc_modification_cancelled").send(sender); } } else { - SkinData skinData = FancyNpcs.getInstance().getSkinManager().getByIdentifier(skin, SkinData.SkinVariant.AUTO); //TODO add variant option + SkinData skinData = FancyNpcs.getInstance().getSkinManager().getByIdentifier(skin, (slim) ? SkinData.SkinVariant.SLIM : SkinData.SkinVariant.AUTO); if (new NpcModifyEvent(npc, NpcModifyEvent.NpcModification.SKIN, false, sender).callEvent() && new NpcModifyEvent(npc, NpcModifyEvent.NpcModification.SKIN, skinData, sender).callEvent()) { npc.getData().setMirrorSkin(false); diff --git a/src/main/resources/languages/default.yml b/src/main/resources/languages/default.yml index aa0616a1..8b98a40c 100644 --- a/src/main/resources/languages/default.yml +++ b/src/main/resources/languages/default.yml @@ -115,7 +115,7 @@ messages: npc_nearby: "Syntax: {primaryColor}/npc nearby {secondaryColor}[filters...]" npc_remove: "Syntax: {primaryColor}/npc remove {secondaryColor}(npc)" npc_show_in_tab: "Syntax: {primaryColor}/npc show_in_tab {secondaryColor}(npc) (state)" - npc_skin: "Syntax: {primaryColor}/npc skin {secondaryColor}(npc) (@none | @mirror | name | url)" + npc_skin: "Syntax: {primaryColor}/npc skin {secondaryColor}(npc) (@none | @mirror | name | url) [--slim]" npc_teleport: "Syntax: {primaryColor}/npc teleport {secondaryColor}(npc)" npc_turn_to_player: "Syntax: {primaryColor}/npc turn_to_player {secondaryColor}(npc) (state)" npc_type: "Syntax: {primaryColor}/npc type {secondaryColor}(npc) (type)" @@ -161,7 +161,7 @@ messages: - "Removes (deletes) specified NPC.'>{primaryColor}/npc remove {secondaryColor}(npc)" - "Changes the scale of the size of the NPC.'>{primaryColor}/npc scale {secondaryColor}(npc) (factor)" - "Changes whether the NPC is shown in the player-list. This works only on NPCs of PLAYER type.{errorColor}Re-connecting to the server might be required for changes to take effect.'>{primaryColor}/npc show_in_tab {secondaryColor}(npc) (state)" - - "Changes skin of the NPC.Supports PlaceholderAPI and MiniPlaceholders.{warningColor}@none - removes the skin{warningColor}@mirror - mirrors player skin{warningColor}(name) - name of any player{warningColor}(url) - url of the skin texture'>{primaryColor}/npc skin {secondaryColor}(npc) (@none | @mirror | name | url)" + - "Changes skin of the NPC.Supports PlaceholderAPI and MiniPlaceholders.{warningColor}@none - removes the skin{warningColor}@mirror - mirrors player skin{warningColor}(name) - name of any player{warningColor}(url) - url of the skin texture'>{primaryColor}/npc skin {secondaryColor}(npc) (@none | @mirror | name | url) [--slim]" - "Teleports you to the specified NPC.'>{primaryColor}/npc teleport {secondaryColor}(npc)" - "Changes whether the NPC should turn to the player when in range.'>{primaryColor}/npc turn_to_player {secondaryColor}(npc) (state)" - "Changes the type of the NPC.'>{primaryColor}/npc type {secondaryColor}(npc) (type)"