diff --git a/src/main/java/me/rothes/protocolstringreplacer/packetlisteners/server/scoreboard/ScoreBoardObjective.java b/src/main/java/me/rothes/protocolstringreplacer/packetlisteners/server/scoreboard/ScoreBoardObjective.java index 4f2385c..ccb7371 100644 --- a/src/main/java/me/rothes/protocolstringreplacer/packetlisteners/server/scoreboard/ScoreBoardObjective.java +++ b/src/main/java/me/rothes/protocolstringreplacer/packetlisteners/server/scoreboard/ScoreBoardObjective.java @@ -8,6 +8,7 @@ import me.rothes.protocolstringreplacer.ProtocolStringReplacer; import me.rothes.protocolstringreplacer.api.user.PsrUser; import me.rothes.protocolstringreplacer.replacer.ListenType; +import org.jetbrains.annotations.NotNull; public class ScoreBoardObjective extends AbstractScoreBoardListener { @@ -15,7 +16,7 @@ public ScoreBoardObjective() { super(PacketType.Play.Server.SCOREBOARD_OBJECTIVE, ListenType.SCOREBOARD); } - protected void process(PacketEvent packetEvent) { + protected void process(@NotNull PacketEvent packetEvent) { PsrUser user = getEventUser(packetEvent); if (user == null) { return; @@ -23,7 +24,7 @@ protected void process(PacketEvent packetEvent) { PacketContainer packet = packetEvent.getPacket(); if (packet.getIntegers().read(0) != 1) { - if (ProtocolStringReplacer.getInstance().getServerMajorVersion() > 12) { + if (ProtocolStringReplacer.getInstance().getServerMajorVersion() >= 13) { StructureModifier wrappedChatComponentStructureModifier = packet.getChatComponents(); WrappedChatComponent wrappedChatComponent = wrappedChatComponentStructureModifier.read(0); String replaced = getReplacedJson(packetEvent, user, listenType, wrappedChatComponent.getJson(), titleFilter); @@ -32,9 +33,9 @@ protected void process(PacketEvent packetEvent) { } } else { StructureModifier strings = packet.getStrings(); - String replaced = getReplacedText(packetEvent, user, listenType, strings.read(0), titleFilter); + String replaced = getReplacedText(packetEvent, user, listenType, strings.read(1), titleFilter); if (replaced != null) - strings.write(0, replaced); + strings.write(1, replaced); } } }