Disallow duplicate usernames and block new player

This commit is contained in:
williamtdr 2014-04-03 18:14:36 -05:00
parent 7a163f9ea5
commit 327d183bed

View File

@ -1317,8 +1317,13 @@ class Player extends Human implements CommandSender, IPlayer{
}
foreach($this->server->getOnlinePlayers() as $p){
if($p !== $this and strtolower($p->getName()) === strtolower($this->getName()) && $this->server->getConfigBoolean("kick-duplicate-names",true)){
$p->close($p->getName() . " has left the game", "logged in from another location");
if($p !== $this and strtolower($p->getName()) === strtolower($this->getName())){
if($this->server->getConfigBoolean("kick-duplicate-names",true)) {
$p->close($p->getName() . " has left the game", "logged in from another location");
} else {
$this->close($this->username . " has left the game", "You are already logged on!");
return;
}
}
}