Skip to content
This repository was archived by the owner on Apr 10, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions src/darealaqua/utils/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"]);
Expand All @@ -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"]));
Expand All @@ -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 ($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"]));
Expand All @@ -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;
}
}