mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-13 05:15:13 +00:00
Fixed random timeout #11
This commit is contained in:
parent
0ed130e7fd
commit
3e54ceb8a3
@ -77,6 +77,6 @@ How to contact me
|
|||||||
Third-party Tools:
|
Third-party Tools:
|
||||||
------------------
|
------------------
|
||||||
* [How to connect to internet servers](http://www.minecraftforum.net/topic/1256915-legit-minecraftpe-online-multiplayer/)
|
* [How to connect to internet servers](http://www.minecraftforum.net/topic/1256915-legit-minecraftpe-online-multiplayer/)
|
||||||
* OBSOLETE [Video-Tutorial made by ChrisMCMine](http://www.youtube.com/watch?v=GC9MBVaHge0)
|
* [Video-Tutorial made by ChrisMCMine](http://www.youtube.com/watch?v=GC9MBVaHge0)
|
||||||
* [User-made program to merge server I/O done in C++](https://github.com/filfat/MCPES_CPP_INPUT/)
|
* [User-made program to merge server I/O done in C++](https://github.com/filfat/MCPES_CPP_INPUT/)
|
||||||
* [Proxy to allow devices in your local network join online servers using node.js](https://github.com/brandon15811/Minecraft-PE-Proxy)
|
* [Proxy to allow devices in your local network join online servers using node.js](https://github.com/brandon15811/Minecraft-PE-Proxy)
|
1
TODO
1
TODO
@ -1,5 +1,4 @@
|
|||||||
- Fix spawn position resetting
|
- Fix spawn position resetting
|
||||||
- Mob spawning, item pick up
|
- Mob spawning, item pick up
|
||||||
- Fix incorrect timeout
|
|
||||||
- Inventory loading and saving
|
- Inventory loading and saving
|
||||||
- Entity saving
|
- Entity saving
|
@ -298,7 +298,6 @@ class PocketMinecraftServer extends stdClass{
|
|||||||
$this->loadEvents();
|
$this->loadEvents();
|
||||||
declare(ticks=15);
|
declare(ticks=15);
|
||||||
register_tick_function(array($this, "tick"));
|
register_tick_function(array($this, "tick"));
|
||||||
$this->event("onTick", "tickerFunction", true);
|
|
||||||
register_shutdown_function(array($this, "close"));
|
register_shutdown_function(array($this, "close"));
|
||||||
console("[INFO] Server started!");
|
console("[INFO] Server started!");
|
||||||
$this->process();
|
$this->process();
|
||||||
@ -309,6 +308,7 @@ class PocketMinecraftServer extends stdClass{
|
|||||||
if($this->lastTick <= ($time - 0.05)){
|
if($this->lastTick <= ($time - 0.05)){
|
||||||
$this->tickMeasure[] = $this->lastTick = $time;
|
$this->tickMeasure[] = $this->lastTick = $time;
|
||||||
array_shift($this->tickMeasure);
|
array_shift($this->tickMeasure);
|
||||||
|
$this->tickerFunction($time);
|
||||||
$this->trigger("onTick", $time);
|
$this->trigger("onTick", $time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,10 @@ class Session{
|
|||||||
$this->counter = array(0, 0);
|
$this->counter = array(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onTick($time){
|
public function onTick($time, $event){
|
||||||
|
if($event !== "onTick"){
|
||||||
|
return;
|
||||||
|
}
|
||||||
if($time > $this->timeout){
|
if($time > $this->timeout){
|
||||||
$this->close("timeout");
|
$this->close("timeout");
|
||||||
}else{
|
}else{
|
||||||
@ -169,7 +172,7 @@ class Session{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handle($pid, &$data){
|
public function handle($pid, $data){
|
||||||
if($this->connected === true){
|
if($this->connected === true){
|
||||||
$this->timeout = microtime(true) + 25;
|
$this->timeout = microtime(true) + 25;
|
||||||
switch($pid){
|
switch($pid){
|
||||||
@ -397,7 +400,7 @@ class Session{
|
|||||||
$this->buffer[$count] = array($id, $data);
|
$this->buffer[$count] = array($id, $data);
|
||||||
}
|
}
|
||||||
$data["id"] = $id;
|
$data["id"] = $id;
|
||||||
$this->send(0x84, array(
|
$this->send(0x80, array(
|
||||||
$count,
|
$count,
|
||||||
0x00,
|
0x00,
|
||||||
$data,
|
$data,
|
||||||
|
@ -12,7 +12,7 @@ debug=2
|
|||||||
max-players=20
|
max-players=20
|
||||||
server-type=normal
|
server-type=normal
|
||||||
time-per-second=20
|
time-per-second=20
|
||||||
gamemode=0
|
gamemode=1
|
||||||
difficulty=1
|
difficulty=1
|
||||||
seed=false
|
seed=false
|
||||||
level-name=false
|
level-name=false
|
||||||
|
Loading…
x
Reference in New Issue
Block a user