Spigot Simple GUI | Create GUI in 10 seconds! 1.0

Making GUI's in Minecraft was never easy as now!

  1. MartinPL submitted a new resource:

    Simple GUI | Create GUI in 10 seconds! - Making GUI's in Minecraft was never easy as now!

    Read more about this resource...
     
  2. Hello, i am trying to create a gui with 3 different color wool and if you click it, it will add you to an arraylist (GREEN, BLUE, RED)
    But i dont know how to do this. Can you please give me example code at least?
     
  3. Yes, i can write this for you

    Red was 14 i remember that, but for rest check it on internet :D

    Code (Text):

    GUI g = new GUI("Here's title", 9, 123);
    g.setItem(0, Material.WOOL (short) 0, "White");
    g.setItem(1, Material.WOOL (short) 1, "Orange");
    g.setItem(2, Material.WOOL (short) 3, "3 was Green?");
    g.setTo(Here's player);
     
    Now events:
    Code (Text):

    @EventHandler
       public void on(onGuiItemClickEvent e) {
           e.setCancelled(true);
           if(e.getGui().getOwn() == 123) {
               if(e.getSlot() == 0) {
                   //Here you add this player to you ArraList :) ex. White.add(e.getPlayer().getName());   <--If you want to check for name, not for player
                   //If you want to close his inventory add this:
    //           Bukkit.getScheduler().runTaskLater(this, new Runnable() {
    //               public void run() {
    //                   e.getPlayer().closeInventory();
    //               }
    //           }, 1);
               }
           }
       }



    @EventHandler
       public void on(onGuiShiftClickFromBottomInventoryEvent e) {
           if(e.getGui().getOwn() == 123) {
               e.setCancelled(true);
           }
       }
     
     
  4. This doesnt work, it doesnt let me do g.
    it just underlines it.
    Code (Text):
    g.setItem(0, Material.WOOL (short) 0, "Red");
    g.setItem(1, Material.WOOL (short) 1, "Blue");
    g.setItem(2, Material.WOOL (short) 3, "Green");


    Thanks alot for the help!! <3
    btw gui doesnt seem to be opening, no errors?
    buy class:
    Code (Text):

    package me.thesilentpro.net.coins;

    import java.util.HashMap;
    import java.util.Map;
    import java.util.UUID;

    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.event.EventHandler;
    import org.bukkit.event.Listener;

    import gui.api.GUI;
    import gui.api.onGuiItemClickEvent;
    import gui.api.onGuiShiftClickFromBottomInventoryEvent;

    public class Buy implements Listener, CommandExecutor {

       
       
        public static Map<UUID, String> color = new HashMap<UUID, String>();
       
        GUI g = new GUI("ChatColor", 9, 123);
       
        Material m = Material.WOOL;
       
        @EventHandler
           public void on(onGuiItemClickEvent e) {
            g.setItem(3, m, (short) 14, "RED");
            g.setItem(5, m, (short) 11, "BLUE");
            g.setItem(7, m, (short) 6, "GREEN");
               e.setCancelled(true);
               if(e.getGui().getOwn() == 123) {
                   if(e.getSlot() == 3) {
                       color.put(e.getPlayer().getUniqueId(), "red");
                       e.getPlayer().sendMessage(ChatColor.RED + "ChatColor set to RED!");
                   }else if (e.getSlot() == 5) {
                       color.put(e.getPlayer().getUniqueId(), "blue");
                       e.getPlayer().sendMessage(ChatColor.BLUE + "ChatColor set to BLUE!");
                   }else if (e.getSlot() == 7) {
                       color.put(e.getPlayer().getUniqueId(), "green");
                       e.getPlayer().sendMessage(ChatColor.GREEN + "ChatColor set to GREEN!");
                   }
               }
           }



        @EventHandler
           public void on(onGuiShiftClickFromBottomInventoryEvent e) {
               if(e.getGui().getOwn() == 123) {
                   e.setCancelled(true);
               }
           }
       
        public boolean onCommand(CommandSender sender, Command cmd, String label, String args[]) {
            if (sender.hasPermission("upg.shop")) {
                if (sender instanceof Player) {
                    Player p = (Player) sender;
                    if (p.hasPermission("upg.shop")) {
                    p.sendMessage(ChatColor.GREEN + "Opening the shop...");
                    g.setTo(p);
                    }else {
                        p.sendMessage(ChatColor.RED + "No permission!");
                    }
                }
            }else {
                sender.sendMessage("Only for players!");
            }
            return true;
        }

    }

     
    ERROR from console:
    Code (Text):
    01.09 18:08:41 [Server] ERROR Error occurred while enabling UPGamers v4.0 (Is it up to date?) 01.09 18:08:41 [Server] INFO java.lang.NoClassDefFoundError: gui/api/GUI 01.09 18:08:41 [Server] INFO at me.thesilentpro.net.coins.Buy.<init>(Buy.java:26) ~[?:?] 01.09 18:08:41 [Server] INFO at me.thesilentpro.net.Main.onEnable(Main.java:197) ~[?:?] 01.09 18:08:41 [Server] INFO at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[spigot-1.12.2.jar:git-Spigot-2086bb0-d0a3620] 01.09 18:08:41 [Server] INFO at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:337) [spigot-1.12.2.jar:git-Spigot-2086bb0-d0a3620] 01.09 18:08:41 [Server] INFO at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:403) [spigot-1.12.2.jar:git-Spigot-2086bb0-d0a3620] 01.09 18:08:41 [Server] INFO at com.rylinaux.plugman.util.PluginUtil.load(PluginUtil.java:366) [plugman.jar:?] 01.09 18:08:41 [Server] INFO at com.rylinaux.plugman.command.LoadCommand.execute(LoadCommand.java:114) [plugman.jar:?] 01.09 18:08:41 [Server] INFO at com.rylinaux.plugman.PlugManCommandHandler.onCommand(PlugManCommandHandler.java:95) [plugman.jar:?] 01.09 18:08:41 [Server] INFO at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) [spigot-1.12.2.jar:git-Spigot-2086bb0-d0a3620] 01.09 18:08:41 [Server] INFO at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) [spigot-1.12.2.jar:git-Spigot-2086bb0-d0a3620] 01.09 18:08:41 [Server] INFO at org.bukkit.craftbukkit.v1_12_R1.CraftServer.dispatchCommand(CraftServer.java:648) [spigot-1.12.2.jar:git-Spigot-2086bb0-d0a3620] 01.09 18:08:41 [Server] INFO at net.minecraft.server.v1_12_R1.PlayerConnection.handleCommand(PlayerConnection.java:1397) [spigot-1.12.2.jar:git-Spigot-2086bb0-d0a3620] 01.09 18:08:41 [Server] INFO at net.minecraft.server.v1_12_R1.PlayerConnection.a(PlayerConnection.java:1232) [spigot-1.12.2.jar:git-Spigot-2086bb0-d0a3620] 01.09 18:08:41 [Server] INFO at net.minecraft.server.v1_12_R1.PacketPlayInChat.a(PacketPlayInChat.java:45) [spigot-1.12.2.jar:git-Spigot-2086bb0-d0a3620] 01.09 18:08:41 [Server] INFO at net.minecraft.server.v1_12_R1.PacketPlayInChat.a(PacketPlayInChat.java:1) [spigot-1.12.2.jar:git-Spigot-2086bb0-d0a3620] 01.09 18:08:41 [Server] INFO at net.minecraft.server.v1_12_R1.PlayerConnectionUtils$1.run(SourceFile:13) [spigot-1.12.2.jar:git-Spigot-2086bb0-d0a3620] 01.09 18:08:41 [Server] INFO at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_171] 01.09 18:08:41 [Server] INFO at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_171] 01.09 18:08:41 [Server] INFO at net.minecraft.server.v1_12_R1.SystemUtils.a(SourceFile:46) [spigot-1.12.2.jar:git-Spigot-2086bb0-d0a3620] 01.09 18:08:41 [Server] INFO at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:748) [spigot-1.12.2.jar:git-Spigot-2086bb0-d0a3620] 01.09 18:08:41 [Server] INFO at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:406) [spigot-1.12.2.jar:git-Spigot-2086bb0-d0a3620] 01.09 18:08:41 [Server] INFO at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:679) [spigot-1.12.2.jar:git-Spigot-2086bb0-d0a3620] 01.09 18:08:41 [Server] INFO at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:577) [spigot-1.12.2.jar:git-Spigot-2086bb0-d0a3620] 01.09 18:08:41 [Server] INFO at java.lang.Thread.run(Thread.java:748) [?:1.8.0_171] 01.09 18:08:41 [Server] INFO Caused by: java.lang.ClassNotFoundException: gui.api.GUI 01.09 18:08:41 [Server] INFO at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[?:1.8.0_171] 01.09 18:08:41 [Server] INFO at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:152) ~[spigot-1.12.2.jar:git-Spigot-2086bb0-d0a3620] 01.09 18:08:41 [Server] INFO at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:100) ~[spigot-1.12.2.jar:git-Spigot-2086bb0-d0a3620] 01.09 18:08:41 [Server] INFO at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_171] 01.09 18:08:41 [Server] INFO at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_171] 01.09 18:08:41 [Server] INFO ... 24 more
     
    #6 UnlimitedNinjas, Sep 1, 2018
    Last edited: Sep 1, 2018