mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-04 00:59:51 +00:00
parent
942b35ee4c
commit
10c8632417
@ -90,6 +90,13 @@ class EffectCommand extends VanillaCommand{
|
|||||||
|
|
||||||
if(count($args) >= 4){
|
if(count($args) >= 4){
|
||||||
$amplification = (int) $args[3];
|
$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){
|
if(count($args) >= 5){
|
||||||
|
@ -169,8 +169,8 @@ class Effect{
|
|||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setAmplifier($amplifier){
|
public function setAmplifier(int $amplifier){
|
||||||
$this->amplifier = (int) $amplifier;
|
$this->amplifier = $amplifier & 0xff;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -599,12 +599,14 @@ abstract class Entity extends Location implements Metadatable{
|
|||||||
|
|
||||||
if(isset($this->namedtag->ActiveEffects)){
|
if(isset($this->namedtag->ActiveEffects)){
|
||||||
foreach($this->namedtag->ActiveEffects->getValue() as $e){
|
foreach($this->namedtag->ActiveEffects->getValue() as $e){
|
||||||
|
$amplifier = $e["Amplifier"] & 0xff; //0-255 only
|
||||||
|
|
||||||
$effect = Effect::getEffect($e["Id"]);
|
$effect = Effect::getEffect($e["Id"]);
|
||||||
if($effect === null){
|
if($effect === null){
|
||||||
continue;
|
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);
|
$this->addEffect($effect);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user