mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
parent
942b35ee4c
commit
10c8632417
@ -90,6 +90,13 @@ class EffectCommand extends VanillaCommand{
|
||||
|
||||
if(count($args) >= 4){
|
||||
$amplification = (int) $args[3];
|
||||
if($amplification > 255){
|
||||
$sender->sendMessage(new TranslationContainer(TextFormat::RED . "%commands.generic.num.tooBig", [(string) $args[3], "255"]));
|
||||
return true;
|
||||
}elseif($amplification < 0){
|
||||
$sender->sendMessage(new TranslationContainer(TextFormat::RED . "%commands.generic.num.tooSmall", [(string) $args[3], "0"]));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if(count($args) >= 5){
|
||||
|
@ -169,8 +169,8 @@ class Effect{
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAmplifier($amplifier){
|
||||
$this->amplifier = (int) $amplifier;
|
||||
public function setAmplifier(int $amplifier){
|
||||
$this->amplifier = $amplifier & 0xff;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -599,12 +599,14 @@ abstract class Entity extends Location implements Metadatable{
|
||||
|
||||
if(isset($this->namedtag->ActiveEffects)){
|
||||
foreach($this->namedtag->ActiveEffects->getValue() as $e){
|
||||
$amplifier = $e["Amplifier"] & 0xff; //0-255 only
|
||||
|
||||
$effect = Effect::getEffect($e["Id"]);
|
||||
if($effect === null){
|
||||
continue;
|
||||
}
|
||||
|
||||
$effect->setAmplifier($e["Amplifier"])->setDuration($e["Duration"])->setVisible($e["ShowParticles"] > 0);
|
||||
$effect->setAmplifier($amplifier)->setDuration($e["Duration"])->setVisible($e["ShowParticles"] > 0);
|
||||
|
||||
$this->addEffect($effect);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user