Add a way to log commands
This commit is contained in:
parent
fdee6b1163
commit
8a33eabe3d
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user