Skip to content
This repository has been archived by the owner on Jun 12, 2018. It is now read-only.

Commit

Permalink
Fix errors if player is kicked before player joined
Browse files Browse the repository at this point in the history
  • Loading branch information
DaPigGuy committed Apr 17, 2017
1 parent 2b462dd commit add5e40
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: PiggyAuth
main: PiggyAuth\Main
version: 3.0.0.12
version: 3.0.0.13
api: [2.0.0, 3.0.0-ALPHA1, 3.0.0-ALPHA2, 3.0.0-ALPHA3, 3.0.0-ALPHA4, 3.0.0-APLHA5]
load: POSTWORLD
author: MCPEPIG
Expand Down
24 changes: 13 additions & 11 deletions src/PiggyAuth/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -775,18 +775,20 @@ public function logout(Player $player, $quit = true)
if ($this->sessionmanager->getSession($player) !== null && $this->sessionmanager->getSession($player)->isAuthenticated()) {
$this->sessionmanager->getSession($player)->setAuthenticated(false);
} else {
if ($this->getConfig()->getNested("login.adventure-mode")) {
if($this->sessionmanager->getSession($player)->getGamemode() !== null) {
$player->setGamemode($this->sessionmanager->getSession($player)->getGamemode());
$this->sessionmanager->getSession($player)->setGamemode(null);
if($this->sessionmanager->getSession($player) !== null) {
if ($this->getConfig()->getNested("login.adventure-mode")) {
if ($this->sessionmanager->getSession($player)->getGamemode() !== null) {
$player->setGamemode($this->sessionmanager->getSession($player)->getGamemode());
$this->sessionmanager->getSession($player)->setGamemode(null);
}
}
$this->sessionmanager->getSession($player)->setMessageTick(0);
$this->sessionmanager->getSession($player)->setTimeoutTick(0);
$this->sessionmanager->getSession($player)->setTries(0);
if ($this->getConfig()->getNested("message.boss-bar")) {
$this->sessionmanager->getSession($player)->getWither()->kill();
$this->sessionmanager->getSession($player)->setWither(null);
}
}
$this->sessionmanager->getSession($player)->setMessageTick(0);
$this->sessionmanager->getSession($player)->setTimeoutTick(0);
$this->sessionmanager->getSession($player)->setTries(0);
if ($this->getConfig()->getNested("message.boss-bar")) {
$this->sessionmanager->getSession($player)->getWither()->kill();
$this->sessionmanager->getSession($player)->setWither(null);
}
}
if ($quit !== true) {
Expand Down

0 comments on commit add5e40

Please sign in to comment.