56 $player = $this->fetchPermittedPlayerTarget($sender, $args[0], DefaultPermissionNames::COMMAND_EFFECT_SELF, DefaultPermissionNames::COMMAND_EFFECT_OTHER);
60 $effectManager = $player->getEffects();
62 if(strtolower($args[1]) ===
"clear"){
63 $effectManager->clear();
65 $sender->sendMessage(KnownTranslationFactory::commands_effect_success_removed_all($player->getDisplayName()));
69 $effect = StringToEffectParser::getInstance()->parse($args[1]);
71 $sender->sendMessage(KnownTranslationFactory::commands_effect_notFound($args[1])->prefix(TextFormat::RED));
77 if(count($args) >= 3){
78 if(($d = $this->getBoundedInt($sender, $args[2], 0, (
int) (Limits::INT32_MAX / 20))) ===
null){
86 if(count($args) >= 4){
87 $amplification = $this->getBoundedInt($sender, $args[3], 0, 255);
88 if($amplification ===
null){
94 if(count($args) >= 5){
95 $v = strtolower($args[4]);
96 if($v ===
"on" || $v ===
"true" || $v ===
"t" || $v ===
"1"){
102 if(!$effectManager->has($effect)){
103 if(count($effectManager->all()) === 0){
104 $sender->sendMessage(KnownTranslationFactory::commands_effect_failure_notActive_all($player->getDisplayName()));
106 $sender->sendMessage(KnownTranslationFactory::commands_effect_failure_notActive($effect->getName(), $player->getDisplayName()));
111 $effectManager->remove($effect);
112 $sender->sendMessage(KnownTranslationFactory::commands_effect_success_removed($effect->getName(), $player->getDisplayName()));
114 $instance =
new EffectInstance($effect, $duration, $amplification, $visible);
115 $effectManager->add($instance);
116 self::broadcastCommandMessage($sender, KnownTranslationFactory::commands_effect_success($effect->getName(), (
string) $instance->getAmplifier(), $player->getDisplayName(), (
string) ($instance->getDuration() / 20)));