Made Player::close() final, fixes several plugin issues that crashed the server

This commit is contained in:
Shoghi Cervantes 2015-05-28 15:03:45 +02:00
parent 0e9bff6f4e
commit c97e1fdce0

View File

@ -1519,19 +1519,19 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
return; return;
} }
if($packet->protocol1 !== ProtocolInfo::CURRENT_PROTOCOL){ if(true or $packet->protocol1 !== ProtocolInfo::CURRENT_PROTOCOL){
if($packet->protocol1 < ProtocolInfo::CURRENT_PROTOCOL){ if($packet->protocol1 < ProtocolInfo::CURRENT_PROTOCOL){
$message = "disconnectionScreen.outdatedClient"; $message = "disconnectionScreen.outdatedClient";
$pk = new PlayStatusPacket(); $pk = new PlayStatusPacket();
$pk->status = PlayStatusPacket::LOGIN_FAILED_CLIENT; $pk->status = PlayStatusPacket::LOGIN_FAILED_CLIENT;
$this->dataPacket($pk->setChannel(Network::CHANNEL_PRIORITY)); $this->directDataPacket($pk->setChannel(Network::CHANNEL_PRIORITY));
}else{ }else{
$message = "disconnectionScreen.outdatedServer"; $message = "disconnectionScreen.outdatedServer";
$pk = new PlayStatusPacket(); $pk = new PlayStatusPacket();
$pk->status = PlayStatusPacket::LOGIN_FAILED_SERVER; $pk->status = PlayStatusPacket::LOGIN_FAILED_SERVER;
$this->dataPacket($pk->setChannel(Network::CHANNEL_PRIORITY)); $this->directDataPacket($pk->setChannel(Network::CHANNEL_PRIORITY));
} }
$this->close("", $message, false); $this->close("", $message, false);
@ -1545,7 +1545,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
} }
if(strlen($packet->skin) < 64 * 32 * 4){ if(strlen($packet->skin) < 64 * 32 * 4){
$this->close("", "disconnectionScreen.invalidSkin", false); $this->close("", "disconnectionScreen.invalidSkin");
return; return;
} }
@ -2740,7 +2740,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
* @param string $reason Reason showed in console * @param string $reason Reason showed in console
* @param bool $notify * @param bool $notify
*/ */
public function close($message = "", $reason = "generic reason", $notify = true){ public final function close($message = "", $reason = "generic reason", $notify = true){
if($this->connected and !$this->closed){ if($this->connected and !$this->closed){
if($notify and strlen((string) $reason) > 0){ if($notify and strlen((string) $reason) > 0){