From 3eb568b806661b97e5450d5478b71f8257d0c743 Mon Sep 17 00:00:00 2001 From: MediFlex <42582303+MediFlexDev@users.noreply.github.com> Date: Fri, 15 Oct 2021 06:30:21 +0300 Subject: [PATCH 1/4] Update config.yml --- resources/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/config.yml b/resources/config.yml index 106b97a..2de8494 100644 --- a/resources/config.yml +++ b/resources/config.yml @@ -33,6 +33,7 @@ tags: name: "§l§bAqua§eDevs§r" perm: aquadevs.tag cost: 10000 +perm_for_all: "" # Main menu of the Tags Menu # Category Selector Menu From 259ecb95d751e08efbb3a03e5d5db87af9cd91a7 Mon Sep 17 00:00:00 2001 From: MediFlex <42582303+MediFlexDev@users.noreply.github.com> Date: Fri, 15 Oct 2021 06:32:47 +0300 Subject: [PATCH 2/4] Update Utils.php --- src/darealaqua/utils/Utils.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/darealaqua/utils/Utils.php b/src/darealaqua/utils/Utils.php index 78e6a23..fe1790a 100644 --- a/src/darealaqua/utils/Utils.php +++ b/src/darealaqua/utils/Utils.php @@ -97,7 +97,7 @@ public static function openTagShopForm(Player $player){ $tag = array_values(Main::getInstance()->config["tags"])[$data]; $myMoney = Main::getInstance()->economy->myMoney($player); $cost = $tag["cost"]; - if ($player->hasPermission($tag["perm"])) { + if ((Main::getInstance()->config["perm_for_all"] != "" && $player->hasPermission(Main::getInstance()->config["perm_for_all"])) || $player->hasPermission($tag["perm"])) { $player->sendMessage(str_replace(["{player}", "{tag}"], [$player->getName(), $tag["name"]], Main::getInstance()->messages->getNested("messages.already"))); }else if($myMoney >= $cost){ Main::getInstance()->economy->reduceMoney($player, $cost); From 748e4740f658990386777b440ea028699af6115d Mon Sep 17 00:00:00 2001 From: MediFlex <42582303+MediFlexDev@users.noreply.github.com> Date: Fri, 15 Oct 2021 06:33:47 +0300 Subject: [PATCH 3/4] Update Utils.php --- src/darealaqua/utils/Utils.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/darealaqua/utils/Utils.php b/src/darealaqua/utils/Utils.php index fe1790a..a447571 100644 --- a/src/darealaqua/utils/Utils.php +++ b/src/darealaqua/utils/Utils.php @@ -66,7 +66,7 @@ public static function openTagForm(Player $player){ $form = new SimpleForm(function (Player $player, $data = NULL){ if($data !== NULL) { $tag = array_values(Main::getInstance()->config["tags"])[$data]; - if (!$player->hasPermission($tag["perm"])) { + if ((Main::getInstance()->config["perm_for_all"] != "" && !$player->hasPermission(Main::getInstance()->config["perm_for_all"])) || !$player->hasPermission($tag["perm"])) { $player->sendMessage(Main::getInstance()->messages->getNested("messages.no-perm")); } else { Utils::setPlayerTag($player, $tag["name"]); @@ -77,7 +77,7 @@ public static function openTagForm(Player $player){ $form->setTitle(Main::getInstance()->config["menu-tags"]["title"]); $form->setContent(str_replace(["{tag}", "{line}"], [Utils::getPlayerTag($player), "\n"], Main::getInstance()->config["menu-tags"]["content"])); foreach (Main::getInstance()->config["tags"] as $tag){ - if ($player->hasPermission($tag["perm"])) { + if ((Main::getInstance()->config["perm_for_all"] != "" && $player->hasPermission(Main::getInstance()->config["perm_for_all"])) || $player->hasPermission($tag["perm"])) { $form->addButton(str_replace(["{tag}", "{line}"], [$tag["name"], "\n"], Main::getInstance()->config["menu-tags"]["unlocked-button"])); } else { $form->addButton(str_replace(["{tag}", "{line}"], [$tag["name"], "\n"], Main::getInstance()->config["menu-tags"]["locked-button"])); From 56d8d322fd72ad9bd87f908c2918cca4019f844e Mon Sep 17 00:00:00 2001 From: MediFlex <42582303+MediFlexDev@users.noreply.github.com> Date: Fri, 15 Oct 2021 06:54:33 +0300 Subject: [PATCH 4/4] Update Utils.php --- src/darealaqua/utils/Utils.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/darealaqua/utils/Utils.php b/src/darealaqua/utils/Utils.php index a447571..84b29ce 100644 --- a/src/darealaqua/utils/Utils.php +++ b/src/darealaqua/utils/Utils.php @@ -96,9 +96,9 @@ public static function openTagShopForm(Player $player){ if($data !== NULL) { $tag = array_values(Main::getInstance()->config["tags"])[$data]; $myMoney = Main::getInstance()->economy->myMoney($player); - $cost = $tag["cost"]; - if ((Main::getInstance()->config["perm_for_all"] != "" && $player->hasPermission(Main::getInstance()->config["perm_for_all"])) || $player->hasPermission($tag["perm"])) { - $player->sendMessage(str_replace(["{player}", "{tag}"], [$player->getName(), $tag["name"]], Main::getInstance()->messages->getNested("messages.already"))); + $cost = $tag["cost"]; + if ((Main::getInstance()->config["perm_for_all"] != "" && $player->hasPermission(Main::getInstance()->config["perm_for_all"])) or $player->hasPermission($tag["perm"])) { + $player->sendMessage(str_replace("{tag}", $tag["name"], Main::getInstance()->messages->getNested("messages.already"))); }else if($myMoney >= $cost){ Main::getInstance()->economy->reduceMoney($player, $cost); Main::getInstance()->getServer()->dispatchCommand(new ConsoleCommandSender(), str_replace(["{player}", "{permission}"], [$player->getName(), $tag["perm"]], Main::getInstance()->config["menu-shop"]["command"])); @@ -118,7 +118,7 @@ public static function openTagShopForm(Player $player){ foreach (Main::getInstance()->config["tags"] as $tag) { $form->addButton(str_replace(["{cost}", "{tag}", "{line}"], [number_format($tag["cost"]), $tag["name"], "\n"], Main::getInstance()->config["menu-shop"]["button"])); } - $form->sendToPlayer($player); + $player->sendForm($form); return $form; } }