Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comitems player_chat event doesn't work properly with cancel-action #1209

Open
CatgirlChilis opened this issue Jun 20, 2020 · 1 comment
Open
Labels
status:pending Pending acceptance or closure. status:platform-issue An issue with the platform (eg Spigot), that we cannot workaround type:bug Incorrect behavior, not working as intended

Comments

@CatgirlChilis
Copy link

Versions
CraftBook version: 3.10.2-SNAPSHOT;4616-21180b0
Bukkit version: git-Spigot-a99063f-fad2494

Describe the bug
When using a command item with the PLAYER_CHAT event and cancel-action turned on, the message sent my the player is still visible in chat, though it is blocked from other plugins.
When using an comitem to send a /say @m command through the console, both the console message and player message are visible despite cancel-action being set to true.
The player message does not show up on my Discord server's linked Minecraft chat however, as intended

To Reproduce

  1. Create a command item with the PLAYER_CHAT event and cancel-action set to true
  2. Type something in chat, and notice how the players message is still sent

Expected behavior
Creating a console /say microphone for fun, and expect the chat message sent by the player to be blocked from sending by the cancel-action flag

Screenshots
use
use_discord

@CatgirlChilis CatgirlChilis added status:pending Pending acceptance or closure. type:bug Incorrect behavior, not working as intended labels Jun 20, 2020
@me4502
Copy link
Member

me4502 commented Jun 21, 2020

This is currently broken due to Spigot changes. Beforehand we'd use the non-async version of the event, as there are things that /require/ being run sync.

As Spigot broke that functionality (as outlined in #1208), this can no longer be run as a sync event. This means the code for this commanditem must be run in the next game tick in order to not cause Spigot to error.

One negative of doing this, however, is the event can no longer be cancelled. I looked at potentially moving /just/ the cancel logic into the async handler, but that won't work as it must run after some code that can only be run in sync code.

Basically, there is no way to fix this with the way Spigot currently works.

@me4502 me4502 added the status:platform-issue An issue with the platform (eg Spigot), that we cannot workaround label Jun 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:pending Pending acceptance or closure. status:platform-issue An issue with the platform (eg Spigot), that we cannot workaround type:bug Incorrect behavior, not working as intended
Projects
None yet
Development

No branches or pull requests

2 participants