Hello, How would I go about not changing an items custom name, but adding a new line to it with \n. Keep in mind, i dont want to change the original line, just add to it. Thanks in advance.
You can get the custom name and then add more text: PHP: // $item being an instance of pocketmine\item\Item$oldName = $item->getCustomName(); // get the exising custom name if it exists$newName = "Your new name"; // the text you're adding$item->setCustomName($oldName . "\n" . $newName); // set the items new name// Single line$item->setCustomName($item->getCustomName() . "\n" . "Your new name"); You would want to perform some simple checks to make sure the item has a custom name and making sure the item doesn't already have a two line name or the text will most likely go off the client's screen.
For others who may want to know how to check if item has custom name this may be helpful: PHP: $oldname = $item->getName();if ($item->hasCustomName()) $oldname = $item->getCustomName();//rest of the code