52 lines
1.8 KiB
Java
52 lines
1.8 KiB
Java
package me.totalfreedom.totalfreedommod.command;
|
|
|
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
|
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
|
import net.kyori.adventure.text.Component;
|
|
import org.bukkit.command.Command;
|
|
import org.bukkit.command.CommandSender;
|
|
import org.bukkit.entity.Player;
|
|
|
|
@CommandPermissions(permission = "fuckoff", 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(Component.text("Fuckoff ").append(Component.text(player.isFuckOff() ? "enabled. Radius: " + player.getFuckoffRadius() : "disabled.")));
|
|
|
|
return true;
|
|
}
|
|
} |