Commands can be run with double slash prefix, e.g. //summon pig.
Steps to Reproduce:
1. Type //summon pig in chat
2. Press Enter
Observed Results:
Pig gets summoned
Expected Results:
Command errors
Code Analysis
22w19a split the methods used to send the command and the chat message. Client sends the unslashed command:
ChatScreen.java
public void method_44056(String string, boolean bl) {
/* omitted */
if (string.startsWith("/")) {
this.client.player.method_44098(string.substring(1), lv);
} else {
this.client.player.method_44096(string, lv);
}
}However the server also removes the slash prefix:
CommandManager.java
public int execute(ServerCommandSource commandSource, String command) {
StringReader stringReader = new StringReader(command);
if (stringReader.canRead() && stringReader.peek() == '/')
stringReader.skip();
/* omitted */
}therefore making the double-slashed command valid.
Comments 0
No comments.