TotalFreedomMod/src/main/java/me/totalfreedom/totalfreedommod/command/Command_lastcmd.java
Jerom van der Sar 6edb6be7d9 Many changes for TFM 5.0
Improved admin system
Improved Rank system
Implemented config converter
Improved command handling
Updated Aero
2016-03-06 16:58:59 +01:00

46 lines
1.3 KiB
Java

package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Show the last command that someone used.", usage = "/<command> <player>")
public class Command_lastcmd extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length == 0)
{
return false;
}
final Player player = getPlayer(args[0]);
if (player == null)
{
msg(FreedomCommand.PLAYER_NOT_FOUND);
return true;
}
final FPlayer playerdata = plugin.pl.getPlayer(player);
if (playerdata != null)
{
String lastCommand = playerdata.getLastCommand();
if (lastCommand.isEmpty())
{
lastCommand = "(none)";
}
msg(player.getName() + " - Last Command: " + lastCommand, ChatColor.GRAY);
}
return true;
}
}