Creating GUI on a click event only after a command has been issued?

Discussion in 'Plugin Development' started by devjoll, Aug 6, 2016.

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

    devjoll

    I'm writing a plugin (my first) that will allow users to rotate a block with a series of commands and GUIs

    Here's the idea that I have so far:

    Command: /rotate
    Return: [in chat] Right-click on a block you would like to rotate

    ---
    I have that command set with that feedback prompt being returned in chat
    ---

    User input: Selects block
    Return: 9x9 InventoryGUI with three options for axes (X, Y Z)

    ---
    I have the GUI layout created... and that's about it. I don't know how to get a player to actually select a block. Also, I don't have all of the clickEvents written
    ---

    What I want to happen is that if a player wants to rotate a block, they would type in chat /rotate
    They would get a return message in chat saying 'Right click on a block you would like to rotate'
    After this event a player would right-click on a block and a GUI would pull up saying "Select an axis" with three options. I have the inventoryGUI layout completed, but that's about it. I was wondering how I might go about handling this. I know it's possible because plugins like LockettePro have something similar.

    Here is a link to the source code: http://pastebin.com/XsxHn47s

    Thanks in advance for any help.
     
    Last edited: Aug 6, 2016
  2. You know, you can only rotate some of the blocks on the y axis (piston, stairs, hopper, etc.), not blocks like grass, stone etc.
    And even fewer on the x/z axis (upside down stair/halfslab/piston, etc.). This sounds like a really complicated first plugin if you want to consider that all. I would highly recommend you to start with something simpler and work your way up.
     
  3. Offline

    Marti201

    When a player types /rotate, add them to an arraylist
    PlayerInteractEvent:
    • Check if the player is in the arraylist and if they are right clicking a block
    • open the GUI
    • remove them from the arraylist
    • Add them to a hashmap with the block coordinates
    InventoryCloseEvent:
    • If the player is in the hashmap, remove them
    Also, remember not to store the player object in the arraylist or the hashmap, store their UUID instead.
     
Thread Status:
Not open for further replies.

Share This Page