InfinityGamers / HungerGames-UPDATED

A HungerGames plugin for PocketMine-MP developed by xBeastMode
45 stars 24 forks source link

Clearing Inventory #53

Closed Haxley closed 7 years ago

Haxley commented 7 years ago

Now clears a players inventory when they login, win a match, or win a deathmatch.

(Also realized my previous pull request changed playerQuitEvent() instead of playerDeathEvent(). My GitHub desktop doesn't seem to be working so I've been applying local changes to GitHub changes manually using web editor and changed the wrong event. Not sure how I missed this last week lol. Probably because I was testing removePlayerWithoutTeleport() on playerQuitEvent() at the time I was committing it to playerDeathEvent())

xBeastMode commented 7 years ago

Thanks. :D This will be temporary code fix until I update it.

Haxley commented 7 years ago

Cool. Somewhat related to this, do you know why adding $p->teleport($p->getLevel()->getSafeSpawn()); to onSpawn() event doesn't work? In testing, it appears that they it does work at first and they are at the spawn when they login but immediately teleport to where they were when they logged off. This can only be observed through the eyes of another player watching a person log in. From the perspective of the player who just logged in, they're always where they last logged off.

 public function onSpawn(PlayerJoinEvent $e){
      $p = $e->getPlayer();
      $p->teleport($p->getLevel()->getSafeSpawn());
      $p->getInventory()->clearAll();
    }