PHP: <?phpnamespace LvL;use pocketmine\item\Item;use pocketmine\item\enchantment\Enchantment;use pocketmine\plugin\PluginBase;use pocketmine\item\enchantment\EnchantmentEntry;use pocketmine\item\enchantment\EnchantmentList;class LvL extends PluginBase { public function onEnable(){ $item = Item::GOLD_SWORD; $item->addEnchantment($enchantment); $enchantment = Enchantment::getEnchantment(9); $enchantment->setLevel(1000); }}
$item->addEnchantment($enchantment); should be after you define $enchantment, not before... Oh and you're missing a bracket and why onEnable?...
Please learn PHP. PHP executes code from front to end. That means, the first line in the function, then the second line, vice versa, is run. In your code, you attempted to use the variable $enchantment before it is defined. Furthermore, Item::GOLD_SWORD is an integer that stands for the item ID of a golden sword. You cannot call methods upon a variable (like $var->method()) unless the variable is an object. It seems like you are trying to trigger the method Item::addEnchantment(). In this case, you need to get an Item object representing a golden sword, which can be resolved through `Item::get(Item::GOLD_SWORD)`.
You are clearly trying to make a plugin without sufficient knowledge of PHP. Please learn some PHP, it will help.
Learn any programming language or writing. Who writes a story end, beginning and start? Without the characters and setting defined, you can't write a story.
But that is indeed the only answer to this question. Basically, you don't understand what you are typing. I won't help you unless you know what you are trying to do and don't know what you did wrong.