Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-12-25 07:40:13 +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),
|
if (!Objects.equals(previousEntry.getDisplayNameComponent().orElse(null),
|
||||||
entry.getDisplayNameComponent().orElse(null))) {
|
entry.getDisplayNameComponent().orElse(null))) {
|
||||||
actions.add(UpsertPlayerInfo.Action.UPDATE_DISPLAY_NAME);
|
actions.add(UpsertPlayerInfo.Action.UPDATE_DISPLAY_NAME);
|
||||||
playerInfoEntry.setDisplayName(new ComponentHolder(player.getProtocolVersion(),
|
playerInfoEntry.setDisplayName(entry.getDisplayNameComponent().isEmpty()
|
||||||
entry.getDisplayNameComponent().get()));
|
?
|
||||||
|
null :
|
||||||
|
new ComponentHolder(player.getProtocolVersion(),
|
||||||
|
entry.getDisplayNameComponent().get())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (!Objects.equals(previousEntry.getLatency(), entry.getLatency())) {
|
if (!Objects.equals(previousEntry.getLatency(), entry.getLatency())) {
|
||||||
actions.add(UpsertPlayerInfo.Action.UPDATE_LATENCY);
|
actions.add(UpsertPlayerInfo.Action.UPDATE_LATENCY);
|
||||||
@ -140,8 +144,12 @@ public class VelocityTabList implements InternalTabList {
|
|||||||
playerInfoEntry.setProfile(entry.getProfile());
|
playerInfoEntry.setProfile(entry.getProfile());
|
||||||
if (entry.getDisplayNameComponent().isPresent()) {
|
if (entry.getDisplayNameComponent().isPresent()) {
|
||||||
actions.add(UpsertPlayerInfo.Action.UPDATE_DISPLAY_NAME);
|
actions.add(UpsertPlayerInfo.Action.UPDATE_DISPLAY_NAME);
|
||||||
playerInfoEntry.setDisplayName(new ComponentHolder(player.getProtocolVersion(),
|
playerInfoEntry.setDisplayName(entry.getDisplayNameComponent().isEmpty()
|
||||||
entry.getDisplayNameComponent().get()));
|
?
|
||||||
|
null :
|
||||||
|
new ComponentHolder(player.getProtocolVersion(),
|
||||||
|
entry.getDisplayNameComponent().get())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (entry.getChatSession() != null) {
|
if (entry.getChatSession() != null) {
|
||||||
actions.add(UpsertPlayerInfo.Action.INITIALIZE_CHAT);
|
actions.add(UpsertPlayerInfo.Action.INITIALIZE_CHAT);
|
||||||
|
@ -80,7 +80,11 @@ public class VelocityTabListEntry implements TabListEntry {
|
|||||||
this.displayName = displayName;
|
this.displayName = displayName;
|
||||||
UpsertPlayerInfo.Entry upsertEntry = this.tabList.createRawEntry(this);
|
UpsertPlayerInfo.Entry upsertEntry = this.tabList.createRawEntry(this);
|
||||||
upsertEntry.setDisplayName(
|
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);
|
this.tabList.emitActionRaw(UpsertPlayerInfo.Action.UPDATE_DISPLAY_NAME, upsertEntry);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren