Skip to content

Commit 96f29db

Browse files
committed
Revert "Merge branch 'master' into version_1_14_60"
This reverts commit d9130f6, reversing changes made to 6a28588.
1 parent bfe26fb commit 96f29db

25 files changed

Lines changed: 85 additions & 1160 deletions

src/pocketmine/ChunkMaker.php

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,19 @@
55
use raklib\protocol\EncapsulatedPacket;
66
use raklib\RakLib;
77
use pocketmine\network\protocol\DataPacket;
8-
use pocketmine\network\ProxyInterface;
98

109
class ChunkMaker extends Thread {
1110

1211
protected $classLoader;
1312
protected $shutdown;
1413
protected $internalQueue;
1514
protected $raklib;
16-
protected $proxy;
1715

18-
public function __construct(\ClassLoader $loader, $raklib, $proxy) {
16+
public function __construct(\ClassLoader $loader, $raklib) {
1917
$this->internalQueue = new \Threaded;
2018
$this->shutdown = false;
2119
$this->classLoader = $loader;
2220
$this->raklib = $raklib;
23-
$this->proxy = $proxy;
2421
$this->start(PTHREADS_INHERIT_CONSTANTS);
2522
}
2623

@@ -41,19 +38,12 @@ public function run() {
4138
new ChunkStorage($this);
4239
}
4340

44-
public function sendData($data, $buffer) {
45-
if (!is_null($this->proxy) && !empty($data['proxySessionId']) && !empty($data['proxyId'])) {
46-
$infoData = pack('N', $data['proxySessionId']) . chr(ProxyInterface::STANDART_PACKET_ID) . $buffer;
47-
$info = chr(strlen($data['proxyId'])) . $data['proxyId'] . $infoData;
48-
$this->proxy->writeToProxyServer($info);
49-
} elseif(!is_null($this->raklib)) {
50-
$identifier = $data['identifier'];
51-
$pk = new EncapsulatedPacket();
52-
$pk->buffer = $buffer;
53-
$pk->reliability = 3;
54-
$enBuffer = chr(RakLib::PACKET_ENCAPSULATED) . chr(strlen($identifier)) . $identifier . chr(RakLib::PRIORITY_NORMAL) . $pk->toBinary(true);
55-
$this->raklib->pushMainToThreadPacket($enBuffer);
56-
}
41+
public function sendData($identifier, $buffer) {
42+
$pk = new EncapsulatedPacket();
43+
$pk->buffer = $buffer;
44+
$pk->reliability = 3;
45+
$enBuffer = chr(RakLib::PACKET_ENCAPSULATED) . chr(strlen($identifier)) . $identifier . chr(RakLib::PRIORITY_NORMAL) . $pk->toBinary(true);
46+
$this->raklib->pushMainToThreadPacket($enBuffer);
5747
}
5848

5949
public function pushMainToThreadPacket($data) {

src/pocketmine/ChunkStorage.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ protected function clearChunkCache($data) {
5151

5252
protected function sendFromCache($data) {
5353
$buffer = $this->getCache(Level::chunkHash($data['chunkX'], $data['chunkZ']), ($data['protocol'] << 4) | $data['subClientId']);
54-
$this->server->sendData($data, $buffer);
54+
$this->server->sendData($data['identifier'], $buffer);
5555
}
5656

5757
protected function doChunk($data) {
@@ -103,7 +103,7 @@ protected function doChunk($data) {
103103
$buffer = $pk->getBuffer();
104104
$decodedBuffer = Binary::writeVarInt(strlen($buffer)) . $buffer;
105105
$buffer = zlib_encode($decodedBuffer, ZLIB_ENCODING_DEFLATE, 7);
106-
$this->server->sendData($data, $buffer);
106+
$this->server->sendData($data['identifier'], $buffer);
107107
$this->setCache(Level::chunkHash($data['chunkX'], $data['chunkZ']), ($protocol << 4) | $subClientId, $buffer);
108108
}
109109

src/pocketmine/PacketMaker.php

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,19 @@
1010
use pocketmine\network\protocol\MoveEntityPacket;
1111
use pocketmine\network\protocol\SetEntityMotionPacket;
1212
use pocketmine\network\protocol\MovePlayerPacket;
13-
use pocketmine\network\proxylib\ProxyServer;
14-
use pocketmine\network\ProxyInterface;
1513

1614
class PacketMaker extends Thread {
1715

1816
protected $classLoader;
1917
protected $shutdown;
2018
protected $internalQueue;
2119
protected $raklib;
22-
protected $proxy;
2320

24-
public function __construct(\ClassLoader $loader, $raklib, $proxy) {
21+
public function __construct(\ClassLoader $loader, $raklib) {
2522
$this->internalQueue = new \Threaded;
2623
$this->shutdown = false;
2724
$this->classLoader = $loader;
2825
$this->raklib = $raklib;
29-
$this->proxy = $proxy;
3026
$this->start(PTHREADS_INHERIT_CONSTANTS);
3127
}
3228

@@ -110,23 +106,17 @@ protected function checkPacket($data) {
110106
}
111107
if (!empty($moveStr)) {
112108
$buffer = zlib_encode($moveStr, ZLIB_ENCODING_DEFLATE, 7);
113-
$this->sendData($identifier, $buffer, $playerData);
109+
$this->sendData($identifier, $buffer);
114110
}
115111
}
116112
}
117113

118-
protected function sendData($identifier, $buffer, $data) {
119-
if (!is_null($this->proxy) && !empty($data['proxySessionId']) && !empty($data['proxyId'])) {
120-
$infoData = pack('N', $data['proxySessionId']) . chr(ProxyInterface::STANDART_PACKET_ID) . $buffer;
121-
$info = chr(strlen($data['proxyId'])) . $data['proxyId'] . $infoData;
122-
$this->proxy->writeToProxyServer($info);
123-
} elseif(!is_null($this->raklib)) {
124-
$pk = new EncapsulatedPacket();
125-
$pk->buffer = $buffer;
126-
$pk->reliability = 3;
127-
$enBuffer = chr(RakLib::PACKET_ENCAPSULATED) . chr(strlen($identifier)) . $identifier . chr(RakLib::PRIORITY_NORMAL) . $pk->toBinary(true);
128-
$this->raklib->pushMainToThreadPacket($enBuffer);
129-
}
114+
protected function sendData($identifier, $buffer) {
115+
$pk = new EncapsulatedPacket();
116+
$pk->buffer = $buffer;
117+
$pk->reliability = 3;
118+
$enBuffer = chr(RakLib::PACKET_ENCAPSULATED) . chr(strlen($identifier)) . $identifier . chr(RakLib::PRIORITY_NORMAL) . $pk->toBinary(true);
119+
$this->raklib->pushMainToThreadPacket($enBuffer);
130120
}
131121

132122
}

0 commit comments

Comments
 (0)