-
Bug
-
Resolution: Unresolved
-
Minecraft 14w31a, Minecraft 1.8.3, Minecraft 1.8.4, Minecraft 16w04a, Minecraft 1.9, Minecraft 1.9.1 Pre-Release 3, Minecraft 16w15b, Minecraft 1.12, Minecraft 1.12.1, Minecraft 1.12.2, Minecraft 17w47b, Minecraft 1.13.1, Minecraft 1.13.2, Minecraft 18w50a, Minecraft 1.14 Pre-Release 2, 1.14.4, 19w44a, 19w46a, 1.15 Pre-release 1, 1.15 Pre-release 6, 1.15.2, 20w08a, 1.16.3, 20w46a, 20w51a, 21w03a, 1.16.5, 21w05b, 21w06a, 21w07a, 21w08b, 1.17.1, 1.18.1, 1.18.2, 22w19a, 1.19, 1.19.1 Pre-release 4, 1.19.2, 1.19.3, 1.20.1, 1.20.2, 24w03b, 1.21.4
-
Confirmed
-
Commands
-
Normal
-
Platform
The bug
If you run a command from chat multiple consecutive spaces will be collapsed to a single space.
Reproductions steps
- Execute the following command in chat
/tellraw @s "1 2"
Only one space is shown between the two numbers
Code analysis
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 is happening is because the method net.minecraft.network.NetHandlerPlayServer.processChatMessage(CPacketChatMessage) removes multiple whitespaces before testing if the entered message is a command or not. The test whether or not the message contains the section character § is probably not needed for commands neither.
/** * Process chat messages (broadcast back to clients) and commands (executes) */ public void processChatMessage(CPacketChatMessage packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer()); if (this.playerEntity.getChatVisibility() == EntityPlayer.EnumChatVisibility.HIDDEN) { TextComponentTranslation textcomponenttranslation = new TextComponentTranslation("chat.cannotSend", new Object[0]); textcomponenttranslation.getChatStyle().setColor(TextFormatting.RED); this.sendPacket(new SPacketChat(textcomponenttranslation)); } else { this.playerEntity.markPlayerActive(); String s = packetIn.getMessage(); // Removed this from here //s = StringUtils.normalizeSpace(s); // //for (int i = 0; i < s.length(); ++i) //{ // if (!ChatAllowedCharacters.isAllowedCharacter(s.charAt(i))) // { // this.kickPlayerFromServer("Illegal characters in chat"); // return; // } //} if (s.startsWith("/")) { this.handleSlashCommand(s); } else { // Added this here s = StringUtils.normalizeSpace(s); for (int i = 0; i < s.length(); ++i) { if (!ChatAllowedCharacters.isAllowedCharacter(s.charAt(i))) { this.kickPlayerFromServer("Illegal characters in chat"); return; } } ITextComponent itextcomponent = new TextComponentTranslation("chat.type.text", new Object[] {this.playerEntity.getDisplayName(), s}); this.serverController.getPlayerList().sendChatMsgImpl(itextcomponent, false); } this.chatSpamThresholdCount += 20; if (this.chatSpamThresholdCount > 200 && !this.serverController.getPlayerList().canSendCommands(this.playerEntity.getGameProfile())) { this.kickPlayerFromServer("disconnect.spam"); } } }
- is duplicated by
-
MC-65031 Can't multi space in chat
- Resolved
-
MC-68171 you cant have more than one space in a row in a line of chat
- Resolved
-
MC-121859 Live command parsing deals poorly with redundant spaces
- Resolved
-
MC-121988 Extra whitespace in commands between subcommands is ignored in execution, but frowned upon by syntax highlighter.
- Resolved
-
MC-146710 Two or more spaces will be merged into one in JSON text
- Resolved
-
MC-212830 Spaces on signs are erased during placing with F3+I command
- Resolved
-
MC-248590 chat command marked as error but executes
- Resolved
-
MC-267987 command blocks fail with space at end of command but same command in chat success
- Resolved
- relates to
-
MC-94456 Chat converting NBSP (non-breaking space) to space causes glitches
- Resolved
-
MC-150079 Some commands in a command block will not run if the last character is a space.
- Resolved
-
MC-165061 Command blocks ignore trailing spaces when checking syntax
- Resolved
-
MC-106136 Non-Breaking space (" ") prints as "[NBSP]" from command block (incorrectly), but from chat it prints as " " (correctly)
- Resolved
-
MC-119419 Minecraft fails to execute commmands with multiple spaces between their arguments in .mcfunction files
- Resolved