Paper/patches/server/0543-Empty-commands-shall-not-be-dispatched.patch
Jake Potrebic afe633df08
convert API/server tests to mockito (#8848)
* convert API tests to mockito

* convert server tests to mockito

* add co-author
2023-02-15 13:27:40 -08:00

19 Zeilen
885 B
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mariell Hoversholm <proximyst@proximyst.com>
Date: Wed, 6 Jan 2021 23:38:43 +0100
Subject: [PATCH] Empty commands shall not be dispatched
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index feb9e827357b3ffb76dfff90350e513592441d8e..03a926990ecfa97d8fbc20a15ffb7fcb48fed06a 100644
--- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -253,6 +253,7 @@ public class Commands {
command = event.getCommand();
String[] args = command.split(" ");
+ if (args.length == 0) return 0; // Paper - empty commands shall not be dispatched
String cmd = args[0];
if (cmd.startsWith("minecraft:")) cmd = cmd.substring("minecraft:".length());