Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-16 21:10:30 +01:00
Fix NPE in ComponentHolder
Dieser Commit ist enthalten in:
Ursprung
5b8bba4b29
Commit
8a6c20ee32
@ -543,7 +543,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player,
|
||||
public void clearPlayerListHeaderAndFooter() {
|
||||
clearPlayerListHeaderAndFooterSilent();
|
||||
if (this.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_8) >= 0) {
|
||||
this.connection.write(HeaderAndFooter.reset());
|
||||
this.connection.write(HeaderAndFooter.reset(this.getProtocolVersion()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,13 +28,11 @@ import net.kyori.adventure.text.Component;
|
||||
|
||||
public class HeaderAndFooter implements MinecraftPacket {
|
||||
|
||||
private static final HeaderAndFooter RESET = new HeaderAndFooter();
|
||||
|
||||
private final ComponentHolder header;
|
||||
private final ComponentHolder footer;
|
||||
|
||||
public HeaderAndFooter() {
|
||||
this(ComponentHolder.EMPTY, ComponentHolder.EMPTY);
|
||||
throw new UnsupportedOperationException("Decode is not implemented");
|
||||
}
|
||||
|
||||
public HeaderAndFooter(ComponentHolder header, ComponentHolder footer) {
|
||||
@ -72,7 +70,8 @@ public class HeaderAndFooter implements MinecraftPacket {
|
||||
new ComponentHolder(protocolVersion, footer));
|
||||
}
|
||||
|
||||
public static HeaderAndFooter reset() {
|
||||
return RESET;
|
||||
public static HeaderAndFooter reset(ProtocolVersion version) {
|
||||
ComponentHolder empty = new ComponentHolder(version, Component.empty());
|
||||
return new HeaderAndFooter(empty, empty);
|
||||
}
|
||||
}
|
@ -52,14 +52,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ComponentHolder {
|
||||
public static ComponentHolder EMPTY = new ComponentHolder(null, Component.empty());
|
||||
private static final Logger logger = LogManager.getLogger(ComponentHolder.class);
|
||||
|
||||
static {
|
||||
EMPTY.json = "{\"text\":\"\"}";
|
||||
EMPTY.binaryTag = StringBinaryTag.stringBinaryTag("");
|
||||
}
|
||||
|
||||
private final ProtocolVersion version;
|
||||
private @MonotonicNonNull Component component;
|
||||
private @MonotonicNonNull String json;
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren