Server selector help!

Discussion in 'Plugin Development' started by HarutCraft, May 20, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    HarutCraft

    im coding a server selector plugin and i don't know how to make it execute a command on the click of a item in a GUI right now my code is : http://pastebin.com/xxg5Na6Q can someone help me?
     
  2. Offline

    nverdier

    Just sayin', if you want to have a more "automated" GUI system, you could use the InventoryGUI and IAction classes from EnviousAPI, link in signature.
     
  3. Offline

    HarutCraft

    sooo right now i have http://pastebin.com/EHwFxDbL how do i choose what command it will execute when i click on golden apple
     
  4. Offline

    nverdier

    @HarutCraft
    1) Create a new InventoryGUI
    2) Add an item with an IClickEvent that runs a command when they click it
    3) Open the inventory for a Player
     
  5. Offline

    Nateb1121

    Just for future reference, the way to execute a command as console is:
    Code:
    Bukkit.executeCommand(Bukkit.getConsoleSender(), COMMAND_HERE); 
    The way to make a player do a command
    Code:
    Player p;
    p.performCommand(COMMAND_HERE); 
     
  6. Offline

    HarutCraft

    here is my code right now im getting a error on line 78 that plugin is not variable http://pastebin.com/i8kAFAYE
     
  7. @Nateb1121 Also, executeCommand() isn't just for the console - it's for any CommandSender. So you can always just replace Bukkit.getConsoleSender() with the player and it'd also work.


    @HarutCraft It's clear from your code that you are fairly new to Java. Please learn the basics of Java, before trying to make a plugin. Bukkit is written in Java, so learning it is compulsory. Otherwise you will just run into problems such as this, and have no idea how to solve them. I'd recommend the Oracle tutorials or a Java book.
     
    nverdier and Nateb1121 like this.
Thread Status:
Not open for further replies.

Share This Page