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