Skip to content

Commit

Permalink
fix(spigot): exception when render type of scoreboard objective is null
Browse files Browse the repository at this point in the history
  • Loading branch information
diogotcorreia committed Nov 27, 2024
1 parent 7f33bf7 commit 6857976
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,15 @@ private void handleScoreboardObjective(PacketEvent packet, SpigotLanguagePlayer
val chatComponentsModifier = packet.getPacket().getChatComponents();

val displayName = chatComponentsModifier.readSafely(0);
val renderType = packet.getPacket().getRenderTypes().readSafely(0);
EnumWrappers.RenderType renderType;
try {
renderType = packet.getPacket().getRenderTypes().readSafely(0);
} catch (IllegalArgumentException e) {
// When plugins also using ProtocolLib don't set this field, it will be null and ProtocolLib will
// fail to convert it to the enum value.
// Fallback to INTEGER since that's th default anyway.
renderType = EnumWrappers.RenderType.INTEGER;
}
WrappedNumberFormat numberFormat = null;
if (WrappedNumberFormat.isSupported()) {
if (MinecraftVersion.v1_20_5.atOrAbove()) {
Expand Down

0 comments on commit 6857976

Please sign in to comment.