kk i need ur help, im checking if it has an enchant again, and it isnt working again. Basically, on sign tap it checks if it has the enchant, if it does, it just sends the enchant name, if it doesnt, it adds it. Well it always adds it even if it has the enchant. Here's the new code. PHP: public function onTap(PlayerInteractEvent $event){ $player = $event->getPlayer(); $item = $player->getinventory()->getItemInHand(); $tile = $event->getPlayer()->getLevel()->getTile($event->getBlock()); $blindness = "\nBlindness"; $event->setCancelled(true); if($tile instanceof \pocketmine\tile\Sign){ ##CUE TIER 1 ENCHANTS## if($tile->getText()[0] === "[Tier 1]"){ if($tile->getText()[1] === "25 XP"){ if($tile->getText()[2] === "Blindness Enchant"){ $words = $item->getName(); //The item name $name = strtolower($item->getName()); if(strpos($name, $blindness) == true){ ##CHECKS IF IT CONTAINS THE ENCHANT $player->sendMessage($blindness); return false; }else{ ##IF IT DOESNT, IT ADDS IT HERE $nbt = new CompoundTag(); $nbt->display = new CompoundTag("display"); $nbt->display->Name = new StringTag("Name",$item->getName().$blindness); $item->setNamedTag($nbt); $player->getInventory()->setItemInHand($item); $player->sendPopup(TF::GREEN . "Blindess Enchant Recieved!"); return true; } } } }}}
With the strpos if statement, you've converted the item name to lowercase, but you're checking if it contains 'Blindness'(with a capital 'B'), this will return false, so the else statement always executes.