Skip to content

Trailing spaces missing from ParseResults' StringReader when using CommandDispatcher.parse() #4235

@haohao3001

Description

@haohao3001

Affected Product(s)

SpongeForge

Version

spongeneo-1.21.1-21.1.35-12.0.3-RC2358-universal

Operating System

Windows

Java Version

GraalVM 21.0.8+12.1

Plugins/Mods

NeoForge 21.1.209

Describe the bug

Test code:

NeoForge.EVENT_BUS.addListener((ServerStartedEvent e) ->{
            MinecraftServer server = e.getServer();
            StringReader command  = new StringReader("testcommand ");
            LOGGER.error("Input:\"{}\"", command.getString());
            final ParseResults<CommandSourceStack> results = server.getCommands().getDispatcher().parse(command, server.createCommandSourceStack());
            LOGGER.error("Output:\"{}\"", results.getReader().getString());
        });

Expected Behavior:
The output should preserve the trailing space: "testcommand "

Actual Behavior with SpongeNeo:
The trailing space is removed: "testcommand"

Actual Behavior without Sponge (NeoForge):
The trailing space is correctly preserved: "testcommand "

Link to logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: needs triageThis label is automatically applied to new issues and pull requests to indicate they require triagetype: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions