thats what i meant. so my way to rename an item: PHP: $enchants = explode("\n", $item->getName());//didnt know $item->getName() also returns its custom name if has :Dunset($enchants[0]);//removes the first line, the name of the item$item->clearCustomName();$item->setCustomName($newName . "\n" . implode("\n", $enchants)); eg: Godly sword Rekt V Demolish IV $newName = DSword PHP: $enchants = explode("\n", $item->getName()); //["Godly sword", "Rekt V","Demolish IV"]unset($enchants[0]); // removes "Godly sword" from the array$item->clearCustomName();$newName = "DSword";$item->setCustomName($newName. "\n" . implode("\n", $enchants)); // $enchants is the custom enchants the old named sword had
Also, my bad. Typo.. It should be... PHP: if (strpos($item->getName(), "\n") !== false) { This one is wrong.. PHP: if (strpos($item->getName(), '\n') !== false) {