This commit is contained in:
parent
6af48441a4
commit
acc7f076e0
7 changed files with 262 additions and 3 deletions
|
@ -0,0 +1,59 @@
|
|||
package me.unurled.sacredrealms.sr.gui.treasure;
|
||||
|
||||
import static me.unurled.sacredrealms.sr.utils.Component.textComp;
|
||||
|
||||
import me.unurled.sacredrealms.sr.components.treasure.Treasure;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import xyz.xenondevs.invui.gui.Gui;
|
||||
import xyz.xenondevs.invui.gui.Gui.Builder.Normal;
|
||||
import xyz.xenondevs.invui.item.Item;
|
||||
import xyz.xenondevs.invui.item.impl.SimpleItem;
|
||||
|
||||
public class TreasureGUI {
|
||||
|
||||
@NotNull
|
||||
public static Gui createGui(@NotNull Treasure treasure) {
|
||||
ItemStack itemStack = new ItemStack(Material.GRAY_STAINED_GLASS_PANE);
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
itemMeta.displayName(textComp(""));
|
||||
itemStack.setItemMeta(itemMeta);
|
||||
Item pane = new SimpleItem(itemStack);
|
||||
Normal gui =
|
||||
Gui.normal()
|
||||
.setStructure(".........", "abcdefghi", "jklmnopqr", "stuvwxyz$", "...123...")
|
||||
.addIngredient('.', pane);
|
||||
if (!treasure.getItems().isEmpty()) {
|
||||
for (int i = 0; i < treasure.getItems().size(); i++) {
|
||||
Item item = new SimpleItem(treasure.getItems().get(i));
|
||||
if (i == 28) {
|
||||
gui.addIngredient('$', item);
|
||||
} else {
|
||||
gui.addIngredient((char) (i + 'a'), item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack cancel = new ItemStack(Material.BARRIER);
|
||||
ItemMeta cancelMeta = cancel.getItemMeta();
|
||||
cancelMeta.displayName(textComp("<b><red>Cancel</red></b>"));
|
||||
cancel.setItemMeta(cancelMeta);
|
||||
|
||||
ItemStack confirm = new ItemStack(Material.GREEN_STAINED_GLASS_PANE);
|
||||
ItemMeta confirmMeta = confirm.getItemMeta();
|
||||
confirmMeta.displayName(textComp("<b><green>Confirm</green></b>"));
|
||||
confirm.setItemMeta(confirmMeta);
|
||||
|
||||
ItemStack delete = new ItemStack(Material.RED_STAINED_GLASS_PANE);
|
||||
ItemMeta deleteMeta = delete.getItemMeta();
|
||||
deleteMeta.displayName(textComp("<b><red>Delete</red></b>"));
|
||||
delete.setItemMeta(deleteMeta);
|
||||
|
||||
gui.addIngredient('1', new SimpleItem(delete));
|
||||
gui.addIngredient('2', new SimpleItem(cancel));
|
||||
gui.addIngredient('3', new SimpleItem(confirm));
|
||||
return gui.build();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue