mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-19 23:37:45 +00:00
Fixed wrong paths
This commit is contained in:
65
src/pocketmine/command/defaults/BanCommand.php
Normal file
65
src/pocketmine/command/defaults/BanCommand.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
namespace pocketmine\command\defaults;
|
||||
|
||||
use pocketmine\command\Command;
|
||||
use pocketmine\command\CommandSender;
|
||||
use pocketmine\Player;
|
||||
use pocketmine\Server;
|
||||
use pocketmine\utils\TextFormat;
|
||||
|
||||
class BanCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"Prevents the specified player from using this server",
|
||||
"/ban <player> [reason...]"
|
||||
);
|
||||
$this->setPermission("pocketmine.command.ban.player");
|
||||
}
|
||||
|
||||
public function execute(CommandSender $sender, $currentAlias, array $args){
|
||||
if(!$this->testPermission($sender)){
|
||||
return true;
|
||||
}
|
||||
|
||||
if(count($args) === 0){
|
||||
$sender->sendMessage(TextFormat::RED . "Usage: " . $this->usageMessage);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$name = array_shift($args);
|
||||
$reason = implode(" ", $args);
|
||||
|
||||
Server::getInstance()->getNameBans()->addBan($name, $reason, null, $sender->getName());
|
||||
|
||||
if(($player = Player::get($name, true)) instanceof Player){
|
||||
$player->kick("Banned by admin.");
|
||||
}
|
||||
|
||||
Command::broadcastCommandMessage($sender, "Banned player " . $name);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
81
src/pocketmine/command/defaults/BanIpCommand.php
Normal file
81
src/pocketmine/command/defaults/BanIpCommand.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
namespace pocketmine\command\defaults;
|
||||
|
||||
use pocketmine\command\Command;
|
||||
use pocketmine\command\CommandSender;
|
||||
use pocketmine\Player;
|
||||
use pocketmine\Server;
|
||||
use pocketmine\utils\TextFormat;
|
||||
|
||||
class BanIpCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"Prevents the specified IP address from using this server",
|
||||
"/ban <address|player> [reason...]"
|
||||
);
|
||||
$this->setPermission("pocketmine.command.ban.ip");
|
||||
}
|
||||
|
||||
public function execute(CommandSender $sender, $currentAlias, array $args){
|
||||
if(!$this->testPermission($sender)){
|
||||
return true;
|
||||
}
|
||||
|
||||
if(count($args) === 0){
|
||||
$sender->sendMessage(TextFormat::RED . "Usage: " . $this->usageMessage);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$value = array_shift($args);
|
||||
$reason = implode(" ", $args);
|
||||
|
||||
if(preg_match("/^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])$/", $value)){
|
||||
$this->processIPBan($value, $sender, $reason);
|
||||
}else{
|
||||
if(($player = Player::get($value, true)) instanceof Player){
|
||||
$this->processIPBan($player->getAddress(), $sender, $reason);
|
||||
}else{
|
||||
$sender->sendMessage(TextFormat::RED . "Usage: " . $this->usageMessage);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private function processIPBan($ip, CommandSender $sender, $reason){
|
||||
Server::getInstance()->getIPBans()->addBan($ip, $reason, null, $sender->getName());
|
||||
|
||||
foreach(Player::getAll() as $player){
|
||||
if($player->getAddress() === $ip){
|
||||
$player->kick("You have been IP banned.");
|
||||
}
|
||||
}
|
||||
|
||||
Command::broadcastCommandMessage($sender, "Banned IP Address " . $ip);
|
||||
}
|
||||
}
|
63
src/pocketmine/command/defaults/BanListCommand.php
Normal file
63
src/pocketmine/command/defaults/BanListCommand.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
namespace pocketmine\command\defaults;
|
||||
|
||||
use pocketmine\command\CommandSender;
|
||||
use pocketmine\Server;
|
||||
|
||||
class BanListCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"View all players banned from this server",
|
||||
"/banlist [ips|players]"
|
||||
);
|
||||
$this->setPermission("pocketmine.command.ban.list");
|
||||
}
|
||||
|
||||
public function execute(CommandSender $sender, $currentAlias, array $args){
|
||||
if(!$this->testPermission($sender)){
|
||||
return true;
|
||||
}
|
||||
$list = Server::getInstance()->getNameBans();
|
||||
if(isset($args[0])){
|
||||
$args[0] = strtolower($args[0]);
|
||||
if($args[0] === "ips"){
|
||||
$list = Server::getInstance()->getIPBans();
|
||||
}elseif($args[0] === "players"){
|
||||
$list = Server::getInstance()->getNameBans();
|
||||
}
|
||||
}
|
||||
|
||||
$message = "";
|
||||
$list = $list->getEntries();
|
||||
foreach($list as $entry){
|
||||
$message .= $entry->getName() . ", ";
|
||||
}
|
||||
|
||||
$sender->sendMessage("There are " . count($list) . " total banned players:");
|
||||
$sender->sendMessage(substr($message, 0, -2));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
61
src/pocketmine/command/defaults/DefaultGamemodeCommand.php
Normal file
61
src/pocketmine/command/defaults/DefaultGamemodeCommand.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
namespace pocketmine\command\defaults;
|
||||
|
||||
use pocketmine\command\CommandSender;
|
||||
use pocketmine\Server;
|
||||
use pocketmine\utils\TextFormat;
|
||||
|
||||
class DefaultGamemodeCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"Set the default gamemode",
|
||||
"/defaultgamemode <mode>"
|
||||
);
|
||||
$this->setPermission("pocketmine.command.defaultgamemode");
|
||||
}
|
||||
|
||||
public function execute(CommandSender $sender, $currentAlias, array $args){
|
||||
if(!$this->testPermission($sender)){
|
||||
return true;
|
||||
}
|
||||
|
||||
if(count($args) === 0){
|
||||
$sender->sendMessage(TextFormat::RED . "Usage: " . $this->usageMessage);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$gameMode = Server::getGamemodeFromString($args[0]);
|
||||
|
||||
if($gameMode !== -1){
|
||||
Server::getInstance()->setConfigInt("gamemode", $gameMode);
|
||||
$sender->sendMessage("Default game mode set to " . strtolower(Server::getGamemodeString($gameMode)));
|
||||
}else{
|
||||
$sender->sendMessage("Unknown game mode");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
65
src/pocketmine/command/defaults/DifficultyCommand.php
Normal file
65
src/pocketmine/command/defaults/DifficultyCommand.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
namespace pocketmine\command\defaults;
|
||||
|
||||
use pocketmine\command\CommandSender;
|
||||
use pocketmine\Server;
|
||||
use pocketmine\utils\TextFormat;
|
||||
|
||||
class DifficultyCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"Sets the game difficulty",
|
||||
"/difficulty <new difficulty>"
|
||||
);
|
||||
$this->setPermission("pocketmine.command.difficulty");
|
||||
}
|
||||
|
||||
public function execute(CommandSender $sender, $currentAlias, array $args){
|
||||
if(!$this->testPermission($sender)){
|
||||
return true;
|
||||
}
|
||||
|
||||
if(count($args) !== 1){
|
||||
$sender->sendMessage(TextFormat::RED . "Usage: " . $this->usageMessage);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$difficulty = Server::getDifficultyFromString($args[0]);
|
||||
|
||||
if(Server::getInstance()->isHardcore()){
|
||||
$difficulty = 3;
|
||||
}
|
||||
|
||||
if($difficulty !== -1){
|
||||
Server::getInstance()->setConfigInt("difficulty", $difficulty);
|
||||
$sender->sendMessage("Set difficulty to " . $difficulty);
|
||||
}else{
|
||||
$sender->sendMessage("Unknown difficulty");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
106
src/pocketmine/command/defaults/HelpCommand.php
Normal file
106
src/pocketmine/command/defaults/HelpCommand.php
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
namespace pocketmine\command\defaults;
|
||||
|
||||
use pocketmine\command\Command;
|
||||
use pocketmine\command\CommandSender;
|
||||
use pocketmine\command\ConsoleCommandSender;
|
||||
use pocketmine\Server;
|
||||
use pocketmine\utils\TextFormat;
|
||||
|
||||
class HelpCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"Shows the help menu",
|
||||
"/help [pageNumber]\n/help <topic> [pageNumber]",
|
||||
["?"]
|
||||
);
|
||||
$this->setPermission("pocketmine.command.help");
|
||||
}
|
||||
|
||||
public function execute(CommandSender $sender, $currentAlias, array $args){
|
||||
if(!$this->testPermission($sender)){
|
||||
return true;
|
||||
}
|
||||
|
||||
if(count($args) === 0){
|
||||
$command = "";
|
||||
$pageNumber = 1;
|
||||
}elseif(is_numeric($args[count($args) - 1])){
|
||||
$pageNumber = (int) array_pop($args);
|
||||
if($pageNumber <= 0){
|
||||
$pageNumber = 1;
|
||||
}
|
||||
$command = implode(" ", $args);
|
||||
}else{
|
||||
$command = implode(" ", $args);
|
||||
$pageNumber = 1;
|
||||
}
|
||||
|
||||
if($sender instanceof ConsoleCommandSender){
|
||||
$pageHeight = PHP_INT_MAX;
|
||||
}else{
|
||||
$pageHeight = 5;
|
||||
}
|
||||
|
||||
if($command === ""){
|
||||
$commands = array();
|
||||
foreach(Server::getInstance()->getCommandMap()->getCommands() as $command){
|
||||
if($command->testPermissionSilent($sender)){
|
||||
$commands[$command->getName()] = $command;
|
||||
}
|
||||
}
|
||||
ksort($commands, SORT_NATURAL | SORT_FLAG_CASE);
|
||||
$commands = array_chunk($commands, $pageHeight);
|
||||
$pageNumber = (int) min(count($commands), $pageNumber);
|
||||
if($pageNumber < 1){
|
||||
$pageNumber = 1;
|
||||
}
|
||||
$message = TextFormat::RED . "-" . TextFormat::RESET . " Showing help page " . $pageNumber . " of " . count($commands) . " (/help <pageNumber>) " . TextFormat::RED . "-" . TextFormat::RESET . "\n";
|
||||
if(isset($commands[$pageNumber - 1])){
|
||||
foreach($commands[$pageNumber - 1] as $command){
|
||||
$message .= TextFormat::DARK_GREEN . "/" . $command->getName() . ": " . TextFormat::WHITE . $command->getDescription() . "\n";
|
||||
}
|
||||
}
|
||||
$sender->sendMessage($message);
|
||||
|
||||
return true;
|
||||
}else{
|
||||
if(($command = Server::getInstance()->getCommandMap()->getCommand(strtolower($command))) instanceof Command){
|
||||
if($command->testPermissionSilent($sender)){
|
||||
$message = TextFormat::YELLOW . "--------- " . TextFormat::WHITE . " Help: /" . $command->getName() . TextFormat::YELLOW . " ---------\n";
|
||||
$message .= TextFormat::GOLD . "Description: " . TextFormat::WHITE . $command->getDescription() . "\n";
|
||||
$message .= TextFormat::GOLD . "Usage: " . TextFormat::WHITE . implode("\n" . TextFormat::WHITE, explode("\n", $command->getUsage())) . "\n";
|
||||
$sender->sendMessage($message);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
$sender->sendMessage(TextFormat::RED . "No help for " . strtolower($command));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
58
src/pocketmine/command/defaults/ListCommand.php
Normal file
58
src/pocketmine/command/defaults/ListCommand.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
namespace pocketmine\command\defaults;
|
||||
|
||||
use pocketmine\command\Command;
|
||||
use pocketmine\command\CommandSender;
|
||||
use pocketmine\Player;
|
||||
use pocketmine\Server;
|
||||
use pocketmine\utils\TextFormat;
|
||||
|
||||
class ListCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"Lists all online players",
|
||||
"/list"
|
||||
);
|
||||
$this->setPermission("pocketmine.command.list");
|
||||
}
|
||||
|
||||
public function execute(CommandSender $sender, $currentAlias, array $args){
|
||||
if(!$this->testPermission($sender)){
|
||||
return true;
|
||||
}
|
||||
|
||||
$online = "";
|
||||
|
||||
foreach(Player::getAll() as $player){
|
||||
if($player->isOnline() and (!($sender instanceof Player) or $sender->canSee($player))){
|
||||
$online .= $player->getDisplayName() . ", ";
|
||||
}
|
||||
}
|
||||
|
||||
$sender->sendMessage("There are ".count(Player::getAll())."/".Server::getInstance()->getMaxPlayers()." players online:\n" . substr($online, 0, -2));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
62
src/pocketmine/command/defaults/MeCommand.php
Normal file
62
src/pocketmine/command/defaults/MeCommand.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
namespace pocketmine\command\defaults;
|
||||
|
||||
use pocketmine\command\CommandSender;
|
||||
use pocketmine\Player;
|
||||
use pocketmine\Server;
|
||||
use pocketmine\utils\TextFormat;
|
||||
|
||||
class MeCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"Performs the specified action in chat",
|
||||
"/me <action...>"
|
||||
);
|
||||
$this->setPermission("pocketmine.command.me");
|
||||
}
|
||||
|
||||
public function execute(CommandSender $sender, $currentAlias, array $args){
|
||||
if(!$this->testPermission($sender)){
|
||||
return true;
|
||||
}
|
||||
|
||||
if(count($args) === 0){
|
||||
$sender->sendMessage(TextFormat::RED . "Usage: " . $this->usageMessage);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$message = "* ";
|
||||
if($sender instanceof Player){
|
||||
$message .= $sender->getDisplayName();
|
||||
}else{
|
||||
$message .= $sender->getName();
|
||||
}
|
||||
|
||||
Server::getInstance()->broadcastMessage($message . " " . implode(" ", $args));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
57
src/pocketmine/command/defaults/PardonCommand.php
Normal file
57
src/pocketmine/command/defaults/PardonCommand.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
namespace pocketmine\command\defaults;
|
||||
|
||||
use pocketmine\command\Command;
|
||||
use pocketmine\command\CommandSender;
|
||||
use pocketmine\Server;
|
||||
use pocketmine\utils\TextFormat;
|
||||
|
||||
class PardonCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"Allows the specified player to use this server",
|
||||
"/pardon <player>"
|
||||
);
|
||||
$this->setPermission("pocketmine.command.unban.player");
|
||||
}
|
||||
|
||||
public function execute(CommandSender $sender, $currentAlias, array $args){
|
||||
if(!$this->testPermission($sender)){
|
||||
return true;
|
||||
}
|
||||
|
||||
if(count($args) !== 1){
|
||||
$sender->sendMessage(TextFormat::RED . "Usage: " . $this->usageMessage);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Server::getInstance()->getNameBans()->remove($args[0]);
|
||||
|
||||
Command::broadcastCommandMessage($sender, "Pardoned " . $name);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
60
src/pocketmine/command/defaults/PardonIpCommand.php
Normal file
60
src/pocketmine/command/defaults/PardonIpCommand.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
namespace pocketmine\command\defaults;
|
||||
|
||||
use pocketmine\command\Command;
|
||||
use pocketmine\command\CommandSender;
|
||||
use pocketmine\Server;
|
||||
use pocketmine\utils\TextFormat;
|
||||
|
||||
class PardonIpCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"Allows the specified IP address to use this server",
|
||||
"/pardon-ip <address>"
|
||||
);
|
||||
$this->setPermission("pocketmine.command.unban.ip");
|
||||
}
|
||||
|
||||
public function execute(CommandSender $sender, $currentAlias, array $args){
|
||||
if(!$this->testPermission($sender)){
|
||||
return true;
|
||||
}
|
||||
|
||||
if(count($args) !== 1){
|
||||
$sender->sendMessage(TextFormat::RED . "Usage: " . $this->usageMessage);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if(preg_match("/^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])$/", $args[0])){
|
||||
Server::getInstance()->getIPBans()->remove($args[0]);
|
||||
Command::broadcastCommandMessage($sender, "Pardoned IP " . $args[0]);
|
||||
}else{
|
||||
$sender->sendMessage("Invalid IP");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
62
src/pocketmine/command/defaults/PluginsCommand.php
Normal file
62
src/pocketmine/command/defaults/PluginsCommand.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
namespace pocketmine\command\defaults;
|
||||
|
||||
use pocketmine\command\CommandSender;
|
||||
use pocketmine\Server;
|
||||
use pocketmine\utils\TextFormat;
|
||||
|
||||
class PluginsCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"Gets a list of plugins running on the server",
|
||||
"/plugins",
|
||||
["pl"]
|
||||
);
|
||||
$this->setPermission("pocketmine.command.plugins");
|
||||
}
|
||||
|
||||
public function execute(CommandSender $sender, $currentAlias, array $args){
|
||||
if(!$this->testPermission($sender)){
|
||||
return true;
|
||||
}
|
||||
|
||||
$sender->sendMessage("Plugins " . $this->getPluginList());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private function getPluginList(){
|
||||
$list = "";
|
||||
foreach(($plugins = Server::getInstance()->getPluginManager()->getPlugins()) as $plugin){
|
||||
if(strlen($list) > 0){
|
||||
$list .= TextFormat::WHITE . ", ";
|
||||
}
|
||||
$list .= $plugin->isEnabled() ? TextFormat::DARK_GREEN : TextFormat::RED;
|
||||
$list .= $plugin->getDescription()->getName();
|
||||
}
|
||||
|
||||
return "(" . count($plugins) . "): $list";
|
||||
}
|
||||
}
|
65
src/pocketmine/command/defaults/SayCommand.php
Normal file
65
src/pocketmine/command/defaults/SayCommand.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
namespace pocketmine\command\defaults;
|
||||
|
||||
use pocketmine\command\CommandSender;
|
||||
use pocketmine\command\ConsoleCommandSender;
|
||||
use pocketmine\Player;
|
||||
use pocketmine\Server;
|
||||
use pocketmine\utils\TextFormat;
|
||||
|
||||
class SayCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"Broadcasts the given message as the sender",
|
||||
"/say <message...>"
|
||||
);
|
||||
$this->setPermission("pocketmine.command.seed");
|
||||
}
|
||||
|
||||
public function execute(CommandSender $sender, $currentAlias, array $args){
|
||||
if(!$this->testPermission($sender)){
|
||||
return true;
|
||||
}
|
||||
|
||||
if(count($args) === 0){
|
||||
$sender->sendMessage(TextFormat::RED . "Usage: " . $this->usageMessage);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$message = TextFormat::LIGHT_PURPLE . "[";
|
||||
if($sender instanceof ConsoleCommandSender){
|
||||
$message .= "Server";
|
||||
}elseif($sender instanceof Player){
|
||||
$message .= $sender->getDisplayName();
|
||||
}else{
|
||||
$message .= $sender->getName();
|
||||
}
|
||||
$message .= TextFormat::LIGHT_PURPLE . "] " . implode(" ", $args);
|
||||
Server::getInstance()->broadcastMessage($message);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
53
src/pocketmine/command/defaults/SeedCommand.php
Normal file
53
src/pocketmine/command/defaults/SeedCommand.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
namespace pocketmine\command\defaults;
|
||||
|
||||
use pocketmine\command\CommandSender;
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\Player;
|
||||
|
||||
class SeedCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"Shows the world seed",
|
||||
"/seed"
|
||||
);
|
||||
$this->setPermission("pocketmine.command.seed");
|
||||
}
|
||||
|
||||
public function execute(CommandSender $sender, $currentAlias, array $args){
|
||||
if(!$this->testPermission($sender)){
|
||||
return true;
|
||||
}
|
||||
|
||||
if($sender instanceof Player){
|
||||
$seed = $sender->getLevel()->getSeed();
|
||||
}else{
|
||||
$seed = Level::getDefault()->getSeed();
|
||||
}
|
||||
$sender->sendMessage("Seed: " . $seed);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
58
src/pocketmine/command/defaults/StopCommand.php
Normal file
58
src/pocketmine/command/defaults/StopCommand.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
namespace pocketmine\command\defaults;
|
||||
|
||||
use pocketmine\command\Command;
|
||||
use pocketmine\command\CommandSender;
|
||||
use pocketmine\Player;
|
||||
use pocketmine\Server;
|
||||
|
||||
class StopCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"Stops the server, with optional reason",
|
||||
"/stop [reason]"
|
||||
);
|
||||
$this->setPermission("pocketmine.command.stop");
|
||||
}
|
||||
|
||||
public function execute(CommandSender $sender, $currentAlias, array $args){
|
||||
if(!$this->testPermission($sender)){
|
||||
return true;
|
||||
}
|
||||
|
||||
Command::broadcastCommandMessage($sender, "Stopping the server...");
|
||||
|
||||
$reason = implode(" ", $args);
|
||||
if($reason !== ""){
|
||||
foreach(Player::getAll() as $player){
|
||||
$player->kick($reason);
|
||||
}
|
||||
}
|
||||
|
||||
Server::getInstance()->shutdown();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
64
src/pocketmine/command/defaults/TellCommand.php
Normal file
64
src/pocketmine/command/defaults/TellCommand.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
namespace pocketmine\command\defaults;
|
||||
|
||||
use pocketmine\command\CommandSender;
|
||||
use pocketmine\Player;
|
||||
use pocketmine\utils\TextFormat;
|
||||
|
||||
class TellCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"Sends a private message to the given player",
|
||||
"/tell <player> <message>",
|
||||
["w", "msg"]
|
||||
);
|
||||
$this->setPermission("pocketmine.command.tell");
|
||||
}
|
||||
|
||||
public function execute(CommandSender $sender, $currentAlias, array $args){
|
||||
if(!$this->testPermission($sender)){
|
||||
return true;
|
||||
}
|
||||
|
||||
if(count($args) < 2){
|
||||
$sender->sendMessage(TextFormat::RED . "Usage: " . $this->usageMessage);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$name = strtolower(array_shift($args));
|
||||
|
||||
$player = Player::get($name, true, false);
|
||||
|
||||
if($player instanceof Player){
|
||||
$sender->sendMessage("[me -> " . $player->getName() . "] " . implode($args));
|
||||
$player->sendMessage("[" . $sender->getName() . " -> me] " . implode($args));
|
||||
}else{
|
||||
$sender->sendMessage("There's no player by that name online.");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
69
src/pocketmine/command/defaults/VanillaCommand.php
Normal file
69
src/pocketmine/command/defaults/VanillaCommand.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
namespace pocketmine\command\defaults;
|
||||
|
||||
use pocketmine\command\Command;
|
||||
use pocketmine\command\CommandSender;
|
||||
|
||||
abstract class VanillaCommand extends Command{
|
||||
//TODO: increment chunk indexes
|
||||
const MAX_COORD = 524288;
|
||||
const MIN_COORD = -524288;
|
||||
|
||||
public function __construct($name, $description = "", $usageMessage = null, array $aliases = array()){
|
||||
parent::__construct($name, $description, $usageMessage, $aliases);
|
||||
}
|
||||
|
||||
protected function getInteger(CommandSender $sender, $value, $min = self::MIN_COORD, $max = self::MAX_COORD){
|
||||
$i = (int) $value;
|
||||
|
||||
if($i < $min){
|
||||
$i = $min;
|
||||
}elseif($i > $max){
|
||||
$i = $max;
|
||||
}
|
||||
|
||||
return $i;
|
||||
}
|
||||
|
||||
protected function getRelativeDouble($original, CommandSender $sender, $input){
|
||||
if($input{0} === "~"){
|
||||
$value = $this->getDouble($sender, substr($input, 1));
|
||||
|
||||
return $original + $value;
|
||||
}
|
||||
|
||||
return $this->getDouble($input);
|
||||
}
|
||||
|
||||
protected function getDouble(CommandSender $sender, $value, $min = self::MIN_COORD, $max = self::MAX_COORD){
|
||||
$i = (double) $value;
|
||||
|
||||
if($i < $min){
|
||||
$i = $min;
|
||||
}elseif($i > $max){
|
||||
$i = $max;
|
||||
}
|
||||
|
||||
return $i;
|
||||
}
|
||||
}
|
100
src/pocketmine/command/defaults/VersionCommand.php
Normal file
100
src/pocketmine/command/defaults/VersionCommand.php
Normal file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
namespace pocketmine\command\defaults;
|
||||
|
||||
use pocketmine\command\CommandSender;
|
||||
use pocketmine\network\protocol\Info;
|
||||
use pocketmine\plugin\Plugin;
|
||||
use pocketmine\Server;
|
||||
use pocketmine\utils\TextFormat;
|
||||
|
||||
class VersionCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"Gets the version of this server including any plugins in use",
|
||||
"/version [plugin name]",
|
||||
["ver", "about"]
|
||||
);
|
||||
$this->setPermission("pocketmine.command.version");
|
||||
}
|
||||
|
||||
public function execute(CommandSender $sender, $currentAlias, array $args){
|
||||
if(!$this->testPermission($sender)){
|
||||
return true;
|
||||
}
|
||||
|
||||
if(count($args) === 0){
|
||||
$output = "This server is running PocketMine-MP version " . Server::getInstance()->getPocketMineVersion() . " 「" . Server::getInstance()->getCodename() . "」 (Implementing API version " . Server::getInstance()->getApiVersion() . " for Minecraft: PE " . Server::getInstance()->getVersion() . " protocol version " . Info::CURRENT_PROTOCOL . ")";
|
||||
if(\pocketmine\GIT_COMMIT !== str_repeat("00", 20)){
|
||||
$output .= " [git " . \pocketmine\GIT_COMMIT . "]";
|
||||
}
|
||||
$sender->sendMessage($output);
|
||||
}else{
|
||||
$pluginName = implode(" ", $args);
|
||||
$exactPlugin = Server::getInstance()->getPluginManager()->getPlugin($pluginName);
|
||||
|
||||
if($exactPlugin instanceof Plugin){
|
||||
$this->describeToSender($exactPlugin, $sender);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
$found = false;
|
||||
$pluginName = strtolower($pluginName);
|
||||
foreach(Server::getInstance()->getPluginManager()->getPlugins() as $plugin){
|
||||
if(stripos($plugin->getName(), $pluginName) !== false){
|
||||
$this->describeToSender($plugin, $sender);
|
||||
$found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!$found){
|
||||
$sender->sendMessage("This server is not running any plugin by that name.\nUse /plugins to get a list of plugins.");
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private function describeToSender(Plugin $plugin, CommandSender $sender){
|
||||
$desc = $plugin->getDescription();
|
||||
$sender->sendMessage(TextFormat::DARK_GREEN . $desc->getName() . TextFormat::WHITE . " version " . TextFormat::DARK_GREEN . $desc->getVersion());
|
||||
|
||||
if($desc->getDescription() != null){
|
||||
$sender->sendMessage($desc->getDescription());
|
||||
}
|
||||
|
||||
if($desc->getWebsite() != null){
|
||||
$sender->sendMessage("Website: " . $desc->getWebsite());
|
||||
}
|
||||
|
||||
if(count($authors = $desc->getAuthors()) > 0){
|
||||
if(count($authors) === 1){
|
||||
$sender->sendMessage("Author: " . implode(", ", $authors));
|
||||
}else{
|
||||
$sender->sendMessage("Authors: " . implode(", ", $authors));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user