This repository was archived by the owner on Jun 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathInfoCommand.php
More file actions
53 lines (44 loc) · 1.55 KB
/
InfoCommand.php
File metadata and controls
53 lines (44 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
namespace ServerCore\command;
use pocketmine\command\Command;
use pocketmine\command\CommandSender;
use pocketmine\command\PluginIdentifiableCommand;
use pocketmine\plugin\Plugin;
use pocketmine\utils\TextFormat;
use pocketmine\Player;
use ServerCore\ServerCore as Main;
class InfoCommand extends Command implements PluginIdentifiableCommand {
private $plugin;
public function __construct(Main $plugin) {
$this->plugin = $plugin;
parent::__construct(
"info",
"Info command",
"/info <ranks|server>"
);
$this->setPermission("command.info");
}
public function getPlugin() : Plugin {
return $this->plugin;
}
public function execute(CommandSender $sender, string $label, array $args) {
if (!$this->testPermission($sender)) {
return;
}
$server = $this->plugin->config->get("info-server-command");
$ranks = $this->plugin->config->get("info-ranks-command");
if ($sender instanceof Player) {
if (isset($args[0])) {
if ($args[0] === "ranks") {
$sender->sendMessage($this->plugin->prefix . $ranks);
} elseif ($args[0] === "server") {
$sender->sendMessage($this->plugin->prefix . $server);
}
} else {
$sender->sendMessage(TextFormat::RED . "Usage: /info <ranks|server>");
}
} else {
$sender->sendMessage(TextFormat::RED . "Please use this command in-game");
}
}
}