Fixes sending newlines on messages to impersonate chat messages

This commit is contained in:
Shoghi Cervantes 2015-05-23 12:03:47 +02:00
parent 7201372b0d
commit 5ad4f44dce
No known key found for this signature in database
GPG Key ID: 78464DB0A7837F89

View File

@ -2357,8 +2357,8 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
$this->craftingType = 0;
if($packet->type === TextPacket::TYPE_CHAT){
$packet->message = TextFormat::clean($packet->message, $this->removeFormat);
if(trim($packet->message) != "" and strlen($packet->message) <= 255){
$message = $packet->message;
foreach(explode("\n", $packet->message) as $message){
if(trim($message) != "" and strlen($message) <= 255){
$this->server->getPluginManager()->callEvent($ev = new PlayerCommandPreprocessEvent($this, $message));
if($ev->isCancelled()){
break;
@ -2375,6 +2375,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
}
}
}
}
break;
case ProtocolInfo::CONTAINER_CLOSE_PACKET:
if($this->spawned === false or $packet->windowid === 0){