From c9632dd62cd5d2c8599e527d7d014b9bc10427f3 Mon Sep 17 00:00:00 2001 From: jasonwynn10 Date: Tue, 7 Jan 2020 19:10:33 -0500 Subject: [PATCH 1/2] Update to API 3 and remove excess keys --- plugin.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/plugin.yml b/plugin.yml index ad87bb8..8160470 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,9 +1,6 @@ ---- name: PlayerSelectors -author: Ad5001 -version: 1.0 -api: [3.0.0-ALPHA9] -main: Ad5001\PlayerSelectors\Main -commands: [] -permissions: [] -... \ No newline at end of file +author: Ad5001 +version: 1.0.0 +api: +- 3.0.0 +main: Ad5001\PlayerSelectors\Main \ No newline at end of file From bba3ec86d22b7bcd6f7d8cf811fac0cd14503934 Mon Sep 17 00:00:00 2001 From: jasonwynn10 Date: Tue, 7 Jan 2020 19:11:01 -0500 Subject: [PATCH 2/2] Fix bug with variable name collisions --- src/Ad5001/PlayerSelectors/Main.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Ad5001/PlayerSelectors/Main.php b/src/Ad5001/PlayerSelectors/Main.php index 323c111..f8cf041 100644 --- a/src/Ad5001/PlayerSelectors/Main.php +++ b/src/Ad5001/PlayerSelectors/Main.php @@ -83,14 +83,14 @@ class Main extends PluginBase implements Listener { $params = self::$selectors[$matches[1][$index]]->acceptsModifiers() ? $this->checkArgParams($matches, $index): []; // Applying the selector $newCommandsToExecute = []; - foreach($commandsToExecute as $index => $cmd){ + foreach($commandsToExecute as $indexB => $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){ + foreach(self::$selectors[$matches[1][$indexB]]->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 :/ $newCommandsToExecute[] = substr_replace($cmd, " " . $selectorStr . " ", strpos($cmd, $match), strlen($match)); } if(count($newCommandsToExecute) == 0) { - $sender->sendMessage("§cYour selector $match (" . self::$selectors[$matches[1][$index]]->getName() . ") did not mactch any player/entity."); + $sender->sendMessage("§cYour selector $match (" . self::$selectors[$matches[1][$indexB]]->getName() . ") did not match any player/entity."); return true; } }