mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 08:17:34 +00:00
Declare built-in command names inside the constructor (#5487)
This increases code consistency by placing the name in the same place where everything else about the command is defined.
This commit is contained in:
parent
545d18eea7
commit
9c391a6809
@ -89,46 +89,46 @@ class SimpleCommandMap implements CommandMap{
|
||||
|
||||
private function setDefaultCommands() : void{
|
||||
$this->registerAll("pocketmine", [
|
||||
new BanCommand("ban"),
|
||||
new BanIpCommand("ban-ip"),
|
||||
new BanListCommand("banlist"),
|
||||
new ClearCommand("clear"),
|
||||
new DefaultGamemodeCommand("defaultgamemode"),
|
||||
new DeopCommand("deop"),
|
||||
new DifficultyCommand("difficulty"),
|
||||
new DumpMemoryCommand("dumpmemory"),
|
||||
new EffectCommand("effect"),
|
||||
new EnchantCommand("enchant"),
|
||||
new GamemodeCommand("gamemode"),
|
||||
new GarbageCollectorCommand("gc"),
|
||||
new GiveCommand("give"),
|
||||
new HelpCommand("help"),
|
||||
new KickCommand("kick"),
|
||||
new KillCommand("kill"),
|
||||
new ListCommand("list"),
|
||||
new MeCommand("me"),
|
||||
new OpCommand("op"),
|
||||
new PardonCommand("pardon"),
|
||||
new PardonIpCommand("pardon-ip"),
|
||||
new ParticleCommand("particle"),
|
||||
new PluginsCommand("plugins"),
|
||||
new SaveCommand("save-all"),
|
||||
new SaveOffCommand("save-off"),
|
||||
new SaveOnCommand("save-on"),
|
||||
new SayCommand("say"),
|
||||
new SeedCommand("seed"),
|
||||
new SetWorldSpawnCommand("setworldspawn"),
|
||||
new SpawnpointCommand("spawnpoint"),
|
||||
new StatusCommand("status"),
|
||||
new StopCommand("stop"),
|
||||
new TeleportCommand("tp"),
|
||||
new TellCommand("tell"),
|
||||
new TimeCommand("time"),
|
||||
new TimingsCommand("timings"),
|
||||
new TitleCommand("title"),
|
||||
new TransferServerCommand("transferserver"),
|
||||
new VersionCommand("version"),
|
||||
new WhitelistCommand("whitelist")
|
||||
new BanCommand(),
|
||||
new BanIpCommand(),
|
||||
new BanListCommand(),
|
||||
new ClearCommand(),
|
||||
new DefaultGamemodeCommand(),
|
||||
new DeopCommand(),
|
||||
new DifficultyCommand(),
|
||||
new DumpMemoryCommand(),
|
||||
new EffectCommand(),
|
||||
new EnchantCommand(),
|
||||
new GamemodeCommand(),
|
||||
new GarbageCollectorCommand(),
|
||||
new GiveCommand(),
|
||||
new HelpCommand(),
|
||||
new KickCommand(),
|
||||
new KillCommand(),
|
||||
new ListCommand(),
|
||||
new MeCommand(),
|
||||
new OpCommand(),
|
||||
new PardonCommand(),
|
||||
new PardonIpCommand(),
|
||||
new ParticleCommand(),
|
||||
new PluginsCommand(),
|
||||
new SaveCommand(),
|
||||
new SaveOffCommand(),
|
||||
new SaveOnCommand(),
|
||||
new SayCommand(),
|
||||
new SeedCommand(),
|
||||
new SetWorldSpawnCommand(),
|
||||
new SpawnpointCommand(),
|
||||
new StatusCommand(),
|
||||
new StopCommand(),
|
||||
new TeleportCommand(),
|
||||
new TellCommand(),
|
||||
new TimeCommand(),
|
||||
new TimingsCommand(),
|
||||
new TitleCommand(),
|
||||
new TransferServerCommand(),
|
||||
new VersionCommand(),
|
||||
new WhitelistCommand()
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -35,9 +35,9 @@ use function implode;
|
||||
|
||||
class BanCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"ban",
|
||||
KnownTranslationFactory::pocketmine_command_ban_player_description(),
|
||||
KnownTranslationFactory::commands_ban_usage()
|
||||
);
|
||||
|
@ -36,9 +36,9 @@ use function inet_pton;
|
||||
|
||||
class BanIpCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"ban-ip",
|
||||
KnownTranslationFactory::pocketmine_command_ban_ip_description(),
|
||||
KnownTranslationFactory::commands_banip_usage()
|
||||
);
|
||||
|
@ -37,9 +37,9 @@ use const SORT_STRING;
|
||||
|
||||
class BanListCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"banlist",
|
||||
KnownTranslationFactory::pocketmine_command_banlist_description(),
|
||||
KnownTranslationFactory::commands_banlist_usage()
|
||||
);
|
||||
|
@ -40,9 +40,9 @@ use function min;
|
||||
|
||||
class ClearCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"clear",
|
||||
KnownTranslationFactory::pocketmine_command_clear_description(),
|
||||
KnownTranslationFactory::pocketmine_command_clear_usage()
|
||||
);
|
||||
|
@ -32,9 +32,9 @@ use function count;
|
||||
|
||||
class DefaultGamemodeCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"defaultgamemode",
|
||||
KnownTranslationFactory::pocketmine_command_defaultgamemode_description(),
|
||||
KnownTranslationFactory::commands_defaultgamemode_usage()
|
||||
);
|
||||
|
@ -35,9 +35,9 @@ use function count;
|
||||
|
||||
class DeopCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"deop",
|
||||
KnownTranslationFactory::pocketmine_command_deop_description(),
|
||||
KnownTranslationFactory::commands_deop_usage()
|
||||
);
|
||||
|
@ -33,9 +33,9 @@ use function count;
|
||||
|
||||
class DifficultyCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"difficulty",
|
||||
KnownTranslationFactory::pocketmine_command_difficulty_description(),
|
||||
KnownTranslationFactory::commands_difficulty_usage()
|
||||
);
|
||||
|
@ -30,11 +30,11 @@ use function date;
|
||||
|
||||
class DumpMemoryCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"dumpmemory",
|
||||
"Dumps the memory",
|
||||
"/$name [path]"
|
||||
"/dumpmemory [path]"
|
||||
);
|
||||
$this->setPermission(DefaultPermissionNames::COMMAND_DUMPMEMORY);
|
||||
}
|
||||
|
@ -37,9 +37,9 @@ use function strtolower;
|
||||
|
||||
class EffectCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"effect",
|
||||
KnownTranslationFactory::pocketmine_command_effect_description(),
|
||||
KnownTranslationFactory::commands_effect_usage()
|
||||
);
|
||||
|
@ -34,9 +34,9 @@ use function implode;
|
||||
|
||||
class EnchantCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"enchant",
|
||||
KnownTranslationFactory::pocketmine_command_enchant_description(),
|
||||
KnownTranslationFactory::commands_enchant_usage()
|
||||
);
|
||||
|
@ -34,9 +34,9 @@ use function implode;
|
||||
|
||||
class GamemodeCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"gamemode",
|
||||
KnownTranslationFactory::pocketmine_command_gamemode_description(),
|
||||
KnownTranslationFactory::commands_gamemode_usage()
|
||||
);
|
||||
|
@ -34,9 +34,9 @@ use function round;
|
||||
|
||||
class GarbageCollectorCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"gc",
|
||||
KnownTranslationFactory::pocketmine_command_gc_description()
|
||||
);
|
||||
$this->setPermission(DefaultPermissionNames::COMMAND_GC);
|
||||
|
@ -41,9 +41,9 @@ use function implode;
|
||||
|
||||
class GiveCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"give",
|
||||
KnownTranslationFactory::pocketmine_command_give_description(),
|
||||
KnownTranslationFactory::pocketmine_command_give_usage()
|
||||
);
|
||||
|
@ -44,9 +44,9 @@ use const SORT_NATURAL;
|
||||
|
||||
class HelpCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"help",
|
||||
KnownTranslationFactory::pocketmine_command_help_description(),
|
||||
KnownTranslationFactory::commands_help_usage(),
|
||||
["?"]
|
||||
|
@ -37,9 +37,9 @@ use function trim;
|
||||
|
||||
class KickCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"kick",
|
||||
KnownTranslationFactory::pocketmine_command_kick_description(),
|
||||
KnownTranslationFactory::commands_kick_usage()
|
||||
);
|
||||
|
@ -34,9 +34,9 @@ use function implode;
|
||||
|
||||
class KillCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"kill",
|
||||
KnownTranslationFactory::pocketmine_command_kill_description(),
|
||||
KnownTranslationFactory::pocketmine_command_kill_usage(),
|
||||
["suicide"]
|
||||
|
@ -36,9 +36,9 @@ use const SORT_STRING;
|
||||
|
||||
class ListCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"list",
|
||||
KnownTranslationFactory::pocketmine_command_list_description()
|
||||
);
|
||||
$this->setPermission(DefaultPermissionNames::COMMAND_LIST);
|
||||
|
@ -34,9 +34,9 @@ use function implode;
|
||||
|
||||
class MeCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"me",
|
||||
KnownTranslationFactory::pocketmine_command_me_description(),
|
||||
KnownTranslationFactory::commands_me_usage()
|
||||
);
|
||||
|
@ -35,9 +35,9 @@ use function count;
|
||||
|
||||
class OpCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"op",
|
||||
KnownTranslationFactory::pocketmine_command_op_description(),
|
||||
KnownTranslationFactory::commands_op_usage()
|
||||
);
|
||||
|
@ -32,9 +32,9 @@ use function count;
|
||||
|
||||
class PardonCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"pardon",
|
||||
KnownTranslationFactory::pocketmine_command_unban_player_description(),
|
||||
KnownTranslationFactory::commands_unban_usage(),
|
||||
["unban"]
|
||||
|
@ -33,9 +33,9 @@ use function inet_pton;
|
||||
|
||||
class PardonIpCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"pardon-ip",
|
||||
KnownTranslationFactory::pocketmine_command_unban_ip_description(),
|
||||
KnownTranslationFactory::commands_unbanip_usage(),
|
||||
["unban-ip"]
|
||||
|
@ -74,9 +74,9 @@ use function strtolower;
|
||||
|
||||
class ParticleCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"particle",
|
||||
KnownTranslationFactory::pocketmine_command_particle_description(),
|
||||
KnownTranslationFactory::pocketmine_command_particle_usage()
|
||||
);
|
||||
|
@ -36,9 +36,9 @@ use const SORT_STRING;
|
||||
|
||||
class PluginsCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"plugins",
|
||||
KnownTranslationFactory::pocketmine_command_plugins_description(),
|
||||
null,
|
||||
["pl"]
|
||||
|
@ -32,9 +32,9 @@ use function round;
|
||||
|
||||
class SaveCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"save-all",
|
||||
KnownTranslationFactory::pocketmine_command_save_description()
|
||||
);
|
||||
$this->setPermission(DefaultPermissionNames::COMMAND_SAVE_PERFORM);
|
||||
|
@ -30,9 +30,9 @@ use pocketmine\permission\DefaultPermissionNames;
|
||||
|
||||
class SaveOffCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"save-off",
|
||||
KnownTranslationFactory::pocketmine_command_saveoff_description()
|
||||
);
|
||||
$this->setPermission(DefaultPermissionNames::COMMAND_SAVE_DISABLE);
|
||||
|
@ -30,9 +30,9 @@ use pocketmine\permission\DefaultPermissionNames;
|
||||
|
||||
class SaveOnCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"save-on",
|
||||
KnownTranslationFactory::pocketmine_command_saveon_description()
|
||||
);
|
||||
$this->setPermission(DefaultPermissionNames::COMMAND_SAVE_ENABLE);
|
||||
|
@ -35,9 +35,9 @@ use function implode;
|
||||
|
||||
class SayCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"say",
|
||||
KnownTranslationFactory::pocketmine_command_say_description(),
|
||||
KnownTranslationFactory::commands_say_usage()
|
||||
);
|
||||
|
@ -30,9 +30,9 @@ use pocketmine\player\Player;
|
||||
|
||||
class SeedCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"seed",
|
||||
KnownTranslationFactory::pocketmine_command_seed_description()
|
||||
);
|
||||
$this->setPermission(DefaultPermissionNames::COMMAND_SEED);
|
||||
|
@ -36,9 +36,9 @@ use function count;
|
||||
|
||||
class SetWorldSpawnCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"setworldspawn",
|
||||
KnownTranslationFactory::pocketmine_command_setworldspawn_description(),
|
||||
KnownTranslationFactory::commands_setworldspawn_usage()
|
||||
);
|
||||
|
@ -37,9 +37,9 @@ use function round;
|
||||
|
||||
class SpawnpointCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"spawnpoint",
|
||||
KnownTranslationFactory::pocketmine_command_spawnpoint_description(),
|
||||
KnownTranslationFactory::commands_spawnpoint_usage()
|
||||
);
|
||||
|
@ -36,9 +36,9 @@ use function round;
|
||||
|
||||
class StatusCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"status",
|
||||
KnownTranslationFactory::pocketmine_command_status_description()
|
||||
);
|
||||
$this->setPermission(DefaultPermissionNames::COMMAND_STATUS);
|
||||
|
@ -30,9 +30,9 @@ use pocketmine\permission\DefaultPermissionNames;
|
||||
|
||||
class StopCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"stop",
|
||||
KnownTranslationFactory::pocketmine_command_stop_description()
|
||||
);
|
||||
$this->setPermission(DefaultPermissionNames::COMMAND_STOP);
|
||||
|
@ -40,9 +40,9 @@ use function round;
|
||||
|
||||
class TeleportCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"tp",
|
||||
KnownTranslationFactory::pocketmine_command_tp_description(),
|
||||
KnownTranslationFactory::commands_tp_usage(),
|
||||
["teleport"]
|
||||
|
@ -36,9 +36,9 @@ use function implode;
|
||||
|
||||
class TellCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"tell",
|
||||
KnownTranslationFactory::pocketmine_command_tell_description(),
|
||||
KnownTranslationFactory::commands_message_usage(),
|
||||
["w", "msg"]
|
||||
|
@ -35,9 +35,9 @@ use function implode;
|
||||
|
||||
class TimeCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"time",
|
||||
KnownTranslationFactory::pocketmine_command_time_description(),
|
||||
KnownTranslationFactory::pocketmine_command_time_usage()
|
||||
);
|
||||
|
@ -57,9 +57,9 @@ use const PHP_EOL;
|
||||
|
||||
class TimingsCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"timings",
|
||||
KnownTranslationFactory::pocketmine_command_timings_description(),
|
||||
KnownTranslationFactory::pocketmine_command_timings_usage()
|
||||
);
|
||||
|
@ -33,9 +33,9 @@ use function implode;
|
||||
|
||||
class TitleCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"title",
|
||||
KnownTranslationFactory::pocketmine_command_title_description(),
|
||||
KnownTranslationFactory::commands_title_usage()
|
||||
);
|
||||
|
@ -32,9 +32,9 @@ use function count;
|
||||
|
||||
class TransferServerCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"transferserver",
|
||||
KnownTranslationFactory::pocketmine_command_transferserver_description(),
|
||||
KnownTranslationFactory::pocketmine_command_transferserver_usage()
|
||||
);
|
||||
|
@ -40,9 +40,9 @@ use const PHP_VERSION;
|
||||
|
||||
class VersionCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"version",
|
||||
KnownTranslationFactory::pocketmine_command_version_description(),
|
||||
KnownTranslationFactory::pocketmine_command_version_usage(),
|
||||
["ver", "about"]
|
||||
|
@ -38,9 +38,9 @@ use const SORT_STRING;
|
||||
|
||||
class WhitelistCommand extends VanillaCommand{
|
||||
|
||||
public function __construct(string $name){
|
||||
public function __construct(){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"whitelist",
|
||||
KnownTranslationFactory::pocketmine_command_whitelist_description(),
|
||||
KnownTranslationFactory::commands_whitelist_usage()
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user