From 328b7be86784a65e5e4fddbbbaca5625ce4b2597 Mon Sep 17 00:00:00 2001 From: Liqueur Librazy Date: Thu, 7 Feb 2019 00:51:35 +0800 Subject: [PATCH] use nextPlayerOrSender in /nu launch --- .../java/cat/nyaa/nyaautils/CommandHandler.java | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/main/java/cat/nyaa/nyaautils/CommandHandler.java b/src/main/java/cat/nyaa/nyaautils/CommandHandler.java index e2a727b..0b62b85 100644 --- a/src/main/java/cat/nyaa/nyaautils/CommandHandler.java +++ b/src/main/java/cat/nyaa/nyaautils/CommandHandler.java @@ -103,20 +103,7 @@ public void commandLaunch(CommandSender sender, Arguments args) { double speed = args.nextDouble(); int delay = args.nextInt(); int launchSpeed = args.nextInt(); - String pName = args.next(); - if (pName == null) { - if (sender instanceof Player) { - pName = sender.getName(); - } else { - sender.sendMessage(I18n.format("user.launch.missing_name")); - return; - } - } - Player p = Bukkit.getPlayer(pName); - if (p == null) { - sender.sendMessage(I18n.format("user.launch.player_not_online", pName)); - return; - } + Player p = args.nextPlayerOrSender(); ItemStack chestPlate = p.getInventory().getChestplate(); if (chestPlate == null || chestPlate.getType() != Material.ELYTRA) {