1: <?php
2:
3: namespace Budabot\User\Modules;
4:
5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18:
19: class FindPlayerController {
20:
21: 22: 23: 24:
25: public $moduleName;
26:
27:
28: public $chatBot;
29:
30:
31: public $text;
32:
33:
34: public $playerManager;
35:
36: 37: 38: 39:
40: public function findplayerCommand($message, $channel, $sender, $sendto, $args) {
41: $search = $args[1];
42:
43: $data = $this->playerManager->searchForPlayers($search, $this->chatBot->vars['dimension']);
44: $count = count($data);
45:
46: if ($count > 0) {
47: $blob = '';
48: forEach ($data as $row) {
49: $blob .= $this->playerManager->getInfo($row, false) . "\n\n";
50: }
51: $msg = $this->text->makeBlob("Search results for '$search' ($count)", $blob);
52: } else {
53: $msg = "Could not find any players matching <highlight>$search<end>.";
54: }
55:
56: $sendto->reply($msg);
57: }
58: }
59: