Skip to content

Commit

Permalink
Allow /npc mount --onnpc to work in console
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Mar 19, 2018
1 parent f03a376 commit f8a8a19
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions main/src/main/java/net/citizensnpcs/commands/NPCCommands.java
Expand Up @@ -909,7 +909,7 @@ public void minecart(CommandContext args, CommandSender sender, NPC npc) throws
min = 1,
max = 1,
permission = "citizens.npc.controllable")
public void mount(CommandContext args, Player player, NPC npc) throws CommandException {
public void mount(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
if (args.hasValueFlag("onnpc")) {
NPC mount;
try {
Expand All @@ -929,9 +929,13 @@ public void mount(CommandContext args, Player player, NPC npc) throws CommandExc
}
boolean enabled = npc.hasTrait(Controllable.class) && npc.getTrait(Controllable.class).isEnabled();
if (!enabled) {
Messaging.sendTr(player, Messages.NPC_NOT_CONTROLLABLE, npc.getName());
Messaging.sendTr(sender, Messages.NPC_NOT_CONTROLLABLE, npc.getName());
return;
}
if (!(sender instanceof Player)) {
throw new CommandException(CommandMessages.MUST_BE_INGAME);
}
Player player = (Player) sender;
boolean success = npc.getTrait(Controllable.class).mount(player);
if (!success) {
Messaging.sendTr(player, Messages.FAILED_TO_MOUNT_NPC, npc.getName());
Expand Down

0 comments on commit f8a8a19

Please sign in to comment.