TotalFreedomMod/src/me/StevenLawson/TotalFreedomMod/Commands/Command_tban.java

54 lines
2.1 KiB
Java
Raw Normal View History

package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_Ban;
import me.StevenLawson.TotalFreedomMod.TFM_BanManager;
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor;
2013-12-22 22:20:31 +00:00
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
2013-08-14 20:54:54 +00:00
@CommandParameters(description = "Temporarily bans a player for five minutes.", usage = "/<command> <partialname>", aliases = "noob")
2013-07-02 18:31:22 +00:00
public class Command_tban extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length != 1)
{
return false;
}
final Player player = getPlayer(args[0]);
if (player == null)
{
playerMsg(TotalFreedomMod.PLAYER_NOT_FOUND, ChatColor.RED);
return true;
}
2014-01-14 19:37:08 +00:00
2013-12-22 22:20:31 +00:00
// strike with lightning effect:
final Location targetPos = player.getLocation();
for (int x = -1; x <= 1; x++)
{
for (int z = -1; z <= 1; z++)
{
final Location strike_pos = new Location(targetPos.getWorld(), targetPos.getBlockX() + x, targetPos.getBlockY(), targetPos.getBlockZ() + z);
targetPos.getWorld().strikeLightning(strike_pos);
}
}
2013-08-15 21:44:09 +00:00
TFM_Util.adminAction(sender.getName(), "Tempbanning: " + player.getName() + " for 5 minutes.", true);
TFM_BanManager.getInstance().addUuidBan(
new TFM_Ban(TFM_Util.getUuid(player), player.getName(), sender.getName(), TFM_Util.parseDateOffset("5m"), ChatColor.RED + "You have been temporarily banned for 5 minutes."));
2013-08-15 21:44:09 +00:00
player.kickPlayer(ChatColor.RED + "You have been temporarily banned for five minutes. Please read totalfreedom.me for more info.");
return true;
}
}