mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-08 19:34:09 +01:00
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 <weswolf@aol.com>
This commit is contained in:
parent
0716e7a635
commit
e5dec4f10e
1 changed files with 2 additions and 2 deletions
|
@ -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<String> left = new HashSet<String>();
|
||||
Set<String> noTeam = new HashSet<String>();
|
||||
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);
|
||||
|
|
Loading…
Reference in a new issue