-
Bug
-
Resolution: Awaiting Response
-
None
-
Minecraft 1.9.1 Pre-Release 3, Minecraft 1.10.2, Minecraft 16w33a
-
Confirmed
The bug
The command /scoreboard teams leave runs for every specified entity instead of for running once for all specified entities.
How to reproduce
- Place two ArmorStands
- Use the following command
/scoreboard teams add testTeam
- Use the following command
/scoreboard teams join testTeam @e
It prints "Added 3 player(s) to team testTeam: ..."
- Use the following command
/scoreboard teams leave @e
It prints "Removed 1 player(s) from their teams: ..." three times
The reason
The following is based on decompiled version of Minecraft 1.9 using MCP 9.24 beta. All method and class names are the names used in the decompiled version.
The reason why this happens is because the method net.minecraft.command.server.CommandScoreboard.isUsernameIndex(String[], int) returns that the third (without scoreboard) argument is a player selector. This causes it to run the command for every entity affected. Instead it should only run once and then for all entities.
/** * Return whether the specified command parameter index is a username parameter. */ public boolean isUsernameIndex(String[] args, int index) { // Replaced this //return !args[0].equalsIgnoreCase("players") ? (args[0].equalsIgnoreCase("teams") ? index == 2 : false) : (args.length > 1 && args[1].equalsIgnoreCase("operation") ? index == 2 || index == 5 : index == 2); return args[0].equalsIgnoreCase("players") ? (args.length > 1 && args[1].equalsIgnoreCase("operation") ? index == 2 || index == 5 : index == 2) : false; }
Note: Changing this method "fixes" MC-55592 as well