Skip to content
Permalink
Browse files

Update to pas/Asyncore 2.0

  • Loading branch information
timmyRS committed Jan 11, 2020
1 parent 11f6d98 commit 01095239379217113780cb94223d36fbf9f9f870
Showing with 14 additions and 15 deletions.
  1. +1 −1 composer.json
  2. +2 −2 src/Account.php
  3. +2 −2 src/ClientConnection.php
  4. +2 −2 src/Configuration.php
  5. +4 −4 src/FancyUserInterface.php
  6. +1 −1 src/PlainUserInterface.php
  7. +2 −3 src/Server.php
@@ -29,9 +29,9 @@
"ext-sockets": "*",
"ext-SPL": "*",
"ext-zlib": "*",
"hell-sh/asyncore": "^2.0",
"hell-sh/enum": "^1.1",
"hell-sh/hotswapp": "^1.1",
"hell-sh/pas": "^1.4.1",
"hell-sh/uuid": "^1.2",
"phpseclib/mcrypt_compat": "^1.0"
},
@@ -1,6 +1,6 @@
<?php /** @noinspection PhpComposerExtensionStubsInspection */
namespace Phpcraft;
use pas\stdin;
use Asyncore\stdin;
/** A Mojang or Minecraft account. */
class Account
{
@@ -37,7 +37,7 @@ function __construct(string $username)
}

/**
* Asks the user of the CLI application for a logged-in Account for "online mode" usage using pas\stdin.
* Asks the user of the CLI application for a logged-in Account for "online mode" usage using \Asyncore\stdin.
*
* @return Account
*/
@@ -4,7 +4,7 @@
use DomainException;
use GMP;
use hellsh\UUID;
use pas\pas;
use Asyncore\Asyncore;
use Phpcraft\
{Command\ServerCommandSender, Entity\Player, Enum\ChatPosition, Enum\Gamemode, Exception\IOException, Packet\ClientboundAbilitiesPacket, Packet\ClientboundPacketId, World\Chunk, World\World};
/** A server-to-client connection. */
@@ -377,7 +377,7 @@ function handleEncryptionResponse($private_key, callable $callback): bool
{
curl_setopt($ch, CURLOPT_CAINFO, __DIR__."/cacert.pem");
}
pas::curl_exec($ch, function($res) use (&$ch, &$callback)
Asyncore::curl_exec($ch, function($res) use (&$ch, &$callback)
{
curl_close($ch);
$json = json_decode($res, true);
@@ -3,7 +3,7 @@
use ArrayAccess;
use Countable;
use Iterator;
use pas\pas;
use Asyncore\Asyncore;
use SplObjectStorage;
class Configuration implements Iterator, Countable, ArrayAccess
{
@@ -44,7 +44,7 @@ function __construct($file = null, $default_data = null)
}
if(!self::$registered_loop)
{
pas::addInessential(function()
Asyncore::addInessential(function()
{
Configuration::handleQueue(0.05);
}, 0.1);
@@ -1,7 +1,7 @@
<?php /** @noinspection PhpComposerExtensionStubsInspection */
namespace Phpcraft;
use pas\
{pas, stdin};
use Asyncore\
{Asyncore, stdin};
use RuntimeException;
class FancyUserInterface extends UserInterface
{
@@ -52,7 +52,7 @@ function __construct(string $title)
stream_set_blocking($this->stdin, false);
}
$this->ob_start();
$this->render_loop = pas::addInessential(function()
$this->render_loop = Asyncore::addInessential(function()
{
$this->render();
}, 0.2, true);
@@ -112,7 +112,7 @@ function render(): void
$this->cursorpos = 1;
$this->render_loop->next_run = microtime(true);
$this->ob_start();
pas::fire("stdin_line", [$line]);
Asyncore::fire("stdin_line", [$line]);
}
}
else if($char == "\x7F") // Backspace
@@ -1,6 +1,6 @@
<?php
namespace Phpcraft;
use pas\stdin;
use Asyncore\stdin;
/**
* Plain user interface, e.g. writing logs to a file.
*/
@@ -2,8 +2,7 @@
namespace Phpcraft;
use Exception;
use hellsh\UUID;
use pas\
{Condition, pas};
use Asyncore\Condition;
use Phpcraft\
{Command\ServerCommandSender, Enum\ChatPosition, Event\ServerTickEvent, Exception\IOException, Packet\KeepAliveRequestPacket, Packet\ServerboundPacketId, Permission\Group};
use SplObjectStorage;
@@ -146,7 +145,7 @@ function __construct(array $streams = [], $private_key = null)
$this->groups = [
"default" => new Group($this, [])
];
$this->open_condition = pas::whileLoop(function()
$this->open_condition = new Condition(function()
{
return $this->isOpen();
});

0 comments on commit 0109523

Please sign in to comment.
You can’t perform that action at this time.