Skip to content

Commit

Permalink
Improved lower version compatability
Browse files Browse the repository at this point in the history
  • Loading branch information
DustinRepo committed Apr 10, 2022
1 parent 317ff48 commit 2cdf60a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion java/src/me/dustin/chatbot/network/ClientConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public void tick() {
while (isConnected()) {
try {
getProcessManager().tick();
} catch (ConcurrentModificationException e) {}
} catch (Exception e) {}
getClientPlayer().tick();
new EventTick().run(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ public int getPacketId(NetworkSide networkSide, String... names) {
}
}
}
GeneralHelper.print(networkSide.name() + " " + "Could not find packet with names " + Arrays.toString(names), ChatMessage.TextColor.RED);
return -1;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public void createPacket(PacketByteBuf packetByteBuf) throws IOException {
if (ProtocolHandler.getCurrent().getProtocolVer() <= ProtocolHandler.getVersionFromName("1.12.2").getProtocolVer()) {
packetByteBuf.writeString(cmd);//text
packetByteBuf.writeBoolean(false);//assume command - used for cmd blocks
packetByteBuf.writeBoolean(false);//has position
if (ProtocolHandler.getCurrent().getProtocolVer() > ProtocolHandler.getVersionFromName("1.8.9").getProtocolVer())
packetByteBuf.writeBoolean(false);//has position
} else {
packetByteBuf.writeVarInt(transactionId);
packetByteBuf.writeString(cmd);
Expand Down
5 changes: 5 additions & 0 deletions java/src/me/dustin/chatbot/process/impl/SkinBlinkProcess.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import me.dustin.chatbot.ChatBot;
import me.dustin.chatbot.helper.StopWatch;
import me.dustin.chatbot.network.ClientConnection;
import me.dustin.chatbot.network.packet.ProtocolHandler;
import me.dustin.chatbot.network.packet.c2s.play.ServerBoundClientSettingsPacket;
import me.dustin.chatbot.process.ChatBotProcess;

Expand All @@ -16,6 +17,8 @@ public SkinBlinkProcess(ClientConnection clientConnection) {

@Override
public void init() {
if (ProtocolHandler.getCurrent().getProtocolVer() <= ProtocolHandler.getVersionFromName("1.8.9").getProtocolVer())
return;
getClientConnection().getEventManager().register(this);
}

Expand All @@ -35,6 +38,8 @@ public void tick() {

@Override
public void stop() {
if (ProtocolHandler.getCurrent().getProtocolVer() <= ProtocolHandler.getVersionFromName("1.8.9").getProtocolVer())
return;
getClientConnection().getEventManager().unregister(this);
}
}

0 comments on commit 2cdf60a

Please sign in to comment.