Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/newdelion/flowy

Awaitable for PocketMine-MP. MOVED(https://github.com/FlowyProject)
https://github.com/newdelion/flowy

pmmp pmmp-flowy pmmp-plugin pocketmine pocketmine-mp

Last synced: about 21 hours ago
JSON representation

Awaitable for PocketMine-MP. MOVED(https://github.com/FlowyProject)

Awesome Lists containing this project

README

        

# Flowy
__Awaitable for PocketMine-MP__
# This project is moved => [FlowyProject](https://github.com/FlowyProject)

## Install
__Composer__
```
composer config repositories.NewDelion/Flowy vcs https://github.com/NewDelion/Flowy
composer require NewDelion/Flowy:dev-master
```
__GitSubmodule__
```
git submodule add https://github.com/NewDelion/Flowy
```

## Example
```php
filter(function($ev) use ($methodName, $obj, $strict){
if($strict){
return $ev->{$methodName}() === $obj;
}
else{
return $ev->{$methodName}() == $obj;
}
});
}
);
$this->start($this->heysiri());
}

function heysiri(){
$event = yield listen(PlayerJoinEvent::class);
$this->start($this->heysiri());
$player = $event->getPlayer();

$branch_quit = function(){ yield listen(PlayerQuitEvent::class); };

while(true){
$event = yield listen(PlayerChatEvent::class)
->filter_eq('getPlayer', $player)
->filter_eq('getMessage', 'heysiri')
->branch($branch_quit);

$player->sendMessage("What can I help you with?\nGo ahead. I'm listening...");
$event->setCancelled();

$event = yield listen(PlayerChatEvent::class)
->filter_eq('getPlayer', $player)
->timeout(20 * 15, [$player, 'sendMessage'], ["(♪popon)"], true)
->branch($branch_quit);

if($event !== null){
$player->sendMessage("I'm not sure I understand.");
$event->setCancelled();
}
}
}
}
```