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

Add support for AsyncChatEvent in Paper server #5908

Merged
merged 10 commits into from
Feb 22, 2025
Merged

Conversation

Mowstyl
Copy link
Contributor

@Mowstyl Mowstyl commented Aug 16, 2024

Information

This PR fixes #5243.

Details

Proposed fix:

Since the EssentialsDiscord plugin only listens to AsyncPlayerChatEvent, which
is called before calling AsyncChatEvent, any changes made to the message in the
latter event will be ignored by the plugin.
In order to fix it, I've added some classes to the PaperProvider and a new async
event which will be called each time an AsyncChatEvent is received.
The plugin checks if the AsyncChatEvent exists and registers the two listeners
needed instead of the bukkit one.

Environments tested:

OS: Ubuntu 24.04 LTS

Java version: Oracle GraalVM 21.0.3+7.1

  • Most recent Paper version (1.XX.Y, git-Paper-BUILD)
  • CraftBukkit/Spigot/Paper 1.12.2
  • CraftBukkit 1.8.8

Demonstration:

@mdcfe mdcfe self-requested a review August 16, 2024 21:41
@Mowstyl
Copy link
Contributor Author

Mowstyl commented Aug 17, 2024

I've found a little bug when receiving the AsyncChatEvent synchronously (I didn't know that was possible). I'm fixing it.

@Mowstyl
Copy link
Contributor Author

Mowstyl commented Aug 17, 2024

Fixed, it should work now.

@mdcfe mdcfe added this to the 2.21.1 milestone Sep 1, 2024
@mdcfe mdcfe added the module: discord Issues or PRs for the EssentialsDiscord module label Sep 15, 2024
@Mowstyl
Copy link
Contributor Author

Mowstyl commented Feb 13, 2025

Is there anything else I should do for this to get approved?
It requires nothing from the user and improves their experience when running Paper, fixing incompatibilities with other plugins.

@Mowstyl Mowstyl requested a review from Euphillya February 13, 2025 12:36
@JRoy
Copy link
Member

JRoy commented Feb 13, 2025

I will get to it I promise 😁

I'm waiting on #6033 before this one

@Mowstyl
Copy link
Contributor Author

Mowstyl commented Feb 14, 2025 via email

@mdcfe mdcfe modified the milestones: 2.21.1, 2.21.0 Feb 14, 2025
@novrom1982
Copy link

novrom1982 commented Feb 16, 2025

I don't know what you did there, but after the update I have an error in the chat after the Chat Game.

Could not pass event AsyncChatEvent to EssentialsChat v2.21.0-dev+169-69ed07a
java.lang.NullPointerException: null

What should I do now? Delete the game from the server?

Server Paper 1.21.4-152

@Mowstyl
Copy link
Contributor Author

Mowstyl commented Feb 18, 2025

Are you saying you are having an incompatibility problem between Chat Game and the code from this fork? Or with the latest EssentialsDiscord version? If it's with this fork, could you provide the logs?

@mbax
Copy link
Member

mbax commented Feb 18, 2025

Are you saying you are having an incompatibility problem between Chat Game and the code from this fork? Or with the latest EssentialsDiscord version? If it's with this fork, could you provide the logs?

#6051

@JRoy JRoy merged commit e3e247d into EssentialsX:2.x Feb 22, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: discord Issues or PRs for the EssentialsDiscord module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EssentialsX Discord doesn't support Paper chat events
6 participants