[SPIGOT-1157] InventoryClickEvent isRightClick() always returns false while in creative. Created: 30/Aug/15  Updated: 18/Sep/15  Resolved: 18/Sep/15

Status: Closed
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Jos Roossien Assignee: Unassigned
Resolution: Invalid Votes: 1
Labels: Craftbukkit, bug, event
Environment:

Java 7
Windows 7
(tested on a local server on my PC)


Plugin: Spigot

 Description   

When right clicking while you're in creative the output of InventoryClickEvent is invalid.
As far as I can tell there is no way to detect if a player right clicked or not.

When executing the code below all of the values are exactly the same when you left and right click.
However, when you do it inside survival mode it works as intended.
I've also tried using InventoryCreativeEvent just in case but it has the same result.

@EventHandler
private void invClick(InventoryClickEvent event) {
        Bukkit.broadcastMessage("" + event.isRightClick()); /* false */
        Bukkit.broadcastMessage("" + event.getClick().isRightClick()); /* false */
        Bukkit.broadcastMessage(event.getClick().toString()); /* CREATIVE */
        Bukkit.broadcastMessage(event.getAction().toString()); /* PLACE_ALL */
}


 Comments   
Comment by Jos Roossien [ 31/Aug/15 ]

Ah that's a shame.
Thanks anyways.

Comment by Black Hole [ 31/Aug/15 ]

This is because it's actually an InventoryCreativeEvent, which is always using ClickType.CREATIVE.

The server don't have any information if the client had used right click:
http://wiki.vg/Protocol#Creative_Inventory_Action

Comment by SpigotMC [ 30/Aug/15 ]

Your build is not the latest and therefore may be the reason you are having this issue. Spigot is 2 version(s) behind. CraftBukkit is 3 version(s) behind. This message was automatically generated and is not guaranteed to be a solution to your issue.

Generated at Sat Dec 13 20:51:22 UTC 2025 using Jira 10.3.13#10030013-sha1:56dd970ae30ebfeda3a697d25be1f6388b68a422.