Hi I am working on my plugin His name is: luckygift So when you type /lucky The plugin will take from you economy money and give you lucky items But how i can make when you don't have money tell you : Message: You Don't have money And don't give the player items
Assuming you're using EconomyAPI PHP: // Get our dependency$economy = $this->getServer()->getPluginManager()->getPlugin("EconomyAPI");if(!$economy or !$economy->isEnabled()) { $this->getLogger()->notice("EconomyAPI can't be used as it's now disabled. Stopping..."); $this->getServer()->getPluginManager()->disablePlugin($this); return;}$money = $economy->myMoney($player); // Player's money balance$price = 100; // Your /lucky command priceif(!$money) { $player->sendMessage("Sorry but this feature is currently unvailable, try again later."); return true;}if( ($money - $price) < 0 ) { $player->sendMessage("You don't have enough money"); return true;} Add this to your plugin.yml Code: depend: EconomyAPI
Are you kidding me? You're lucky because you know how to quote posts if not I would delete it straight ahead.
I perfer getting economy api using : PHP: use onebone\economyapi\EconomyAPI;...$economy = EconomyAPI::getInstance();