So I made this plugin straight from scratch it enables no errors but the actual interactions dont work. When I click netherstar it doesnt give me the other wools when I click a wool it does do the dispatchCommand. Please help thanks. PHP: <?phpnamespace havtic;use pocketmine\Player;use pocketmine\event\Listener;use pocketmine\event\PlayerInteractEvent;use pocketmine\Server;use pocketmine\utils\TextFormat as c;use pocketmine\plugin\PluginBase;use pocketmine\event\EntityDamageEvent;use pocketmine\event\EntityDamageByEntityEvent;class Main extends PluginBase implements Listener{ public function onEnable() { $this->getServer()->getPluginManager()->registerEvents($this,$this); } public function onInteract(PlayerInteractEvent $event) { $player = $event->getPlayer(); $giver = $event->getItem(); if($giver->getId() === Item::NETHER_STAR){//Item that gives the other wools $player->getInventory()->removeItem($giver); $player->sendMessage(c::RED."Select a rank to pick a kit"); $player->getInventory()->addItem(Item::get(35,0,1));//Guest $player->getInventory()->addItem(Item::get(35,13,1));//VIP $player->getInventory()->addItem(Item::get(35,3,1));//MVP $player->getInventory()->addItem(Item::get(35,10,1));//Valor } $white = $event->getItem(); if($white->getId() === Item::get(35,0,1)){ $player->getInventory()->removeItem($white); $player->getInventory()->removeItem(Item::get(35,13,1)); $player->getInventory()->removeItem(Item::get(35,3,1)); $player->getInventory()->removeItem(Item::get(35,10,1)); $this->getServer()->dispatchCommand($event->getPlayer(), "kit"); } $green = $event->getItem(); if($green->getId() === Item::get(35,13,1)){ $player->getInventory()->removeItem($green); $player->getInventory()->removeItem(Item::get(35,0,1)); $player->getInventory()->removeItem(Item::get(35,3,1)); $player->getInventory()->removeItem(Item::get(35,10,1)); $this->getServer()->dispatchCommand($event->getPlayer(), "kit"); } $blue = $event->getItem(); if($blue->getId() === Item::get(35,3,1)){ $player->getInventory()->removeItem($blue); $player->getInventory()->removeItem(Item::get(35,13,1)); $player->getInventory()->removeItem(Item::get(35,0,1)); $player->getInventory()->removeItem(Item::get(35,10,1)); $this->getServer()->dispatchCommand($event->getPlayer(), "kit"); } $purple = $event-> getItem(); if($purple->getId() === Item::get(35,10,1)){ $player->getInventory()->removeItem($purple); $player->getInventory()->removeItem(Item::get(35,13,1)); $player->getInventory()->removeItem(Item::get(35,3,1)); $player->getInventory()->removeItem(Item::get(35,0,1)); $this->getServer()->dispatchCommand($event->getPlayer(), "kit"); } }}
I'm on my phone but.. PHP: onInteract$item = $player->getInventory()->getItemInHand()->getId();if($item == netherstar id){$player->getInventory()->addItem(Item::get(wool id);}eseif($item == wool id){// do stuff}
Do I just get the id then? I just thought I had to do that becauss of an old plugin I made I did that but didnt remember I thought it was just for getting the item to interact with. Can you please help me fix and understand it?