Skip to content

Connection messages to discord - #9

Merged
srnyx merged 14 commits into
mainfrom
connection-messages-to-discord
Jun 3, 2026
Merged

Connection messages to discord#9
srnyx merged 14 commits into
mainfrom
connection-messages-to-discord

Conversation

@srnyx

@srnyx srnyx commented Jun 1, 2026

Copy link
Copy Markdown
Member

@srnyx srnyx added the enhancement New feature or request label Jun 1, 2026
srnyx added 5 commits June 1, 2026 00:09
org.jetbrains.gradle.plugin.idea-ext: 1.3 -> 1.4.1
Annoying API: e35bfdb -> db46b2b
JEmoji: 1.7.6 -> 2.0.0
So that main class isn't flooded
@srnyx
srnyx marked this pull request as ready for review June 2, 2026 04:47
Copilot AI review requested due to automatic review settings June 2, 2026 04:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Minecraft → Discord player join/quit syncing via a new WebSocket endpoint, restructures the config under a unified syncing section (with both Discord→Minecraft messages and Minecraft→Discord connections), and refactors the socket/object layer (record-based IpPort, reflective EAObject.toJson(), renamed handleonMessage, extracted IDMappings, shared Heads).

Changes:

  • New PlayerConnection object + PlayerConnectionClient socket; PlayerListener (renamed from JoinListener) sends JOIN/QUIT to Discord.
  • Config restructured to syncing.discord-to-minecraft.messages and syncing.minecraft-to-discord.connections, with corresponding SyncingGui / MessagesGui and ChatListener input handling.
  • EAObject now exposes a generic reflective toJson() and toString() instead of holding the raw JsonObject; SocketClient adds a typed send(T) and abstract onMessage default; IpPort becomes a record; IDMappings and head textures moved to dedicated classes.

Reviewed changes

Copilot reviewed 44 out of 45 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/main/resources/config.yml New syncing config layout replacing discord-message-syncing.
EventAlertsIntegration.java Adds shared GSON; removes inline ID mappings.
IDMappings.java New file containing the ID→name map.
config/ConfigYml.java Adds Syncing / DiscordToMinecraft.Messages / MinecraftToDiscord sections with reconnect hooks.
objects/EAObject.java Replaces stored json with reflective toJson()/toString().
objects/PlayerConnection.java New outbound payload object (uuid/username/timestamp/type).
objects/{Server,Event,EventThreadMessage,EAPlayer,FamousEvent,CrossBan}.java Drop super(json) since EAObject no longer stores it.
socket/SocketClient.java Adds send(T), uses CloseFrame constants, renames handleonMessage, gates stack traces on logs.
socket/SocketEndpoint.java Adds PLAYER_CONNECTION endpoint.
socket/WebSockets.java Exposes clients map publicly for listener use.
socket/clients/PlayerConnectionClient.java New client for the player-connection endpoint.
socket/clients/{EventChat,EventPosted,FamousEventPosted,Link,CrossBan}Client.java Rename handleonMessage; updated config paths and IDMappings reference.
listeners/PlayerListener.java Renamed from JoinListener; adds JOIN/QUIT handlers using PlayerLoginEvent/PlayerQuitEvent.
listeners/ChatListener.java New input branch for the messages format and shared reopenGui helper.
utility/EAStringUtility.java Converts IpPort to a record; tightens JEmoji loading.
utility/EventMessageUtility.java Updates to record accessors for IpPort.
gui/EAGui.java, gui/Heads.java Move textures to Heads; rename uninitializeunitalicize.
gui/config/ConfigGui.java + others Wire up new SyncingGui/MessagesGui and rename method calls.
gui/config/syncing/{SyncingGui,discordtominecraft/MessagesGui}.java New GUIs for the syncing config tree.
build.gradle.kts Bumps annoyingAPI to a commit hash, jEmoji to 2.0.0, bson to 5.7.0, idea-ext plugin.
Comments suppressed due to low confidence (1)

src/main/java/gg/eventalerts/eventalertsintegration/listeners/PlayerListener.java:58

  • Using PlayerLoginEvent to send the JOIN message has two issues:
  1. PlayerLoginEvent fires during the login/auth stage, before the player has actually entered the world. The connection can still fail or be denied after this event (e.g., by other MONITOR-priority handlers calling event.setResult(...), or by client-side disconnects between login and play). When that happens, a spurious JOIN will be sent to Discord with no matching QUIT. The conventional event for "player joined" is PlayerJoinEvent, which only fires once the player is actually in the world.

  2. ignoreCancelled = true has no effect here because PlayerLoginEvent is not Cancellable — it uses Result instead. The flag is misleading and can be removed.

Consider switching onPlayerJoin to listen on PlayerJoinEvent (and dropping ignoreCancelled).


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main/java/gg/eventalerts/eventalertsintegration/objects/PlayerConnection.java Outdated
Comment thread src/main/java/gg/eventalerts/eventalertsintegration/objects/EAObject.java Outdated
@srnyx
srnyx merged commit 8359335 into main Jun 3, 2026
1 check passed
@srnyx
srnyx deleted the connection-messages-to-discord branch June 3, 2026 04:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants