2016-03-02 19:28:01 +00:00
|
|
|
package me.totalfreedom.totalfreedommod.command;
|
2012-12-22 03:22:08 +00:00
|
|
|
|
2015-10-19 17:43:46 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
2016-03-06 15:56:15 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
2012-12-22 03:22:08 +00:00
|
|
|
import org.bukkit.ChatColor;
|
|
|
|
import org.bukkit.command.Command;
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
2020-08-15 22:41:23 +00:00
|
|
|
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
2020-03-30 23:43:57 +00:00
|
|
|
@CommandParameters(description = "Show the last command the specified player used.", usage = "/<command> <player>")
|
2015-10-19 17:43:46 +00:00
|
|
|
public class Command_lastcmd extends FreedomCommand
|
2012-12-22 03:22:08 +00:00
|
|
|
{
|
2015-11-22 18:26:47 +00:00
|
|
|
|
2012-12-22 03:22:08 +00:00
|
|
|
@Override
|
2015-11-22 18:26:47 +00:00
|
|
|
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
2012-12-22 03:22:08 +00:00
|
|
|
{
|
|
|
|
if (args.length == 0)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-04-26 11:55:24 +00:00
|
|
|
final Player player = getPlayer(args[0]);
|
2014-05-04 21:03:34 +00:00
|
|
|
|
2014-04-26 11:55:24 +00:00
|
|
|
if (player == null)
|
2012-12-22 03:22:08 +00:00
|
|
|
{
|
2016-03-02 19:28:01 +00:00
|
|
|
msg(FreedomCommand.PLAYER_NOT_FOUND);
|
2012-12-22 03:22:08 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-10-19 17:43:46 +00:00
|
|
|
final FPlayer playerdata = plugin.pl.getPlayer(player);
|
2012-12-22 03:22:08 +00:00
|
|
|
|
|
|
|
if (playerdata != null)
|
|
|
|
{
|
2014-04-26 11:55:24 +00:00
|
|
|
String lastCommand = playerdata.getLastCommand();
|
|
|
|
if (lastCommand.isEmpty())
|
2012-12-22 03:22:08 +00:00
|
|
|
{
|
2014-04-26 11:55:24 +00:00
|
|
|
lastCommand = "(none)";
|
2012-12-22 03:22:08 +00:00
|
|
|
}
|
2016-03-02 19:28:01 +00:00
|
|
|
msg(player.getName() + " - Last Command: " + lastCommand, ChatColor.GRAY);
|
2012-12-22 03:22:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|