From e5dec4f10ec4fdea1b6b5dd58e2ba0c49dd0fa9b Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Fri, 5 Apr 2013 12:49:59 -0500 Subject: [PATCH] Consider arguments to team leave properly. Fixes BUKKIT-3994 Two checks to argument length were changed to properly consider if the sender is a player instead of an off-by-one logical error. By: Wesley Wolfe --- .../java/org/bukkit/command/defaults/ScoreboardCommand.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/paper-api/src/main/java/org/bukkit/command/defaults/ScoreboardCommand.java b/paper-api/src/main/java/org/bukkit/command/defaults/ScoreboardCommand.java index 64816b627e..0b2755a2c4 100644 --- a/paper-api/src/main/java/org/bukkit/command/defaults/ScoreboardCommand.java +++ b/paper-api/src/main/java/org/bukkit/command/defaults/ScoreboardCommand.java @@ -385,13 +385,13 @@ public class ScoreboardCommand extends VanillaCommand { sender.sendMessage("Added " + addedPlayers.size() + " player(s) to team " + team.getName() + ": " + stringCollectionToString(addedPlayers)); } } else if (args[1].equalsIgnoreCase("leave")) { - if ((sender instanceof Player) ? args.length < 2 : args.length < 3) { + if (!(sender instanceof Player) && args.length < 3) { sender.sendMessage(ChatColor.RED + "/scoreboard teams leave [player...]"); return false; } Set left = new HashSet(); Set noTeam = new HashSet(); - if ((sender instanceof Player) && args.length == 3) { + if ((sender instanceof Player) && args.length == 2) { Team team = mainScoreboard.getPlayerTeam((Player) sender); if (team != null) { team.removePlayer((Player) sender);