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:
BrandPVP 2023-01-09 23:43:08 +03:00 committed by GitHub
parent 545d18eea7
commit 9c391a6809
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
41 changed files with 121 additions and 121 deletions

View File

@ -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()
]);
}

View File

@ -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()
);

View File

@ -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()
);

View File

@ -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()
);

View File

@ -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()
);

View File

@ -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()
);

View File

@ -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()
);

View File

@ -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()
);

View File

@ -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);
}

View File

@ -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()
);

View File

@ -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()
);

View File

@ -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()
);

View File

@ -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);

View File

@ -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()
);

View File

@ -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(),
["?"]

View File

@ -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()
);

View File

@ -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"]

View File

@ -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);

View File

@ -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()
);

View File

@ -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()
);

View File

@ -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"]

View File

@ -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"]

View File

@ -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()
);

View File

@ -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"]

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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()
);

View File

@ -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);

View File

@ -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()
);

View File

@ -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()
);

View File

@ -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);

View File

@ -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);

View File

@ -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"]

View File

@ -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"]

View File

@ -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()
);

View File

@ -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()
);

View File

@ -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()
);

View File

@ -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()
);

View File

@ -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"]

View File

@ -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()
);