From b5bc652f95e957ee1c8e7201ba544ee6f4a58daf Mon Sep 17 00:00:00 2001 From: Infernus Date: Thu, 2 Nov 2017 20:07:27 +0530 Subject: [PATCH] v1.1.2 (#17) * v.1.1.2 * typo * typo * Update KitMainMenu.php * More test kits for examples.. --- plugin.yml | 2 +- resources/kits.yml | 49 ++++++++++++++++++- src/Infernus101/KitUI/Kit.php | 4 +- src/Infernus101/KitUI/Main.php | 7 +-- .../KitUI/UI/windows/KitMainMenu.php | 1 + 5 files changed, 56 insertions(+), 7 deletions(-) diff --git a/plugin.yml b/plugin.yml index d554d5d..6864ffc 100644 --- a/plugin.yml +++ b/plugin.yml @@ -2,7 +2,7 @@ name: KitUI author: Infernus101 api: [3.0.0-ALPHA1, 3.0.0-ALPHA2, 3.0.0-ALPHA3, 3.0.0-ALPHA4, 3.0.0-ALPHA5, 3.0.0-ALPHA6, 3.0.0-ALPHA7, 3.0.0-ALPHA8, 3.0.0-ALPHA9] main: Infernus101\KitUI\Main -version: 1.1.1 +version: 1.1.2 permission: # kit permissions - kit. kit.command: description: kit command! diff --git a/resources/kits.yml b/resources/kits.yml index 4756ce0..438eeb7 100644 --- a/resources/kits.yml +++ b/resources/kits.yml @@ -38,4 +38,51 @@ testkit: # Info to show when selected a Kit in UI form info: "This kit is too op XD Cost: 50$" -... \ No newline at end of file +testkit2: + + items: + - "260:0:10" + - "267:0:1:Sword Name:sharpness:3:knockback:1" + helmet: "302:0:1" + chestplate: "303:0:1:DEFAULT:protection:1" + leggings: "304:0:1:Leggings Name" + boots: "305:0:1" + + commands: + - "tell {player} Kit 2 claimed!" + + cooldown: + hours: 24 + minutes: 30 + + effects: + - "speed:120:2" + + money: 50 + + info: "This kit is too op XD Cost: 50$" + +testkit3: + + items: + - "260:0:10" + - "267:0:1:Sword Name:sharpness:3:knockback:1" + helmet: "302:0:1" + chestplate: "303:0:1:DEFAULT:protection:1" + leggings: "304:0:1:Leggings Name" + boots: "305:0:1" + + commands: + - "tell {player} Kit 3 claimed!" + + cooldown: + hours: 24 + minutes: 30 + + effects: + - "speed:120:2" + + money: 50 + + info: "This kit is too op XD Cost: 50$" +... diff --git a/src/Infernus101/KitUI/Kit.php b/src/Infernus101/KitUI/Kit.php index 8f2b360..b68c939 100644 --- a/src/Infernus101/KitUI/Kit.php +++ b/src/Infernus101/KitUI/Kit.php @@ -106,8 +106,8 @@ public function loadItem(int $id = 0, int $damage = 0, int $count = 1, string $n $ench = CustomEnchants::getEnchantByName((string) $name_level); } }elseif($ench !== null){ - if($this->ak->piggyEnchants !== null && $ench instanceof CustomEnchants){ - $this->ak->piggyEnchants->addEnchantment($item, $ench->getName(), (int) $name_level); + if($this->pl->piggyEnchants !== null && $ench instanceof CustomEnchants){ + $this->pl->piggyEnchants->addEnchantment($item, $ench->getName(), (int) $name_level); }else{ $item->addEnchantment($ench->setLevel((int) $name_level)); } diff --git a/src/Infernus101/KitUI/Main.php b/src/Infernus101/KitUI/Main.php index 6f62df2..d3eb791 100644 --- a/src/Infernus101/KitUI/Main.php +++ b/src/Infernus101/KitUI/Main.php @@ -6,6 +6,7 @@ use Infernus101\KitUI\lang\LangManager; use Infernus101\KitUI\tasks\CoolDownTask; use pocketmine\Player; +use pocketmine\item\enchantment\Enchantment; use pocketmine\Server; use pocketmine\command\CommandSender; use pocketmine\command\ConsoleCommandSender; @@ -47,9 +48,9 @@ public function onEnable(){ Enchantment::registerEnchantment(new Enchantment(Enchantment::SHARPNESS, "%enchantment.sharpness", Enchantment::RARITY_COMMON, Enchantment::ACTIVATION_SELF, Enchantment::SLOT_NONE)); } $this->piggyEnchants = $this->getServer()->getPluginManager()->getPlugin("PiggyCustomEnchants"); - if ($customEnchants !== null) { - $this->getServer()->getLogger()->info(TextFormat::GREEN . "[KitUI] Using PiggyCustomEnchants!"); - } + if($this->piggyEnchants !== null){ + $this->getServer()->getLogger()->info(TextFormat::GREEN . "[KitUI] Using PiggyCustomEnchants!"); + } $allKits = yaml_parse_file($this->getDataFolder()."kits.yml"); foreach($allKits as $name => $data){ $this->kits[$name] = new Kit($this, $data, $name); diff --git a/src/Infernus101/KitUI/UI/windows/KitMainMenu.php b/src/Infernus101/KitUI/UI/windows/KitMainMenu.php index cb9db1b..6538a80 100644 --- a/src/Infernus101/KitUI/UI/windows/KitMainMenu.php +++ b/src/Infernus101/KitUI/UI/windows/KitMainMenu.php @@ -12,6 +12,7 @@ class KitMainMenu extends Window { public function process(): void { + parent::$id = array(); $title = $this->pl->language->getTranslation("mainmenu-title"); $content = $this->pl->language->getTranslation("mainmenu-content"); $this->data = [