This site works best with JavaScript enabled. Please enable JavaScript to get the best experience from this site.
Plugin Version
ChestShop version 3.8.13-SNAPSHOT (build #12)
Server Version
CraftBukkit version git-Spigot-3fb9445-6e3cec8 (MC: 1.11.2)
What other plugins are you running?
Vault version 1.5.6-b49; Essentials version 2.0.1-b472
What is happening?
When a player is in adventure mode, left clicking on a shop sign doesn't sell nor buy, while right-click works like a charm.
What did you expect to happen?
I expected that the left-click would sell or buy, depending on the config option.
Please provide any additional info below
None.
Afaik this isn't really fixable as the server does not receive any info from a player in adventure mode that he left clicked as he can't destroy blocks. I would be happy to be proven wrong though.
Well, PlayerInteractEvent doesn't fire indeed, but I think I found a workaround:
@EventHandler public void onPlayerAnimation(PlayerAnimationEvent e) { Player p = e.getPlayer(); p.sendMessage(p.getGameMode() + ", " + p.getTargetBlock((Set<Material>) null, 5).getType()); }
Since the only animation for PlayerAnimationEvent is ARM_SWING, and it only fires on LEFT_CLICK, it should be rather reliable at the moment.
Glad to prove you wrong, though. ;)
While this is definitely an interesting approach we will run into the issue where even clicks not directly onto the sign (e.g. the block behind of a wall sign) will still trigger the selling as the line of sight intercepts with the block that the player is in. This could be really confusing for players and lead to some accidental sales.
I've added my attempt to a new adventuremode-workaround branch if you want to try to get it working yourself.
So I fixed the hitbox issue by adding my own bounding box interception check.
I'm noticing another issue now though: The PlayerAnimationEvent will get fired for right clicks on signs too. As far as I can tell there is no way to differentiate between a left click and a right click with that event so this whole approach isn't really a solution for the problem.
Related GitHub ticket.
To post a comment, please login or register a new account.