[SPIGOT-4487] PlayerInteractEvent execution does not align with Javadocs description Created: 15/Nov/18 Updated: 17/Nov/18 Resolved: 17/Nov/18 |
|
Status: | Resolved |
Project: | Spigot |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Bug | Priority: | Minor |
Reporter: | Nuubles | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 0 |
Labels: | bug, event, playerinteractevent | ||
Environment: |
Latest spigot build (built with buildtools at 15.11.2018 minutes before creating this ticket) version description Jenkins Build 1953, buildtools version 75 Java 8 |
Attachments: |
![]() |
Version: | 1.13.2 |
Guidelines Read: | Yes |
Description |
As javadocs of the PlayerInteractEvent describe "This event will fire as canceled if the vanilla behavior is to do nothing (e.g interacting with air)", the description does not hold true. When clicking a side of a block with a flower etc., the event will be fired as uncancelled, thus leading to unwanted behavior. Video demonstrating the issue https://www.youtube.com/watch?v=565xW9wtpRA @EventHandler public void onPlayerInteract(PlayerInteractEvent event) { Bukkit.broadcastMessage("Cancelled: " + event.isCancelled()); } Minimal reproduction plugin attached. |
Comments |
Comment by md_5 [ 17/Nov/18 ] |
Javadoc updated |
Comment by Nuubles [ 16/Nov/18 ] |
>Pretty much impossible. Ah okay. (just to be sure I meant vanilla behaviour, excluding plugin behaviour) Thanks for the responses anyway! I'll take a look for other ways to make my code work You've done a great job with the Spigot and Spigot community and I'm very grateful for it! |
Comment by md_5 [ 16/Nov/18 ] |
>Any chance that a variable could be added to indicate if anything is done if that cannot be resolved from the isCancelled method? Sorry don’t understand. >Of course, better would be to set the cancelled to true if nothing caused by vanilla behaviour will happen at the end of code execution Pretty much impossible. |
Comment by Nuubles [ 16/Nov/18 ] |
Reply to md_5 Any chance that a variable could be added to indicate if anything is done if that cannot be resolved from the isCancelled method? Of course, better would be to set the cancelled to true if nothing caused by vanilla behaviour will happen at the end of code execution (sry my English)? I mean you can already check if the user clicked air from the event. |
Comment by md_5 [ 15/Nov/18 ] |
I suggest the doc be changed. |