diff --git a/plugin.yml b/plugin.yml index 6864ffc..b5141ff 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.2 +version: 1.1.3 permission: # kit permissions - kit. kit.command: description: kit command! diff --git a/resources/kits.yml b/resources/kits.yml index 438eeb7..b8ca79e 100644 --- a/resources/kits.yml +++ b/resources/kits.yml @@ -35,6 +35,9 @@ testkit: # Add a cost for the kit. Compatible with EconomyAPI only # Put 0 if you want the kit to be free money: 50 + + #Enter image url for the kit. png image. The image will be shown in kit main menu if its compatible. + image-url: "https://minecraft.gamepedia.com/media/minecraft.gamepedia.com/f/f2/Stone_Sword.png?version=ede6f1623f23eb3959b3d5287dc54bb0" # Info to show when selected a Kit in UI form info: "This kit is too op XD Cost: 50$" @@ -59,6 +62,8 @@ testkit2: - "speed:120:2" money: 50 + + image-url: "" info: "This kit is too op XD Cost: 50$" @@ -83,6 +88,8 @@ testkit3: - "speed:120:2" money: 50 + + image-url: "" info: "This kit is too op XD Cost: 50$" ... diff --git a/src/Infernus101/KitUI/UI/windows/KitMainMenu.php b/src/Infernus101/KitUI/UI/windows/KitMainMenu.php index 6538a80..c67ffca 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 { + $url = ""; parent::$id = array(); $title = $this->pl->language->getTranslation("mainmenu-title"); $content = $this->pl->language->getTranslation("mainmenu-content"); @@ -23,7 +24,13 @@ public function process(): void { ]; foreach($this->pl->kits as $name => $data){ $name = ucfirst($name); - $this->data["buttons"][] = ["text" => "§f$name"]; + $kits = $this->pl->getKit($name); + if(isset($kits->data["image-url"])){ + $url = $kits->data["image-url"]; + $this->data["buttons"][] = ["text" => "$name", "image" => ["type" => "url", "data" => $url]]; + }else{ + $this->data["buttons"][] = ["text" => "$name"]; + } array_push(parent::$id, "$name"); } }