From 8a33eabe3db5311f409928fc4abdb35b112c6f8f Mon Sep 17 00:00:00 2001 From: Sarah Date: Wed, 19 Apr 2017 01:40:23 +0200 Subject: [PATCH] Add a way to log commands --- .../src/mineplex/core/command/CommandCenter.java | 9 ++++++++- .../core/personalServer/HostEventServerCommand.java | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/command/CommandCenter.java b/Plugins/Mineplex.Core/src/mineplex/core/command/CommandCenter.java index 5ab90fc5a..988c6316f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/command/CommandCenter.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/command/CommandCenter.java @@ -89,12 +89,13 @@ public class CommandCenter implements Listener, IPacketHandler public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) { String commandName = event.getMessage().substring(1); + String argString = event.getMessage().substring(event.getMessage().indexOf(' ') + 1); String[] args = new String[]{}; if (commandName.contains(" ")) { commandName = commandName.split(" ")[0]; - args = event.getMessage().substring(event.getMessage().indexOf(' ') + 1).split(" "); + args = argString.split(" "); } ICommand command = Commands.get(commandName.toLowerCase()); @@ -113,6 +114,12 @@ public class CommandCenter implements Listener, IPacketHandler } command.SetAliasUsed(commandName.toLowerCase()); + + if (command instanceof LoggedCommand) + { + ((LoggedCommand) command).execute(System.currentTimeMillis(), event.getPlayer().getName(), commandName, argString); + } + command.Execute(event.getPlayer(), args); } return; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/personalServer/HostEventServerCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/personalServer/HostEventServerCommand.java index 8b4ad8625..7d9f2590b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/personalServer/HostEventServerCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/personalServer/HostEventServerCommand.java @@ -3,6 +3,7 @@ package mineplex.core.personalServer; import org.bukkit.entity.Player; import mineplex.core.command.CommandBase; +import mineplex.core.command.LoggedCommand; import mineplex.core.common.Rank; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer;