Skip to content
This repository has been archived by the owner on Jul 7, 2020. It is now read-only.

Commit

Permalink
Images support on buttons (#26)
Browse files Browse the repository at this point in the history
* v.1.1.3 update

* Add image's url for kit's button in config

* Kits with images

v1.1.3
  • Loading branch information
Infernus101 committed Nov 7, 2017
1 parent 1bd50e7 commit 2b667ee
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 name>
kit.command:
description: kit command!
Expand Down
7 changes: 7 additions & 0 deletions resources/kits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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$"
Expand All @@ -59,6 +62,8 @@ testkit2:
- "speed:120:2"

money: 50

image-url: ""

info: "This kit is too op XD Cost: 50$"

Expand All @@ -83,6 +88,8 @@ testkit3:
- "speed:120:2"

money: 50

image-url: ""

info: "This kit is too op XD Cost: 50$"
...
9 changes: 8 additions & 1 deletion src/Infernus101/KitUI/UI/windows/KitMainMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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");
}
}
Expand Down

0 comments on commit 2b667ee

Please sign in to comment.