How can I set the command to edit the $args I set up most of it I just dont know what to use to edit the args. PHP: class Main extends PluginBase implements Listener{ public function onEnable() { $this->getServer()->getPluginManager()->registerEvents($this,$this); } public function onCommand(CommandSender $sender, Command $cmd, string $label, array $args): bool { if($cmd == "Knockback"){ } public function onDamage(EntityDamageEvent $event){ $event->getEntity()->setMotion(new Vector3($args[0],$args[1]],0.3)); }}
btw, I suggest you go learn php first. anyways here's the "solution" (temporary, not saved to disk currently) PHP: class Main extends PluginBase implements Listener{ private $args = [1, 1]; //default vals public function onEnable() { $this->getServer()->getPluginManager()->registerEvents($this,$this); } public function onCommand(CommandSender $sender, Command $cmd, string $label, array $args): bool { if($cmd->getName() == "knockback"){ if(is_numeric($args[0]) && is_numeric($args[1]) & is_numeric($args[2])){ $this->args = $args; } } } public function onDamage(EntityDamageEvent $event){ $event->getEntity()->setMotion(new Vector3($this->args[0],$this->args[1]],0.3)); }}