Skip to content

Commit

Permalink
Command
Browse files Browse the repository at this point in the history
  • Loading branch information
antbag-dev authored Jun 12, 2024
1 parent 989cb6a commit 4a63b70
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/antbag/JoinCount/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@ public function onEnable(): void {
$this->listener = new PlayerJoinListener($this->getDataFolder() . "playerData.json", $this->config);
$this->getServer()->getPluginManager()->registerEvents($this->listener, $this);

// Dodanie uprawnienia
$perm = new Permission("joincount.totalplayers", "Allows the user to see the total number of players");
PermissionManager::getInstance()->addPermission($perm);
}

public function onCommand(CommandSender $sender, Command $command, string $label, array $args): bool {
if ($command->getName() === "totalplayers") {
if ($command->getName() === "registeredplayers") {
if($sender->hasPermission("joincount.totalplayers")) {
$totalPlayers = count($this->listener->loadData());
$sender->sendMessage("Total players registered: " . $totalPlayers);
Expand Down

0 comments on commit 4a63b70

Please sign in to comment.