mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-23 21:19:44 +00:00
cs fix
This commit is contained in:
parent
26cafcab00
commit
1e85a65764
52 changed files with 2400 additions and 2406 deletions
|
|
@ -1348,7 +1348,7 @@ class Player{
|
||||||
++$packets;
|
++$packets;
|
||||||
$moveSent = true;
|
$moveSent = true;
|
||||||
|
|
||||||
}else if($this->PROTOCOL > ProtocolInfo12::CURRENT_PROTOCOL_12 && $e->headYaw != $e->lastHeadYaw){
|
}elseif($this->PROTOCOL > ProtocolInfo12::CURRENT_PROTOCOL_12 && $e->headYaw != $e->lastHeadYaw){
|
||||||
$headyaw = new RotateHeadPacket();
|
$headyaw = new RotateHeadPacket();
|
||||||
$headyaw->eid = $e->eid;
|
$headyaw->eid = $e->eid;
|
||||||
$headyaw->yaw = $e->headYaw;
|
$headyaw->yaw = $e->headYaw;
|
||||||
|
|
@ -1469,7 +1469,6 @@ class Player{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function directDataPacket(RakNetDataPacket $packet, $reliability = 0, $recover = true){
|
public function directDataPacket(RakNetDataPacket $packet, $reliability = 0, $recover = true){
|
||||||
if($this->connected === false){
|
if($this->connected === false){
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -1622,7 +1621,6 @@ class Player{
|
||||||
|
|
||||||
$this->server->api->player->saveOffline($this->data);
|
$this->server->api->player->saveOffline($this->data);
|
||||||
|
|
||||||
|
|
||||||
$pk = new LoginStatusPacket;
|
$pk = new LoginStatusPacket;
|
||||||
$pk->status = 0;
|
$pk->status = 0;
|
||||||
$this->dataPacket($pk);
|
$this->dataPacket($pk);
|
||||||
|
|
@ -1667,9 +1665,9 @@ class Player{
|
||||||
$this->spawnPosition = new Position($this->data->get("spawn")["x"], $this->data->get("spawn")["y"], $this->data->get("spawn")["z"], $level);
|
$this->spawnPosition = new Position($this->data->get("spawn")["x"], $this->data->get("spawn")["y"], $this->data->get("spawn")["z"], $level);
|
||||||
|
|
||||||
$pk = new SetSpawnPositionPacket;
|
$pk = new SetSpawnPositionPacket;
|
||||||
$pk->x = (int)$this->spawnPosition->x;
|
$pk->x = (int) $this->spawnPosition->x;
|
||||||
$pk->y = (int)$this->spawnPosition->y;
|
$pk->y = (int) $this->spawnPosition->y;
|
||||||
$pk->z = (int)$this->spawnPosition->z;
|
$pk->z = (int) $this->spawnPosition->z;
|
||||||
$this->dataPacket($pk);
|
$this->dataPacket($pk);
|
||||||
}
|
}
|
||||||
$this->entity->check = false;
|
$this->entity->check = false;
|
||||||
|
|
@ -1694,7 +1692,6 @@ class Player{
|
||||||
$pk->started = !$this->level->isTimeStopped();
|
$pk->started = !$this->level->isTimeStopped();
|
||||||
$this->dataPacket($pk);
|
$this->dataPacket($pk);
|
||||||
|
|
||||||
|
|
||||||
console("[INFO] " . FORMAT_AQUA . $this->username . FORMAT_RESET . "[/" . $this->ip . ":" . $this->port . "] logged in with entity id " . $this->eid . " at (" . $this->entity->level->getName() . ", " . round($this->entity->x, 2) . ", " . round($this->entity->y, 2) . ", " . round($this->entity->z, 2) . ")");
|
console("[INFO] " . FORMAT_AQUA . $this->username . FORMAT_RESET . "[/" . $this->ip . ":" . $this->port . "] logged in with entity id " . $this->eid . " at (" . $this->entity->level->getName() . ", " . round($this->entity->x, 2) . ", " . round($this->entity->y, 2) . ", " . round($this->entity->z, 2) . ")");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1834,7 +1831,6 @@ class Player{
|
||||||
|
|
||||||
$this->server->api->player->saveOffline($this->data);
|
$this->server->api->player->saveOffline($this->data);
|
||||||
|
|
||||||
|
|
||||||
$pk = new LoginStatusPacket;
|
$pk = new LoginStatusPacket;
|
||||||
$pk->status = 0;
|
$pk->status = 0;
|
||||||
$this->dataPacket($pk);
|
$this->dataPacket($pk);
|
||||||
|
|
@ -1879,9 +1875,9 @@ class Player{
|
||||||
$this->spawnPosition = new Position($this->data->get("spawn")["x"], $this->data->get("spawn")["y"], $this->data->get("spawn")["z"], $level);
|
$this->spawnPosition = new Position($this->data->get("spawn")["x"], $this->data->get("spawn")["y"], $this->data->get("spawn")["z"], $level);
|
||||||
|
|
||||||
$pk = new SetSpawnPositionPacket;
|
$pk = new SetSpawnPositionPacket;
|
||||||
$pk->x = (int)$this->spawnPosition->x;
|
$pk->x = (int) $this->spawnPosition->x;
|
||||||
$pk->y = (int)$this->spawnPosition->y;
|
$pk->y = (int) $this->spawnPosition->y;
|
||||||
$pk->z = (int)$this->spawnPosition->z;
|
$pk->z = (int) $this->spawnPosition->z;
|
||||||
$this->dataPacket($pk);
|
$this->dataPacket($pk);
|
||||||
}
|
}
|
||||||
$this->entity->check = false;
|
$this->entity->check = false;
|
||||||
|
|
@ -1906,7 +1902,6 @@ class Player{
|
||||||
$pk->started = !$this->level->isTimeStopped();
|
$pk->started = !$this->level->isTimeStopped();
|
||||||
$this->dataPacket($pk);
|
$this->dataPacket($pk);
|
||||||
|
|
||||||
|
|
||||||
console("[INFO] " . FORMAT_AQUA . $this->username . FORMAT_RESET . "[/" . $this->ip . ":" . $this->port . "] logged in with entity id " . $this->eid . " at (" . $this->entity->level->getName() . ", " . round($this->entity->x, 2) . ", " . round($this->entity->y, 2) . ", " . round($this->entity->z, 2) . ")");
|
console("[INFO] " . FORMAT_AQUA . $this->username . FORMAT_RESET . "[/" . $this->ip . ":" . $this->port . "] logged in with entity id " . $this->eid . " at (" . $this->entity->level->getName() . ", " . round($this->entity->x, 2) . ", " . round($this->entity->y, 2) . ", " . round($this->entity->z, 2) . ")");
|
||||||
break;
|
break;
|
||||||
case ProtocolInfo::READY_PACKET:
|
case ProtocolInfo::READY_PACKET:
|
||||||
|
|
@ -1932,7 +1927,7 @@ class Player{
|
||||||
//$this->server->schedule(5, [$this->entity, "update"], [], true);
|
//$this->server->schedule(5, [$this->entity, "update"], [], true);
|
||||||
//$this->server->schedule(2, [$this->entity, "updateMovement"], [], true);
|
//$this->server->schedule(2, [$this->entity, "updateMovement"], [], true);
|
||||||
$this->sendArmor();
|
$this->sendArmor();
|
||||||
$array = explode("@n", (string)$this->server->motd);
|
$array = explode("@n", (string) $this->server->motd);
|
||||||
foreach ($array as $msg) {
|
foreach ($array as $msg) {
|
||||||
$this->sendChat($msg . "\n");
|
$this->sendChat($msg . "\n");
|
||||||
}
|
}
|
||||||
|
|
@ -2007,11 +2002,10 @@ class Player{
|
||||||
$this->slot = -1;
|
$this->slot = -1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} else if ($packet->slot > 0) {
|
} elseif ($packet->slot > 0) {
|
||||||
$packet->slot -= 9;
|
$packet->slot -= 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (($this->gamemode & 0x01) === SURVIVAL) {
|
if (($this->gamemode & 0x01) === SURVIVAL) {
|
||||||
$data["item"] = $this->getSlot($packet->slot);
|
$data["item"] = $this->getSlot($packet->slot);
|
||||||
if (!($data["item"] instanceof Item)) {
|
if (!($data["item"] instanceof Item)) {
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ class ContainerSetContentPacket extends RakNetDataPacket{
|
||||||
return ProtocolInfo7::CONTAINER_SET_CONTENT_PACKET;
|
return ProtocolInfo7::CONTAINER_SET_CONTENT_PACKET;
|
||||||
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||||
return ProtocolInfo9::CONTAINER_SET_CONTENT_PACKET;
|
return ProtocolInfo9::CONTAINER_SET_CONTENT_PACKET;
|
||||||
}else if($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
return ProtocolInfo12::CONTAINER_SET_CONTENT_PACKET;
|
return ProtocolInfo12::CONTAINER_SET_CONTENT_PACKET;
|
||||||
}
|
}
|
||||||
return ProtocolInfo::CONTAINER_SET_CONTENT_PACKET;
|
return ProtocolInfo::CONTAINER_SET_CONTENT_PACKET;
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ class ContainerSetDataPacket extends RakNetDataPacket{
|
||||||
return ProtocolInfo7::CONTAINER_SET_DATA_PACKET;
|
return ProtocolInfo7::CONTAINER_SET_DATA_PACKET;
|
||||||
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||||
return ProtocolInfo9::CONTAINER_SET_DATA_PACKET;
|
return ProtocolInfo9::CONTAINER_SET_DATA_PACKET;
|
||||||
}else if($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
return ProtocolInfo12::CONTAINER_SET_DATA_PACKET;
|
return ProtocolInfo12::CONTAINER_SET_DATA_PACKET;
|
||||||
}
|
}
|
||||||
return ProtocolInfo::CONTAINER_SET_DATA_PACKET;
|
return ProtocolInfo::CONTAINER_SET_DATA_PACKET;
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ class SendInventoryPacket extends RakNetDataPacket{
|
||||||
return ProtocolInfo7::SEND_INVENTORY_PACKET;
|
return ProtocolInfo7::SEND_INVENTORY_PACKET;
|
||||||
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
}elseif($this->PROTOCOL < ProtocolInfo12::CURRENT_PROTOCOL_12){
|
||||||
return ProtocolInfo9::SEND_INVENTORY_PACKET;
|
return ProtocolInfo9::SEND_INVENTORY_PACKET;
|
||||||
}else if($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
}elseif($this->PROTOCOL < ProtocolInfo::CURRENT_PROTOCOL){
|
||||||
return ProtocolInfo12::SEND_INVENTORY_PACKET;
|
return ProtocolInfo12::SEND_INVENTORY_PACKET;
|
||||||
}
|
}
|
||||||
return ProtocolInfo::SEND_INVENTORY_PACKET;
|
return ProtocolInfo::SEND_INVENTORY_PACKET;
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ class RakNetParser{
|
||||||
private $isparse = false;
|
private $isparse = false;
|
||||||
|
|
||||||
public function __construct(&$buffer, $source){
|
public function __construct(&$buffer, $source){
|
||||||
$this->source =& $source;
|
$this->source = &$source;
|
||||||
$this->buffer =& $buffer;
|
$this->buffer = &$buffer;
|
||||||
$this->offset = 0;
|
$this->offset = 0;
|
||||||
if(strlen($this->buffer) > 0){
|
if(strlen($this->buffer) > 0){
|
||||||
$this->parse();
|
$this->parse();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue