Skip to content
This repository has been archived by the owner on Jul 26, 2022. It is now read-only.

tedo0627/CommandSelector-PMMP-Library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CommandSelector-PMMP-Library

command selector library

Install

Copy the downloaded selector folder to the src folder of the plugin.

How to use

Suppose you want to process the command /test @p.

use selector\CommandSelector;

public function onCommand(CommandSender $sender, Command $command, string $label, array $args) : bool {
    if ($label != "test") {
        return false;
    }

    if (count($args) < 1) {
        $sender->sendMessage("/test [target]");
        return false;
    }

    $selector = new CommandSelector();
    $entities = $selector->getEntities($sender, $args[0]);
    foreach ($entities as $entity) {
        // process
    }

    return true;
}