Skip to content

Commit 4a0f535

Browse files
committed
Parse pasted multi-line commands separately line by line
Fixes #13006
1 parent b0da38c commit 4a0f535

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

paper-server/src/main/java/com/destroystokyo/paper/console/PaperConsole.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,15 @@ protected boolean isRunning() {
4242

4343
@Override
4444
protected void runCommand(String command) {
45-
this.server.handleConsoleInput(command, this.server.createCommandSourceStack());
45+
// terminals interpret pressing [enter] and pasting a multi-line string differently,
46+
// the latter makes the line reader read it as a single line - and we don't want that
47+
// https://github.com/PaperMC/Paper/issues/13006
48+
for (String line : command.split("\n")) {
49+
if (line.isEmpty()) {
50+
continue;
51+
}
52+
this.server.handleConsoleInput(line, this.server.createCommandSourceStack());
53+
}
4654
}
4755

4856
@Override

0 commit comments

Comments
 (0)