Ok this title might be slightly wrong but I didn't know what to call this. Anyways I have this code: PHP: public function onInteract(PlayerInteractEvent $event){ $player = $event->getPlayer(); $block = $event->getBlock(); $level = $this->getServer()->getDefaultLevel(); $this->mode = 0; if($block->getId() == 46) { if($this->mode>=0&&$this->mode<=1000) { $this->mode++; $this->text->setText("§aYour score: §e" . $this->mode . ""); $level->addParticle($this->text); $player->sendPopup("score:" . $this->mode . ""); } } }} So atm if a player taps TNT(46) it will make $this->mode increase everytime it is tapped. However this is the problem: if a player taps the tnt it will become 1 and then if another player comes along it becomes 2. I want each player to have their own seperate. so what I'm wanting to do is make $this->mode per player. hope that was understandable
Use an integer array instead of a single integer. Use the player entity ID ($player->getId()) as the index, and make sure you clear them when player quits to prevent memory leak.
https://forums.pmmp.io/threads/handling-data-with-data-objects-and-managing-player-sessions.324/ this might help