From 89d5265da69195b3af4d3e6c05dbcb616cd9bdd9 Mon Sep 17 00:00:00 2001 From: Travis Watkins Date: Wed, 14 May 2014 14:26:21 -0500 Subject: [PATCH] Ensure we always log commands and log the right thing. Waiting to log until after PlayerCommandPreprocessEvent makes the server not log anything if the event is cancelled. It also makes the server log what a plugin changed the command to instead of what the player actually tried to run. As the point of the log is to have a record of every command a player attempts to run these are both not desirable. --- src/main/java/net/minecraft/server/PlayerConnection.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java index 17978101b6..89ef6fafbf 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -941,6 +941,8 @@ public class PlayerConnection implements PacketPlayInListener { private void handleCommand(String s) { // CraftBukkit start - whole method + this.c.info(this.player.getName() + " issued server command: " + s); + CraftPlayer player = this.getPlayer(); PlayerCommandPreprocessEvent event = new PlayerCommandPreprocessEvent(player, s, new LazyPlayerSet()); @@ -951,7 +953,6 @@ public class PlayerConnection implements PacketPlayInListener { } try { - this.c.info(event.getPlayer().getName() + " issued server command: " + event.getMessage()); if (this.server.dispatchCommand(event.getPlayer(), event.getMessage().substring(1))) { return; }