Solved AnvilGUI through NMS

Discussion in 'Spigot Plugin Development' started by Ardno, Jan 20, 2020.

  1. Hello,
    I'm working on economy plugin and I need show anvil menu for get from player number. I would like this through NMS, but I don't know how. I saw some other posts, but they don't help me.
    Can you describe me please how I would to do?

    Sorry for my bad english xd
     
  2. Joshb_

    Supporter

  3. Hmm, that's good idea, but... I tried import the .zip AnvilGUI plugin to my plugin, but if I used code new AnvilGUI(see down)
    My program says me this class wasn't found.

    AnvilGUI
    Code (Java):
    new AnvilGUI.Builder()
        .onClose(player -> {                   //called when the inventory is closing
            player.sendMessage("You closed the inventory.");
        })
        .onComplete((player, text) -> {        //called when the inventory output slot is clicked
            if(text.equalsIgnoreCase("you")) {
                player.sendMessage("You have magical powers!");
                return AnvilGUI.Response.close();
            } else {
                return AnvilGUI.Response.text("Incorrect.");
            }
        })
        .preventClose()                        //prevents the inventory from being closed
        .text("What is the meaning of life?")  //sets the text the GUI should start with
        .plugin(myPluginInstance)              //set the plugin instance
        .open(myPlayer);                       //opens the GUI for the player provided
    Imported AnvilGUI
    upload_2020-1-21_18-9-1.png
    AnvilGUI-master.zip
    upload_2020-1-21_18-11-21.png
    Under AnvilGUI-master folder
    upload_2020-1-21_18-11-51.png
     
  4. That's not how you add libraries. You'll either have to include all the AnvilGUI classes in your plugin or use Maven to shade the library into your plugin.
     
    • Winner Winner x 1
  5. Ok, how to use maven? :D / What is it
     
  6. @Ardno Maven is project management software commonly used for a variety of reasons, including library management. Asking how to use it is outside the scope of your original question and this forum, and will depend on which IDE you're using. Here's a tutorial for using it with IntelliJ: https://www.spigotmc.org/wiki/creating-a-plugin-with-maven-using-intellij-idea/

    If you're using a different IDE or have more questions about Maven, then Google is your friend.
     
    • Winner Winner x 1