Cancel workbench GUI but keep Sign GUI

Discussion in 'Plugin Development' started by xGhOsTkiLLeRx, May 10, 2012.

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

    xGhOsTkiLLeRx

    Hello guys.

    Maybe you can help me.
    E.g I place a block on a workbench, normally would pop up the windows. I can cancel this with Event.Result.Deny.
    But that cancels the sign related GUI for example, too.
    (If I place a sign on it)

    Any way to cancel only the first on?

    Greetings
     
  2. Offline

    CorrieKay

    what event are you listening for?
     
  3. Offline

    xGhOsTkiLLeRx

    CorrieKay
    PlayerInteractEvent since I'm checking for permissions.

    I already thought about listening to InventoryEvents?
     
  4. Offline

    CorrieKay

    try this,

    if(event.getClickedBlock().getType() == Material.WORKBENCH){
    //event deny
    }
     
  5. Offline

    xGhOsTkiLLeRx

    Nope.
    Would work for blocks, but the sign would be placed empty...
     
  6. Shift + right-clicking on the block allows you to place it without any GUI opening...
     
  7. Offline

    xGhOsTkiLLeRx

    What? Are you sure? Never heard of it and didn't worked in my SSP.
     
  8. Ah weird, it worked on Tekkit and Technic, so I thought it was a Vanilla feature aswell. Must be a mod then.
     
  9. The problem is that the sign GUI is never triggered because it triggers the workbench GUI... so you're not cancelling the sign GUI.

    I belive there's a way to manually display the sign GUI on a player (sign editing plugins' code ?), you should do that after you cancel the workbench GUI.
     
  10. Offline

    xGhOsTkiLLeRx

    Do you know exactly how I can open the inventory?
    I would need to get the inv from the sign and then player.openInventory(signINV)
     
  11. You want to click a sign and open a inventory ? That's another topic... but it's pretty streightforward: get the block the sign is attached to, check if it's chest or whatever and get it's inventory... but what do you mean signINV ? signs don't have inventories.
    Also, a workbench is not a inventory, it's just a interface, it doesn't store items... for that you have player.openWorkbench() I think.

    Also, if I knew how to do what I said in my previous post I would've already say it, but I directed you to look for sign editing plugins which do that.
     
  12. Offline

    xGhOsTkiLLeRx

    No.
    I want to open the screen to edit a sign.
    I guessed that would be an "inventory", too.
     
Thread Status:
Not open for further replies.

Share This Page