mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-17 08:54:22 +00:00
Faster-Network now usable!
This commit is contained in:
parent
1f5ff78f06
commit
8b87733082
@ -256,7 +256,7 @@ class ServerAPI{
|
|||||||
"memory_usage" => memory_get_usage(true),
|
"memory_usage" => memory_get_usage(true),
|
||||||
"php_version" => PHP_VERSION,
|
"php_version" => PHP_VERSION,
|
||||||
"version" => MAJOR_VERSION,
|
"version" => MAJOR_VERSION,
|
||||||
"ProtocolInfo::version_PACKET" => CURRENT_MINECRAFT_VERSION,
|
"mc_version" => CURRENT_MINECRAFT_VERSION,
|
||||||
"protocol" => ProtocolInfo::CURRENT_PROTOCOL,
|
"protocol" => ProtocolInfo::CURRENT_PROTOCOL,
|
||||||
"online" => count($this->server->clients),
|
"online" => count($this->server->clients),
|
||||||
"max" => $this->server->maxClients,
|
"max" => $this->server->maxClients,
|
||||||
|
@ -125,13 +125,13 @@ class DoorBlock extends TransparentBlock{
|
|||||||
$this->level->setBlock($down, BlockAPI::get($this->id, $meta), true, false, true);
|
$this->level->setBlock($down, BlockAPI::get($this->id, $meta), true, false, true);
|
||||||
$players = ServerAPI::request()->api->player->getAll($this->level);
|
$players = ServerAPI::request()->api->player->getAll($this->level);
|
||||||
unset($players[$player->CID]);
|
unset($players[$player->CID]);
|
||||||
ServerAPI::request()->api->player->broadcastPacket($players, ProtocolInfo::LEVEL_EVENT_PACKET, array(
|
$pk = new LevelEventPacket;
|
||||||
"x" => $this->x,
|
$pk->x = $this->x;
|
||||||
"y" => $this->y,
|
$pk->y = $this->y;
|
||||||
"z" => $this->z,
|
$pk->z = $this->z;
|
||||||
"evid" => 1003,
|
$pk->evid = 1003;
|
||||||
"data" => 0
|
$pk->data = 0;
|
||||||
));
|
ServerAPI::request()->api->player->broadcastPacket($players, $pk);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -140,13 +140,13 @@ class DoorBlock extends TransparentBlock{
|
|||||||
$this->level->setBlock($this, $this, true, false, true);
|
$this->level->setBlock($this, $this, true, false, true);
|
||||||
$players = ServerAPI::request()->api->player->getAll($this->level);
|
$players = ServerAPI::request()->api->player->getAll($this->level);
|
||||||
unset($players[$player->CID]);
|
unset($players[$player->CID]);
|
||||||
ServerAPI::request()->api->player->broadcastPacket($players, ProtocolInfo::LEVEL_EVENT_PACKET, array(
|
$pk = new LevelEventPacket;
|
||||||
"x" => $this->x,
|
$pk->x = $this->x;
|
||||||
"y" => $this->y,
|
$pk->y = $this->y;
|
||||||
"z" => $this->z,
|
$pk->z = $this->z;
|
||||||
"evid" => 1003,
|
$pk->evid = 1003;
|
||||||
"data" => 0
|
$pk->data = 0;
|
||||||
));
|
ServerAPI::request()->api->player->broadcastPacket($players, ProtocolInfo::LEVEL_EVENT_PACKET, $pk);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -29,9 +29,9 @@ class BedBlock extends TransparentBlock{
|
|||||||
|
|
||||||
public function onActivate(Item $item, Player $player){
|
public function onActivate(Item $item, Player $player){
|
||||||
if(ServerAPI::request()->api->time->getPhase($player->level) !== "night"){
|
if(ServerAPI::request()->api->time->getPhase($player->level) !== "night"){
|
||||||
$player->dataPacket(ProtocolInfo::CHAT_PACKET, array(
|
$pk = new ChatPacket;
|
||||||
"message" => "You can only sleep at night"
|
$pk->message = "You can only sleep at night";
|
||||||
));
|
$player->dataPacket($pk);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,17 +51,17 @@ class BedBlock extends TransparentBlock{
|
|||||||
}elseif($blockWest->getID() === $this->id and ($blockWest->meta & 0x08) === 0x08){
|
}elseif($blockWest->getID() === $this->id and ($blockWest->meta & 0x08) === 0x08){
|
||||||
$b = $blockWest;
|
$b = $blockWest;
|
||||||
}else{
|
}else{
|
||||||
$player->dataPacket(ProtocolInfo::CHAT_PACKET, array(
|
$pk = new ChatPacket;
|
||||||
"message" => "The bed is incomplete"
|
$pk->message = "This bed is incomplete";
|
||||||
));
|
$player->dataPacket($pk);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($player->sleepOn($b) === false){
|
if($player->sleepOn($b) === false){
|
||||||
$player->dataPacket(ProtocolInfo::CHAT_PACKET, array(
|
$pk = new ChatPacket;
|
||||||
"message" => "This bed is occupied"
|
$pk->message = "This bed is occupied";
|
||||||
));
|
$player->dataPacket($pk);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user