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

Commit

Permalink
Updated for api 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Intyre committed Feb 28, 2016
1 parent e273cfd commit 2412979
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions plugin.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: SimpleAuth
main: SimpleAuth\SimpleAuth
version: 1.7.1
api: 1.12.0
version: 1.7.2
api: 2.0.0
load: STARTUP
author: PocketMine Team
authors: [shoghicp]
Expand Down
2 changes: 1 addition & 1 deletion src/SimpleAuth/EventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function __construct(SimpleAuth $plugin){
public function onPlayerJoin(PlayerJoinEvent $event){
if($this->plugin->getConfig()->get("authenticateByLastUniqueId") === true and $event->getPlayer()->hasPermission("simpleauth.lastid")){
$config = $this->plugin->getDataProvider()->getPlayer($event->getPlayer());
if($config !== null and $config["lastip"] === $event->getPlayer()->getUniqueId()){
if($config !== null and $config["lastip"] === $event->getPlayer()->getUniqueId()->toString()){
$this->plugin->authenticatePlayer($event->getPlayer());
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/SimpleAuth/SimpleAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public function authenticatePlayer(Player $player){
$player->removeAttachment($attachment);
unset($this->needAuth[spl_object_hash($player)]);
}
$this->provider->updatePlayer($player, $player->getUniqueId(), time());
$this->provider->updatePlayer($player, $player->getUniqueId()->toString(), time());
$player->sendMessage(TextFormat::GREEN . $this->getMessage("login.success"));

$this->getMessageTask()->removePlayer($player);
Expand Down
4 changes: 2 additions & 2 deletions src/SimpleAuth/task/ShowMessageTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ public function getPlugin(){
}

public function addPlayer(Player $player){
$this->playerList[$player->getUniqueId()] = $player;
$this->playerList[$player->getUniqueId()->toString()] = $player;
}

public function removePlayer(Player $player){
unset($this->playerList[$player->getUniqueId()]);
unset($this->playerList[$player->getUniqueId()->toString()]);
}

public function onRun($currentTick){
Expand Down

4 comments on commit 2412979

@KennFatt
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error when server full 'cause toString() on null;

@FakieSui
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dunno why you would get that error

@KennFatt
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you will see that when ur server full and some players try to join

@FakieSui
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would happen when the player is kicked when server is full, the UID may be unset first so it causes an error when accessing to the variable

Please sign in to comment.