Format change (/cmdspy)

While executing this during administration I noticed the ratio between execution and response was rather delayed, and I realized it's because the command is waiting for all the tables and grab methods to run before sending the player the enabled/disabled message. This creates a false sense of lag and is as simple as making the message run before anything else, given that the methods run and tables save almost instantly, this won't negatively affect the module or command.
This commit is contained in:
Joe H 2020-07-28 02:12:30 -04:00 committed by GitHub
parent ee04a456a1
commit 05f94920d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,12 +14,11 @@ public class Command_cmdspy extends FreedomCommand
@Override @Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{ {
msg("CommandSpy " + (admin.getCommandSpy() ? "enabled." : "disabled."));
Admin admin = plugin.al.getAdmin(playerSender); Admin admin = plugin.al.getAdmin(playerSender);
admin.setCommandSpy(!admin.getCommandSpy()); admin.setCommandSpy(!admin.getCommandSpy());
plugin.al.save(admin); plugin.al.save(admin);
plugin.al.updateTables(); plugin.al.updateTables();
msg("CommandSpy " + (admin.getCommandSpy() ? "enabled." : "disabled."));
return true; return true;
} }