Skip to content

Commit

Permalink
bruh
Browse files Browse the repository at this point in the history
  • Loading branch information
MATRIX-feather committed Dec 13, 2023
1 parent 6bd9a9b commit cf05071
Showing 1 changed file with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,9 @@ private void scheduleRefreshPlayerDisplay(Player player, String disguiseName)
if (registryParameters != null)
{
logger.info("Triggering refresh!");
refreshStateForPlayer(player,
new DisplayParameters(outcomingProfile, disguiseName, registryParameters.bukkitType(), registryParameters.singleWatcher()));
GameProfile finalOutcomingProfile = outcomingProfile;
this.addSchedule(() -> refreshStateForPlayer(player,
new DisplayParameters(finalOutcomingProfile, disguiseName, registryParameters.bukkitType(), registryParameters.singleWatcher())));
}

return null;
Expand Down Expand Up @@ -287,19 +288,21 @@ private void refreshStateForPlayer(@Nullable Player player, @NotNull DisplayPara
//然后发包创建实体
//确保gameProfile非空
//如果没有profile,那么随机一个并计划刷新
if (displayType == org.bukkit.entity.EntityType.PLAYER)
if (displayType == org.bukkit.entity.EntityType.PLAYER && gameProfile == null)
{
if (gameProfile == null)
var targetPlayer = Bukkit.getPlayerExact(parameters.playerDisguiseName());

var cachedProfile = targetPlayer == null
? PlayerSkinProvider.getInstance().getCachedProfile(parameters.playerDisguiseName())
: NmsRecord.ofPlayer(targetPlayer).gameProfile;

if (cachedProfile == null)
{
var cachedProfile = PlayerSkinProvider.getInstance().getCachedProfile(parameters.playerDisguiseName());
if (cachedProfile == null)
{
scheduleRefreshPlayerDisplay(player, parameters.playerDisguiseName());
gameProfile = new GameProfile(Util.NIL_UUID, parameters.playerDisguiseName());
}
else
gameProfile = cachedProfile;
scheduleRefreshPlayerDisplay(player, parameters.playerDisguiseName());
gameProfile = new GameProfile(Util.NIL_UUID, parameters.playerDisguiseName());
}
else
gameProfile = cachedProfile;
}

var parametersFinal = new DisplayParameters(gameProfile, parameters.playerDisguiseName(), parameters.bukkitType(), parameters.watcher());
Expand Down

0 comments on commit cf05071

Please sign in to comment.