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

67 lines
2.1 KiB
Java
Raw Normal View History

2019-07-11 02:13:57 +00:00
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;
2020-07-01 03:38:29 +00:00
import org.bukkit.ChatColor;
2019-07-11 02:13:57 +00:00
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
2020-08-15 22:42:46 +00:00
@CommandPermissions(level = Rank.ADMIN, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Curse someone - sends a cursed texture pack to the specified player.", usage = "/<command> <player>")
2019-07-11 02:13:57 +00:00
public class Command_curse extends FreedomCommand
{
/* The only problem with this is someone can prevent themself from being cursed by declining to download the
resource pack. However, if they hit yes, then you can curse them whenever you want and they can't stop it unless
they go into their server settings. and set server resource packs to prompt or disabled */
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (!FUtil.isExecutive(sender.getName()))
{
return noPerms();
}
if (args.length == 0)
{
return false;
}
final Player player = getPlayer(args[0]);
if (player == null)
{
msg(FreedomCommand.PLAYER_NOT_FOUND);
return true;
}
if (plugin.cul.cursedPlayers.containsKey(player))
{
msg("Already attempting to curse!", ChatColor.RED);
2019-07-11 02:13:57 +00:00
return true;
}
player.setResourcePack("http://play.totalfreedom.me/cursed.zip");
msg("Attempting to curse " + player.getName(), ChatColor.GREEN);
plugin.cul.cursedPlayers.put(player, playerSender);
return true;
}
@Override
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
{
2020-08-15 22:42:46 +00:00
if (args.length == 1 && plugin.sl.isStaff(sender) && FUtil.isExecutive(sender.getName()))
2019-07-11 02:13:57 +00:00
{
return FUtil.getPlayerList();
}
return Collections.emptyList();
}
}