Skip to content

Commit

Permalink
Allow console execution of xench
Browse files Browse the repository at this point in the history
  • Loading branch information
xethlyx committed Jun 17, 2021
1 parent 571576a commit 15f3572
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,21 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String
return true;
}

Player targetPlayer = (Player) sender;
Player targetPlayer = null;

if (args.length >= 3) {
targetPlayer = XEnchant.Instance.getServer().getPlayer(args[2]);
if (targetPlayer == null) {
sender.sendMessage(ChatColor.RED + "Player " + args[2] + " not found.");
return true;
}
} else if (sender instanceof Player) {
targetPlayer = (Player) sender;
}

if (targetPlayer == null) {
sender.sendMessage(ChatColor.RED + "Console must specify player");
return true;
}

PlayerInventory targetInventory = targetPlayer.getInventory();
Expand Down

0 comments on commit 15f3572

Please sign in to comment.