2015-10-19 17:43:46 +00:00
|
|
|
package me.totalfreedom.totalfreedommod.commands;
|
2012-12-22 03:22:08 +00:00
|
|
|
|
2015-11-15 23:32:04 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
|
2015-10-19 17:43:46 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
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;
|
|
|
|
|
2015-10-19 17:43:46 +00:00
|
|
|
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.BOTH)
|
2013-04-10 02:05:24 +00:00
|
|
|
@CommandParameters(description = "Show the last command that someone 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
|
|
|
{
|
2015-10-19 17:43:46 +00:00
|
|
|
playerMsg(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
|
|
|
}
|
2014-04-26 11:55:24 +00:00
|
|
|
playerMsg(player.getName() + " - Last Command: " + lastCommand, ChatColor.GRAY);
|
2012-12-22 03:22:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|