Added ability to disallow auto-kick of logged in players without using external properties, and using the event system

This commit is contained in:
Shoghi Cervantes 2014-04-04 01:59:58 +02:00
parent 076bf2f2fe
commit c6f189f93f

View File

@ -1318,11 +1318,11 @@ class Player extends Human implements CommandSender, IPlayer{
foreach($this->server->getOnlinePlayers() as $p){
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!");
if($p->kick("logged in from another location") === false){
$this->close($p->getName() . " has left the game", "already logged in");
return;
}else{
break;
}
}
}