Fix OfflinePlayer name handling on Paper 1.20+ and improve Geyser/Floodgate compatibility#76
Merged
BenCodez merged 1 commit intoBenCodez:mainfrom Nov 25, 2025
Conversation
…odgate compatibility
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes several issues related to
OfflinePlayer#getName()on modernPaper versions (1.20.5+ / 1.21.x) and improves compatibility with
Geyser/Floodgate setups where some UUIDs do not have a cached name.
The main goals:
in
/plotand/vrplotcommands.nullfor members and owners.OfflinePlayer#getName()isnullor stale.Key Changes
1. New
PlayerLookupUtilAdded
com.modnmetl.virtualrealty.util.PlayerLookupUtilas a central,null-safe player name resolver:
Lookup order:
Player#getName()OfflinePlayer#getName()(if present)This is safe on Paper 1.20.5+ where usercache / OfflinePlayer behaviour changed,
and on Geyser/Floodgate networks where some UUIDs never get a "real" Bukkit name.
2. Command fixes (
/plotand/vrplot)Patched commands to use UUIDs +
PlayerLookupUtilinstead of relying onOfflinePlayer#getName()directly:CommandManagercommands/plot/subcommand/AddSubCommandcommands/plot/subcommand/KickSubCommandcommands/plot/subcommand/InfoSubCommandcommands/vrplot/subcommand/AssignSubCommandcommands/vrplot/subcommand/SetSubCommandcommands/vrplot/subcommand/InfoSubCommandHighlights:
/plot addworks for:/plot kickand tab-completion no longer throw errors when some membershave missing names.
/vrplot assignandset owneraccept either UUID or username andwill not fail if the
OfflinePlayerhas no name.3. GUI fixes (Panel system)
Updated the premium panel system to avoid
OfflinePlayer#getName()issues:listener/premium/PanelListenerutil/PanelUtilChanges:
PlayerLookupUtil.getBestName(...).a fallback string) so they do not break on Bedrock/Floodgate players.
PlayerLookupUtil,so there are no NPEs or
nullnames in chat or inventory titles.4. Plot entrance and gamemode handling
listener/PlotEntranceListenerupdated to be more defensive aroundplayer/plot lookups and game mode switching on Paper 1.20+.
Why this is needed
On Paper 1.20.5+ and 1.21.x, plus on Geyser/Floodgate networks, it is
increasingly common for
Bukkit.getOfflinePlayer(...)to return profileswith
getName() == null, especially when:VirtualRealty currently assumes
OfflinePlayer#getName()is always non-nullin many places, which leads to: