TotalFreedomMod/src/main/java/me/totalfreedom/totalfreedommod/command/Command_explode.java

52 lines
1.5 KiB
Java
Raw Normal View History

package me.totalfreedom.totalfreedommod.command;
import java.util.Collections;
import java.util.List;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.ChatColor;
import org.bukkit.Particle;
import org.bukkit.Sound;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Surprise someone.", usage = "/<command> <player>")
public class Command_explode 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;
}
msg("Exploded " + player.getName());
player.setHealth(0.0);
player.getWorld().createExplosion(player.getLocation(), 0F, false);
return true;
}
@Override
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
{
if (args.length == 1 && plugin.al.isAdmin(sender))
{
return FUtil.getPlayerList();
}
return Collections.emptyList();
}
}