[Pocketmine 3.0.0] Проблема с переключением слота на кастомном зелье

Я переключаю слот на зелье или наоборот пишет Без эффектов хоть в loretext написано другое.
image

Код:
public function GetLevitationPotion() {
$displayText = ‘§r§fЗелье левитации’;
$loreText = [
"§r§7Левитация (0:45) "
];

    $loreTags = [];
    foreach ($loreText as $line) {
        $loreTags[] = new StringTag("", $line);
    }
    $loreCompound = new ListTag("Lore", $loreTags);

    $tag = new CompoundTag("", [
        "levitationPotionTag" => new IntTag("levitationPotionTag"),
        "display" => new CompoundTag("display", [
            "Name" => new StringTag("Name", $displayText),
            "Lore" => $loreCompound,
        ]),
    ]);

    $item = Item::get(Item::POTION, 0, 1);
    $item->setNamedTag($tag);

    return $item;
}

public function isLevitationPotion($item) {
    if (!$item->hasCompoundTag())
        return false;
    $tag = $item->getNamedTag();
    return isset($tag->levitationPotionTag);
}

public function onConsumeLevitationPotion(PlayerItemConsumeEvent $event) {
    $player = $event->getPlayer();
    $item = $event->getItem();
    if ($this->isLevitationPotion($item)) {
       $levitationEffect = Effect::getEffect(Effect::LEVITATION)->setDuration(900)->setAmplifier(0)->setVisible(true);
	   $player->addEffect($levitationEffect);      
    }
}
public function GetLevitationPotionTimeUp() {
    $displayText = '§r§fЗелье левитации';
    $loreText = [
        "§r§7Левитация (1:20) "
    ];

    $loreTags = [];
    foreach ($loreText as $line) {
        $loreTags[] = new StringTag("", $line);
    }
    $loreCompound = new ListTag("Lore", $loreTags);

    $tag = new CompoundTag("", [
        "levitationPotionTimeUpTag" => new IntTag("levitationPotionTimeUpTag"),
        "display" => new CompoundTag("display", [
            "Name" => new StringTag("Name", $displayText),
            "Lore" => $loreCompound,
        ]),
    ]);

    $item = Item::get(Item::POTION, 0, 1);
    $item->setNamedTag($tag);

    return $item;
}

public function isLevitationPotionTimeUp($item) {
    if (!$item->hasCompoundTag())
        return false;
    $tag = $item->getNamedTag();
    return isset($tag->levitationPotionTimeUpTag);
}

public function onConsumeLevitationPotionTimeUp(PlayerItemConsumeEvent $event) {
    $player = $event->getPlayer();
    $item = $event->getItem();
    if ($this->isLevitationPotionTimeUp($item)) {
       $levitationEffect = Effect::getEffect(Effect::LEVITATION)->setDuration(1600)->setAmplifier(0)->setVisible(true);
	   $player->addEffect($levitationEffect);      
    }
}
public function GetLevitationPotionTwo() {
    $displayText = '§r§fЗелье левитации';
    $loreText = [
        "§r§7Левитация II (0:22) "
    ];

    $loreTags = [];
    foreach ($loreText as $line) {
        $loreTags[] = new StringTag("", $line);
    }
    $loreCompound = new ListTag("Lore", $loreTags);

    $tag = new CompoundTag("", [
        "levitationPotionTwoTag" => new IntTag("levitationPotionTwoTag"),
        "display" => new CompoundTag("display", [
            "Name" => new StringTag("Name", $displayText),
            "Lore" => $loreCompound,
        ]),
    ]);

    $item = Item::get(Item::POTION, 0, 1);
    $item->setNamedTag($tag);

    return $item;
}

public function isLevitationPotionTwo($item) {
    if (!$item->hasCompoundTag())
        return false;
    $tag = $item->getNamedTag();
    return isset($tag->levitationPotionTwoTag);
}

public function onConsumeLevitationPotionTwo(PlayerItemConsumeEvent $event) {
    $player = $event->getPlayer();
    $item = $event->getItem();
    if ($this->isLevitationPotionTwo($item)) {
       $levitationEffect = Effect::getEffect(Effect::LEVITATION)->setDuration(440)->setAmplifier(1)->setVisible(true);
	   $player->addEffect($levitationEffect);      
    }
}

перенеси тему в “Вопросы и обсуждения”

public function GetLevitationPotion($customName) {
    $displayText = '§r§f' . $customName;
    $loreText = [
        "§r§7Левитация (1:20)"
    ];

    $loreTags = [];
    foreach ($loreText as $line) {
        $loreTags[] = new StringTag("", $line);
    }
    $loreCompound = new ListTag("Lore", $loreTags);

    $tag = new CompoundTag("", [
        "levitationPotionTag" => new IntTag("levitationPotionTag"),
        "display" => new CompoundTag("display", [
            "Name" => new StringTag("Name", $displayText),
            "Lore" => $loreCompound,
        ]),
    ]);

    $item = Item::get(Item::POTION, 0, 1);
    $item->setNamedTag($tag);

    return $item;
}

public function GetLevitationPotionTimeUp($customName) {
    $displayText = '§r§f' . $customName;
    $loreText = [
        "§r§7Левитация (1:20)"
    ];

    $loreTags = [];
    foreach ($loreText as $line) {
        $loreTags[] = new StringTag("", $line);
    }
    $loreCompound = new ListTag("Lore", $loreTags);

    $tag = new CompoundTag("", [
        "levitationPotionTimeUpTag" => new IntTag("levitationPotionTimeUpTag"),
        "display" => new CompoundTag("display", [
            "Name" => new StringTag("Name", $displayText),
            "Lore" => $loreCompound,
        ]),
    ]);

    $item = Item::get(Item::POTION, 0, 1);
    $item->setNamedTag($tag);

    return $item;
}

public function GetLevitationPotionTwo($customName) {
    $displayText = '§r§f' . $customName;
    $loreText = [
        "§r§7Левитация II (0:22)"
    ];

    $loreTags = [];
    foreach ($loreText as $line) {
        $loreTags[] = new StringTag("", $line);
    }
    $loreCompound = new ListTag("Lore", $loreTags);

    $tag = new CompoundTag("", [
        "levitationPotionTwoTag" => new IntTag("levitationPotionTwoTag"),
        "display" => new CompoundTag("display", [
            "Name" => new StringTag("Name", $displayText),
            "Lore" => $loreCompound,
        ]),
    ]);

    $item = Item::get(Item::POTION, 0, 1);
    $item->setNamedTag($tag);

    return $item;
}

Эта тема была автоматически закрыта через 12 часов после последнего ответа. В ней больше нельзя отвечать.