Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
2.5 kB
3
Indexable
Never
package me.bluecoder.arcadegames;


import dev.triumphteam.gui.guis.Gui;
import dev.triumphteam.gui.guis.GuiItem;
import net.kyori.adventure.text.Component;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

public class MainGUI implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command command, String s, String[] strings) {

        if(sender instanceof Player){
            Player player = (Player) sender;
            Gui gui = Gui.gui()
                    .title(Component.text(ChatColor.translateAlternateColorCodes('&' , "&l&6A&4R&1C&aA&eD&5E &r&bGames")))
                    .rows(3)
                    .create();


            ItemStack glass = new ItemStack(Material.BLACK_STAINED_GLASS_PANE);
            ItemMeta metaglass = glass.getItemMeta();
            metaglass.setDisplayName(ChatColor.translateAlternateColorCodes('&' ,"&d"));
            glass.setItemMeta(metaglass);


            GuiItem glassgui = new GuiItem(glass , event -> {

                event.setCancelled(true);

            });

            ItemStack creeper = new ItemStack(Material.CREEPER_HEAD);
            ItemMeta metacreeper = creeper.getItemMeta();
            metacreeper.setDisplayName(ChatColor.translateAlternateColorCodes('&' ,"&2Hit my head! Boom!"));
            creeper.setItemMeta(metacreeper);


            GuiItem creepergui = new GuiItem(creeper , event -> {

                event.setCancelled(true);

            });

            ItemStack close = new ItemStack(Material.RED_WOOL);
            ItemMeta metaclose =close.getItemMeta();
            metaclose.setDisplayName(ChatColor.translateAlternateColorCodes('&' ,"&4Close"));
            close.setItemMeta(metaclose);


            GuiItem closegui = new GuiItem(close , event -> {

                event.setCancelled(true);
                player.closeInventory();
            });

            gui.getFiller().fillBorder(glassgui);
            gui.setItem(10,glassgui);
            gui.setItem(12,glassgui);
            gui.setItem(14,glassgui);
            gui.setItem(16,glassgui);
            gui.setItem(11,creepergui);
            gui.setItem(26 , closegui);
        }


        return false;
    }
}