PHP: public function onJoin(PlayerJoinEvent $event){ $this->Items($player);}public function $items ($player){ if($player->getLevel()->getName() == "/**level name**/"){ $player->getInventory()->addItem(Item::get(345, 0, 1)->setCustomName(C::GREEN . "/**Custom name here*/")); }} P.S. It's a little messy and I could've written it better though.
public function onJoin(PlayerJoinEvent $event) { $player = $event->getPlayer(); if($player->getLevelByName() == "world") { $this->Items($player); } } public function Items(Player $player){ $item = Item::get(Id,Damage,Count); $item->setCustomName("Epic"); $player->getInventory()->addItem($item); }
To spawn an Item Entity, you can use $level->dropItem. It requires a Vector3 parameter and an Item parameter. Optionally, you can add Motion to the item and/or a pickup delay. The Item object you use will retain it's NBT tags. If you want to spawn a visible name above the entity, you can use a floating text particle.
PHP: //Item$player->getLevel()->dropItem(Vector3($player->x, $player->y, $player-z), Item;;get(Item;;PAPER,0,1));//Floating Text$player->getLevel()->addParticle(new FloatingTextParticle(Vector3($player->x, $player->y + 2, $player-z); "This is an example");