TotalFreedomMod/src/main/java/me/totalfreedom/totalfreedommod/command/Command_fuckoff.java
2020-08-15 17:42:46 -05:00

51 lines
1.5 KiB
Java

package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.ADMIN, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "You'll never even see it coming - repeatedly push players away from you until command is untoggled.", usage = "/<command> <on [radius (default=25)] | off>")
public class Command_fuckoff extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length < 1)
{
return false;
}
FPlayer player = plugin.pl.getPlayer(playerSender);
if (!args[0].equals("on"))
{
player.disableFuckoff();
}
else
{
double radius = 25.0;
if (args.length >= 2)
{
try
{
radius = Math.max(5.0, Math.min(50, Double.parseDouble(args[1])));
}
catch (NumberFormatException ex)
{
}
}
player.setFuckoff(radius);
}
msg("Fuckoff " + (player.isFuckOff() ? ("enabled. Radius: " + player.getFuckoffRadius() + ".") : "disabled."));
return true;
}
}