Fixing some underlying issues with command messages of players
This commit is contained in:
parent
1bd147133c
commit
6a5ddcd42d
1 changed files with 3 additions and 3 deletions
|
@ -50,8 +50,8 @@ class Main extends PluginBase implements Listener {
|
|||
* @return void
|
||||
*/
|
||||
public function onCommandPreProcess(PlayerCommandPreProcessEvent $event): void{
|
||||
$m = $event->getMessage();
|
||||
if($this->execSelectors($m, $event->getPlayer())) $event->setCancelled();
|
||||
$m = substr($event->getMessage(), 1);
|
||||
if(substr($event->getMessage(), 0, 1) == "/" && $this->execSelectors($m, $event->getPlayer())) $event->setCancelled();
|
||||
}
|
||||
|
||||
|
||||
|
@ -86,7 +86,7 @@ class Main extends PluginBase implements Listener {
|
|||
foreach($commandsToExecute as $index => $cmd){
|
||||
// Foreaching the returning commands to push them to the new commands to be executed at the next run.
|
||||
foreach(self::$selectors[$matches[1][$index]]->applySelector($sender, $params) as $selectorStr){
|
||||
if(strpos($selectorStr, " ") !== -1) $selectorStr = explode($selectorStr)[count(explode($selectorStr)) - 1]; // Name w/ spaces. Match the nearest name in the player. Not perfect :/
|
||||
if(strpos($selectorStr, " ") !== -1) $selectorStr = explode(" ", $selectorStr)[count(explode(" ", $selectorStr)) - 1]; // Name w/ spaces. Match the nearest name in the player. Not perfect :/
|
||||
$newCommandsToExecute[] = substr_replace($cmd, " " . $selectorStr . " ", strpos($cmd, $match), strlen($match));
|
||||
}
|
||||
if(count($newCommandsToExecute) == 0) {
|
||||
|
|
Loading…
Reference in a new issue