Added an exception throw for accessing permissions of closed players

This commit is contained in:
Dylan K. Taylor 2017-02-28 10:49:09 +00:00
parent c3fb2e9f23
commit d588222e84

View File

@ -465,8 +465,13 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
* @param permission\Permission|string $name
*
* @return bool
*
* @throws \InvalidStateException if the player is closed
*/
public function hasPermission($name){
if($this->closed){
throw new \InvalidStateException("Trying to get permissions of closed player");
}
return $this->perm->hasPermission($name);
}