Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-12-24 15:20:35 +01:00
Restore nullability for displayName in UpsertPlayerInfo (#1172)
This makes the UpsertPlayerInfo's displayName truly nullable as before the ComponentHolder was introduced.
Dieser Commit ist enthalten in:
Ursprung
6fd03d6f5c
Commit
00ef92bc5c
@ -110,8 +110,12 @@ public class VelocityTabList implements InternalTabList {
|
||||
if (!Objects.equals(previousEntry.getDisplayNameComponent().orElse(null),
|
||||
entry.getDisplayNameComponent().orElse(null))) {
|
||||
actions.add(UpsertPlayerInfo.Action.UPDATE_DISPLAY_NAME);
|
||||
playerInfoEntry.setDisplayName(new ComponentHolder(player.getProtocolVersion(),
|
||||
entry.getDisplayNameComponent().get()));
|
||||
playerInfoEntry.setDisplayName(entry.getDisplayNameComponent().isEmpty()
|
||||
?
|
||||
null :
|
||||
new ComponentHolder(player.getProtocolVersion(),
|
||||
entry.getDisplayNameComponent().get())
|
||||
);
|
||||
}
|
||||
if (!Objects.equals(previousEntry.getLatency(), entry.getLatency())) {
|
||||
actions.add(UpsertPlayerInfo.Action.UPDATE_LATENCY);
|
||||
@ -140,8 +144,12 @@ public class VelocityTabList implements InternalTabList {
|
||||
playerInfoEntry.setProfile(entry.getProfile());
|
||||
if (entry.getDisplayNameComponent().isPresent()) {
|
||||
actions.add(UpsertPlayerInfo.Action.UPDATE_DISPLAY_NAME);
|
||||
playerInfoEntry.setDisplayName(new ComponentHolder(player.getProtocolVersion(),
|
||||
entry.getDisplayNameComponent().get()));
|
||||
playerInfoEntry.setDisplayName(entry.getDisplayNameComponent().isEmpty()
|
||||
?
|
||||
null :
|
||||
new ComponentHolder(player.getProtocolVersion(),
|
||||
entry.getDisplayNameComponent().get())
|
||||
);
|
||||
}
|
||||
if (entry.getChatSession() != null) {
|
||||
actions.add(UpsertPlayerInfo.Action.INITIALIZE_CHAT);
|
||||
|
@ -80,7 +80,11 @@ public class VelocityTabListEntry implements TabListEntry {
|
||||
this.displayName = displayName;
|
||||
UpsertPlayerInfo.Entry upsertEntry = this.tabList.createRawEntry(this);
|
||||
upsertEntry.setDisplayName(
|
||||
new ComponentHolder(this.tabList.getPlayer().getProtocolVersion(), displayName));
|
||||
displayName == null
|
||||
?
|
||||
null :
|
||||
new ComponentHolder(this.tabList.getPlayer().getProtocolVersion(), displayName)
|
||||
);
|
||||
this.tabList.emitActionRaw(UpsertPlayerInfo.Action.UPDATE_DISPLAY_NAME, upsertEntry);
|
||||
return this;
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren