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.
This commit is contained in:
Travis Watkins 2014-05-14 14:26:21 -05:00
parent fa1b6ba834
commit 89d5265da6

View file

@ -941,6 +941,8 @@ public class PlayerConnection implements PacketPlayInListener {
private void handleCommand(String s) { private void handleCommand(String s) {
// CraftBukkit start - whole method // CraftBukkit start - whole method
this.c.info(this.player.getName() + " issued server command: " + s);
CraftPlayer player = this.getPlayer(); CraftPlayer player = this.getPlayer();
PlayerCommandPreprocessEvent event = new PlayerCommandPreprocessEvent(player, s, new LazyPlayerSet()); PlayerCommandPreprocessEvent event = new PlayerCommandPreprocessEvent(player, s, new LazyPlayerSet());
@ -951,7 +953,6 @@ public class PlayerConnection implements PacketPlayInListener {
} }
try { try {
this.c.info(event.getPlayer().getName() + " issued server command: " + event.getMessage());
if (this.server.dispatchCommand(event.getPlayer(), event.getMessage().substring(1))) { if (this.server.dispatchCommand(event.getPlayer(), event.getMessage().substring(1))) {
return; return;
} }