I keep getting this annoying warning and i dont know how to fix it. Spoiler: WARNING Warning: Creating default object from empty value in /home/icefac/plugins/Core/src/Junkdude/Utils.php on line 168 Here's the code btw. PHP: case 1: $book->setCustomName(TF::YELLOW."Custom Enchant Book"."\n".TF::GREEN."Blindness I"); $book->addEnchantment(Enchantment::getEnchantment(101)->setLevel(1)); $tag = $book->getNamedTag() ?? new CompoundTag("", []); $tag->namedtag->cebook = new IntTag("cebook", 1); $book->addEnchantment(Enchantment::getEnchantment(100)->setLevel(1)); $book->setNamedTag($tag); $p->getInventory()->addItem($book); return;
Read the error. "Empty object". Now i could be wrong, but this looks like an empty object new CompoundTag("", []); (the [] bit)