Solved Checking if a block opens a GUI.

Discussion in 'Plugin Development' started by Premm, Oct 13, 2013.

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

    Premm

    Is there a way to check if a block will open a GUI in the bukkit API?
    Something like event.getClickedBlock().hasGUI()? By GUI I just mean blocks like chests, furnaces, dispensers, anvils, etc. If there isnt that's fine, ill just find each block individually and add them into my code one at a time, but it might be something that's definitely worth adding to the API if its not in there already.
     
  2. Offline

    MrSparkzz

    Just make your own method which contains each block that has a gui. I really don't see any use for this, since you can just check to see if a certain block is clicked.
     
  3. Offline

    mattrick

    I guess it would be shorter than
    if (block = Material.Chest || block = Material Dispenser.....
     
  4. Offline

    Premm

    I just thought if there was a way to check if a GUI opens itself, rather than just list a bunch of blocks that have a GUI, then it would have more uses than just checking to see if someone clicked on a block. I'm not quite sure if mods created using the craftbukkit source code share the same API, but if so then any new blocks created that open up GUI's would still work. I guess the main benefit is that it just wouldn't need modifying over time, as new blocks get added with new GUI's. I guess they are very infrequent though, and updating a bit of code to add a line in for a new block that gets created isn't troublesome. I was just curious. Thanks
     
  5. Offline

    Ultimate_n00b

    Mark as solved then.
     
    MrSparkzz likes this.
Thread Status:
Not open for further replies.

Share This Page