geforkt von Mirrors/Velocity
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() {
|
public void clearPlayerListHeaderAndFooter() {
|
||||||
clearPlayerListHeaderAndFooterSilent();
|
clearPlayerListHeaderAndFooterSilent();
|
||||||
if (this.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_8) >= 0) {
|
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 {
|
public class HeaderAndFooter implements MinecraftPacket {
|
||||||
|
|
||||||
private static final HeaderAndFooter RESET = new HeaderAndFooter();
|
|
||||||
|
|
||||||
private final ComponentHolder header;
|
private final ComponentHolder header;
|
||||||
private final ComponentHolder footer;
|
private final ComponentHolder footer;
|
||||||
|
|
||||||
public HeaderAndFooter() {
|
public HeaderAndFooter() {
|
||||||
this(ComponentHolder.EMPTY, ComponentHolder.EMPTY);
|
throw new UnsupportedOperationException("Decode is not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
public HeaderAndFooter(ComponentHolder header, ComponentHolder footer) {
|
public HeaderAndFooter(ComponentHolder header, ComponentHolder footer) {
|
||||||
@ -72,7 +70,8 @@ public class HeaderAndFooter implements MinecraftPacket {
|
|||||||
new ComponentHolder(protocolVersion, footer));
|
new ComponentHolder(protocolVersion, footer));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HeaderAndFooter reset() {
|
public static HeaderAndFooter reset(ProtocolVersion version) {
|
||||||
return RESET;
|
ComponentHolder empty = new ComponentHolder(version, Component.empty());
|
||||||
|
return new HeaderAndFooter(empty, empty);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -52,14 +52,8 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class ComponentHolder {
|
public class ComponentHolder {
|
||||||
public static ComponentHolder EMPTY = new ComponentHolder(null, Component.empty());
|
|
||||||
private static final Logger logger = LogManager.getLogger(ComponentHolder.class);
|
private static final Logger logger = LogManager.getLogger(ComponentHolder.class);
|
||||||
|
|
||||||
static {
|
|
||||||
EMPTY.json = "{\"text\":\"\"}";
|
|
||||||
EMPTY.binaryTag = StringBinaryTag.stringBinaryTag("");
|
|
||||||
}
|
|
||||||
|
|
||||||
private final ProtocolVersion version;
|
private final ProtocolVersion version;
|
||||||
private @MonotonicNonNull Component component;
|
private @MonotonicNonNull Component component;
|
||||||
private @MonotonicNonNull String json;
|
private @MonotonicNonNull String json;
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren