diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandRandomenchant.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandRandomenchant.java index e8bef6d0..a9b45fd9 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandRandomenchant.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandRandomenchant.java @@ -40,8 +40,10 @@ public class CommandRandomenchant extends Subcommand { if ((args.isEmpty() && sender instanceof Player) || !sender.hasPermission("ecoenchants.command.randomenchant.others")) { player = (Player) sender; - } else { + } else if (!args.isEmpty()) { player = Bukkit.getServer().getPlayer(args.get(0)); + } else { + player = null; } if (player == null) {