2019-11-29 16:41:18 +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;
|
|
|
|
import org.bukkit.ChatColor;
|
|
|
|
import org.bukkit.Particle;
|
|
|
|
import org.bukkit.Sound;
|
2019-12-11 01:13:47 +00:00
|
|
|
import org.bukkit.command.Command;
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
import org.bukkit.entity.Player;
|
2019-11-29 16:41:18 +00:00
|
|
|
|
2020-08-15 22:42:46 +00:00
|
|
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
2020-03-30 23:43:57 +00:00
|
|
|
@CommandParameters(description = "Sends a guardian particle effect with an enderman scream to the specified player.", usage = "/<command> <player>")
|
2019-12-11 01:13:47 +00:00
|
|
|
public class Command_scare extends FreedomCommand
|
2019-11-29 16:41:18 +00:00
|
|
|
{
|
|
|
|
@Override
|
|
|
|
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
|
|
|
{
|
2019-12-11 01:13:47 +00:00
|
|
|
if (!FUtil.isPaper())
|
|
|
|
{
|
2020-01-06 18:30:40 +00:00
|
|
|
msg("This command won't work without Paper!", ChatColor.RED);
|
2019-12-11 01:13:47 +00:00
|
|
|
return true;
|
|
|
|
}
|
2019-11-29 16:41:18 +00:00
|
|
|
|
|
|
|
if (args.length == 0)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
final Player player = getPlayer(args[0]);
|
|
|
|
|
|
|
|
if (player == null)
|
|
|
|
{
|
|
|
|
msg(FreedomCommand.PLAYER_NOT_FOUND);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
msg("Scared " + player.getName());
|
2020-04-22 20:27:07 +00:00
|
|
|
player.sendMessage(ChatColor.RED + "ZING");
|
2019-11-29 16:41:18 +00:00
|
|
|
|
|
|
|
player.spawnParticle(Particle.MOB_APPEARANCE, player.getLocation(), 4);
|
2019-12-11 01:13:47 +00:00
|
|
|
for (int i = 0; i < 10; ++i)
|
|
|
|
{
|
2019-11-29 16:41:18 +00:00
|
|
|
player.playSound(player.getLocation(), Sound.ENTITY_ENDERMAN_SCREAM, 1, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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))
|
2019-11-29 16:41:18 +00:00
|
|
|
{
|
|
|
|
return FUtil.getPlayerList();
|
|
|
|
}
|
|
|
|
return Collections.emptyList();
|
|
|
|
}
|
2020-04-22 20:27:07 +00:00
|
|
|
}
|