Skip to content

Fix Injector.getPlayer() using TemporaryPlayer when a Bukkit player is available#3614

Merged
dmulloy2 merged 1 commit into
dmulloy2:masterfrom
LeonTG:temporary-player-fix
Apr 25, 2026
Merged

Fix Injector.getPlayer() using TemporaryPlayer when a Bukkit player is available#3614
dmulloy2 merged 1 commit into
dmulloy2:masterfrom
LeonTG:temporary-player-fix

Conversation

@LeonTG

@LeonTG LeonTG commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

On my server I had a lot of issues where I was getting a temporary player for packets sent before PlayerJoinEvent, even tho Bukkit.getPlayerExact was returning the actual joined player

So I did some digging and I found out that even tho it returned the temporary player, playerName variable was set, and with more digging it turns out that even if a bukkit player is available, doing getPlayer on the injector would never check for Bukkit player if a temporary player was already assigned

so I decided to fix it myself, this is how I did it, and I figured I should make a PR for it, so others wont have this issue

@LeonTG

LeonTG commented Apr 13, 2026

Copy link
Copy Markdown
Contributor Author

For reference, this is what debugging I added

image

and it resulted in this

Found temporary player with name resolved... attempting to fix: kawaiibunri (Team: npcNameTag, Mode: 0, Class: com.comphenix.protocol.injector.temporary.TemporaryPlayerInvocationHandler)
Potential is: com.comphenix.protocol.injector.temporary.TemporaryPlayerInvocationHandler@55466d92
Temporary player is now: CraftPlayer{name=kawaiibunri} (Equal? false)

@dmulloy2 dmulloy2 enabled auto-merge (squash) April 25, 2026 23:06
@dmulloy2

Copy link
Copy Markdown
Owner

thank you!

@dmulloy2 dmulloy2 merged commit 9404ce3 into dmulloy2:master Apr 25, 2026
3 checks passed
@LeonTG LeonTG deleted the temporary-player-fix branch April 25, 2026 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants