This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| declare(strict_types=1); | |
| start($this)->run(function (EventStream $eventStream) { | |
| while (true) { | |
| /** @var PlayerJoinEvent $event */ | |
| $event = yield listen(PlayerJoinEvent::class); | |
| $player = $event->getPlayer(); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| start($this)->run(function () { | |
| $lastTick = []; | |
| while (true) { | |
| return; | |
| /** @var PlayerInteractEvent $event */ | |
| $event = yield listen(PlayerInteractEvent::class); | |
| $player = $event->getPlayer(); | |
| $name = $player->getName(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| start($this)->run(function () { | |
| while (true) { | |
| /** @var PlayerEditBookEvent $event */ | |
| $event = yield listen(PlayerEditBookEvent::class); | |
| if ($event->getAction() !== PlayerEditBookEvent::ACTION_SIGN_BOOK) { | |
| continue; | |
| } | |
| $book = $event->getNewBook(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $rightClickBlockFilter = function (PlayerInteractEvent $event) use ($player): bool { | |
| return $event->getPlayer() === $player && $event->getAction() === PlayerInteractEvent::RIGHT_CLICK_BLOCK; | |
| }; | |
| $ignoreCancelled = function (Cancellable $cancellable): bool { | |
| return !$cancellable->isCancelled(); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| declare(strict_types=1); | |
| class a | |
| { | |
| /** @var string */ | |
| private static $foo; | |
| public static function getFoo(): string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Copyright (c) 2020 PJZ9n. | |
| * | |
| * This file is part of Hello-TwitterAPI. | |
| * | |
| * Hello-TwitterAPI is free software: you can redistribute it and/or modify | |
| * it under the terms of the GNU General Public License as published by | |
| * the Free Software Foundation, either version 3 of the License, or |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Copyright (c) 2020 PJZ9n. | |
| * | |
| * This file is part of Hello-TwitterAPI. | |
| * | |
| * Hello-TwitterAPI is free software: you can redistribute it and/or modify | |
| * it under the terms of the GNU General Public License as published by | |
| * the Free Software Foundation, either version 3 of the License, or |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Copyright (c) 2020 PJZ9n. | |
| * | |
| * This file is part of Tuihai. | |
| * | |
| * Tuihai is free software: you can redistribute it and/or modify | |
| * it under the terms of the GNU General Public License as published by | |
| * the Free Software Foundation, either version 3 of the License, or |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Copyright (c) 2020 PJZ9n. | |
| * | |
| * This file is part of Tuihai. | |
| * | |
| * Tuihai is free software: you can redistribute it and/or modify | |
| * it under the terms of the GNU General Public License as published by | |
| * the Free Software Foundation, either version 3 of the License, or |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| public function onDataPacketReceive(DataPacketReceiveEvent $event) | |
| { | |
| $packet = $event->getPacket(); | |
| if ($packet instanceof PlayerActionPacket) { | |
| $name = $event->getPlayer()->getName(); | |
| switch ($packet->action) { | |
| case PlayerActionPacket::ACTION_START_BREAK://破壊開始 | |
| $this->isBreaking[$name] = true; | |
| break; |