Skip to content

Commit

Permalink
add --slim flag to /npc skin command
Browse files Browse the repository at this point in the history
  • Loading branch information
OliverSchlueter committed Nov 23, 2024
1 parent e57d633 commit 7d471c6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/main/java/de/oliver/fancynpcs/commands/npc/SkinCMD.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/languages/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ messages:
npc_nearby: "<dark_gray>› <gray>Syntax: {primaryColor}/npc nearby {secondaryColor}[filters...]"
npc_remove: "<dark_gray>› <gray>Syntax: {primaryColor}/npc remove {secondaryColor}(npc)"
npc_show_in_tab: "<dark_gray>› <gray>Syntax: {primaryColor}/npc show_in_tab {secondaryColor}(npc) (state)"
npc_skin: "<dark_gray>› <gray>Syntax: {primaryColor}/npc skin {secondaryColor}(npc) (@none | @mirror | name | url)"
npc_skin: "<dark_gray>› <gray>Syntax: {primaryColor}/npc skin {secondaryColor}(npc) (@none | @mirror | name | url) [--slim]"
npc_teleport: "<dark_gray>› <gray>Syntax: {primaryColor}/npc teleport {secondaryColor}(npc)"
npc_turn_to_player: "<dark_gray>› <gray>Syntax: {primaryColor}/npc turn_to_player {secondaryColor}(npc) (state)"
npc_type: "<dark_gray>› <gray>Syntax: {primaryColor}/npc type {secondaryColor}(npc) (type)"
Expand Down Expand Up @@ -161,7 +161,7 @@ messages:
- "<dark_gray>› <hover:show_text:'<gray>Removes (deletes) specified NPC.'>{primaryColor}/npc remove {secondaryColor}(npc)"
- "<dark_gray>› <hover:show_text:'<gray>Changes the scale of the size of the NPC.'>{primaryColor}/npc scale {secondaryColor}(npc) (factor)"
- "<dark_gray>› <hover:show_text:'<gray>Changes whether the NPC is shown in the player-list. This works only on NPCs of PLAYER type.<newline><newline>{errorColor}Re-connecting to the server might be required for changes to take effect.'>{primaryColor}/npc show_in_tab {secondaryColor}(npc) (state)"
- "<dark_gray>› <hover:show_text:'<gray>Changes skin of the NPC.<newline><gray>Supports PlaceholderAPI and MiniPlaceholders.<newline><newline>{warningColor}@none <dark_gray>- <gray>removes the skin<newline>{warningColor}@mirror <dark_gray>- <gray>mirrors player skin<newline>{warningColor}(name) <dark_gray>- <gray>name of any player<newline>{warningColor}(url) <dark_gray>- <gray>url of the skin texture'>{primaryColor}/npc skin {secondaryColor}(npc) (@none | @mirror | name | url)"
- "<dark_gray>› <hover:show_text:'<gray>Changes skin of the NPC.<newline><gray>Supports PlaceholderAPI and MiniPlaceholders.<newline><newline>{warningColor}@none <dark_gray>- <gray>removes the skin<newline>{warningColor}@mirror <dark_gray>- <gray>mirrors player skin<newline>{warningColor}(name) <dark_gray>- <gray>name of any player<newline>{warningColor}(url) <dark_gray>- <gray>url of the skin texture'>{primaryColor}/npc skin {secondaryColor}(npc) (@none | @mirror | name | url) [--slim]"
- "<dark_gray>› <hover:show_text:'<gray>Teleports you to the specified NPC.'>{primaryColor}/npc teleport {secondaryColor}(npc)"
- "<dark_gray>› <hover:show_text:'<gray>Changes whether the NPC should turn to the player when in range.'>{primaryColor}/npc turn_to_player {secondaryColor}(npc) (state)"
- "<dark_gray>› <hover:show_text:'<gray>Changes the type of the NPC.'>{primaryColor}/npc type {secondaryColor}(npc) (type)"
Expand Down

0 comments on commit 7d471c6

Please sign in to comment.