Skip to content

Instantly share code, notes, and snippets.

@PJZ9n
Last active March 12, 2019 12:52
Show Gist options
  • Save PJZ9n/1f28eb342c13e309cd41e3e24b7b807e to your computer and use it in GitHub Desktop.
Save PJZ9n/1f28eb342c13e309cd41e3e24b7b807e to your computer and use it in GitHub Desktop.
<?php
/*******************************************************************************
* Copyright © 2019 PJSoft All Rights Reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
class ExampleCommand extends Command {
public function __construct() {
$name = "example";
$description = "Command";
$usageMessage = "/example";
$aliases = array();
parent::__construct($name, $description, $usageMessage, $aliases);
$this->setPermission("permission.example.test");
}
public function execute(CommandSender $sender, string $commandLabel, array $args): bool {
if (!$this->testPermission($sender)) {
$sender->sendMessage(TextFormat::RED . "権限がないよ!");
return true;
}
//権限があった
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment