57 $player = $this->fetchPermittedPlayerTarget($commandLabel, $sender, $args[0], DefaultPermissionNames::COMMAND_EFFECT_SELF, DefaultPermissionNames::COMMAND_EFFECT_OTHER);
61 $effectManager = $player->getEffects();
63 if(strtolower($args[1]) ===
"clear"){
64 $effectManager->clear();
66 $sender->sendMessage(KnownTranslationFactory::commands_effect_success_removed_all($player->getDisplayName()));
70 $effect = StringToEffectParser::getInstance()->parse($args[1]);
72 $sender->sendMessage(KnownTranslationFactory::commands_effect_notFound($args[1])->prefix(TextFormat::RED));
78 if(count($args) >= 3){
79 if(($d = $this->getBoundedInt($sender, $args[2], 0, (
int) (Limits::INT32_MAX / 20))) ===
null){
87 if(count($args) >= 4){
88 $amplification = $this->getBoundedInt($sender, $args[3], 0, 255);
89 if($amplification ===
null){
95 if(count($args) >= 5){
96 $v = strtolower($args[4]);
97 if($v ===
"on" || $v ===
"true" || $v ===
"t" || $v ===
"1"){
103 if(!$effectManager->has($effect)){
104 if(count($effectManager->all()) === 0){
105 $sender->sendMessage(KnownTranslationFactory::commands_effect_failure_notActive_all($player->getDisplayName()));
107 $sender->sendMessage(KnownTranslationFactory::commands_effect_failure_notActive($effect->getName(), $player->getDisplayName()));
112 $effectManager->remove($effect);
113 $sender->sendMessage(KnownTranslationFactory::commands_effect_success_removed($effect->getName(), $player->getDisplayName()));
115 $instance =
new EffectInstance($effect, $duration, $amplification, $visible);
116 $effectManager->add($instance);
117 self::broadcastCommandMessage($sender, KnownTranslationFactory::commands_effect_success($effect->getName(), (
string) $instance->getAmplifier(), $player->getDisplayName(), (
string) ($instance->getDuration() / 20)));