36 public const MAX_COORD = 30000000;
37 public const MIN_COORD = -30000000;
39 protected function fetchPermittedPlayerTarget(
CommandSender $sender, ?
string $target,
string $selfPermission,
string $otherPermission) : ?
Player{
41 $player = $sender->getServer()->getPlayerByPrefix($target);
42 }elseif($sender instanceof
Player){
49 $sender->sendMessage(KnownTranslationFactory::commands_generic_player_notFound()->prefix(TextFormat::RED));
53 ($player === $sender && $this->testPermission($sender, $selfPermission)) ||
54 ($player !== $sender && $this->testPermission($sender, $otherPermission))
61 protected function getInteger(
CommandSender $sender,
string $value,
int $min = self::MIN_COORD,
int $max = self::MAX_COORD) :
int{
73 protected function getRelativeDouble(
float $original,
CommandSender $sender,
string $input,
float $min = self::MIN_COORD,
float $max = self::MAX_COORD) :
float{
74 if($input[0] ===
"~"){
75 $value = $this->getDouble($sender, substr($input, 1));
77 return $original + $value;
80 return $this->getDouble($sender, $input, $min, $max);
83 protected function getDouble(
CommandSender $sender,
string $value,
float $min = self::MIN_COORD,
float $max = self::MAX_COORD) :
float{
95 protected function getBoundedInt(
CommandSender $sender,
string $input,
int $min,
int $max) : ?
int{
96 if(!is_numeric($input)){
102 $sender->sendMessage(KnownTranslationFactory::commands_generic_num_tooBig($input, (
string) $max)->prefix(TextFormat::RED));
106 $sender->sendMessage(KnownTranslationFactory::commands_generic_num_tooSmall($input, (
string) $min)->prefix(TextFormat::RED));