MrKinau / FishingBot

1.8 - 1.20.6 Fishing bot for Minecraft
GNU General Public License v3.0
322 stars 68 forks source link

Chat Signing for 1.19.3 & 1.19.4 #187

Closed nutjob4life closed 1 year ago

nutjob4life commented 1 year ago

Greetings! We'd love support for 1.19.3 please. Request coming from a Patreon patron—if that carries any weight 😄

MrKinau commented 1 year ago

I'll finish up the current progress at the 1.19.3 branch and release it as a pre-release (maybe a full release if I am dedicated enough to figure out what Mojang did with the chat signing again :D)

nutjob4life commented 1 year ago

Woot! Fantastic 🥳

nutjob4life commented 1 year ago

Testing with FishingBot-2.10.4.jar pre-release:

mirasol 352 % java -jar FishingBot-2.10.4.jar
[2023-01-02 20:06:51] [INFO   ] Using FishingBot v2.10.4 
[2023-01-02 20:06:51] [INFO   ] Using language: ENGLISH @ /lang/fb_en.properties 
Jan 02, 2023 8:06:51 PM com.sun.javafx.application.PlatformImpl startup
WARNING: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @1796cf6c'
[2023-01-02 20:07:05] [INFO   ] Configuration was loaded: /Users/kelly/Box%20Sync/Development/Minecraft/auto-fishing/config.json 
[2023-01-02 20:07:05] [INFO   ] Trying to authenciate at Microsoft... 
[2023-01-02 20:07:05] [INFO   ] Found refreshToken at /Users/kelly/Box%20Sync/Development/Minecraft/auto-fishing/refreshToken 
[2023-01-02 20:07:05] [INFO   ] Trying to refresh access token... 
[2023-01-02 20:07:06] [INFO   ] Access token successfully refreshed 
[2023-01-02 20:07:07] [INFO   ] Username: [REDACTED]
[2023-01-02 20:07:08] [INFO   ] The terms of service for realms have been accepted! 
[2023-01-02 20:07:08] [INFO   ] Connecting to realm {"address":"20.166.8.66:30136","resourcePackHash":null,"resourcePackUrl":null}... 
[2023-01-02 20:07:08] [INFO   ] Pinging 20.166.8.66:30136 with protocol of MC-1.19.3 
[2023-01-02 20:07:08] [SEVERE ] The server 20.166.8.66 is not reachable with the Minecraft version. The automatic version detection may not work. Please set a default-protocol in the Settings. 
[2023-01-02 20:07:08] [INFO   ] Obtained the required keys for chat signing! 
[2023-01-02 20:07:08] [INFO   ] Module "HandshakeModule" enabled! 
[2023-01-02 20:07:08] [INFO   ] Module "LoginModule" enabled! 
[2023-01-02 20:07:08] [INFO   ] Module "ClientDefaultsModule" enabled! 
[2023-01-02 20:07:08] [INFO   ] Module "FishingModule" enabled! 
[2023-01-02 20:07:08] [INFO   ] Module "ChatProxyModule" enabled! 
[2023-01-02 20:07:08] [INFO   ] Module "ChatCommandModule" enabled! 
[2023-01-02 20:07:08] [INFO   ] Module "EjectionModule" enabled! 
[2023-01-02 20:07:09] [INFO   ] Login successful! 
[2023-01-02 20:07:09] [INFO   ] Name: [REDACTED] 
[2023-01-02 20:07:09] [INFO   ] UUID: [REDACTED] 
[2023-01-02 20:07:09] [INFO   ] java.lang.IllegalStateException: java.io.EOFException 
[2023-01-02 20:07:09] [INFO   ]     at com.google.common.io.ByteStreams$ByteArrayDataInputStream.readByte(ByteStreams.java:301) 
[2023-01-02 20:07:09] [INFO   ]     at systems.kinau.fishingbot.network.utils.ByteArrayDataInputWrapper.readByte(ByteArrayDataInputWrapper.java:74) 
[2023-01-02 20:07:09] [INFO   ]     at systems.kinau.fishingbot.network.protocol.Packet.readVarInt(Packet.java:67) 
[2023-01-02 20:07:09] [INFO   ]     at systems.kinau.fishingbot.network.protocol.Packet.readVarInt(Packet.java:59) 
[2023-01-02 20:07:09] [INFO   ]     at systems.kinau.fishingbot.network.protocol.play.PacketInPlayerListItem.read(PacketInPlayerListItem.java:90) 
[2023-01-02 20:07:09] [INFO   ]     at systems.kinau.fishingbot.network.protocol.NetworkHandler.readPacket(NetworkHandler.java:838) 
[2023-01-02 20:07:09] [INFO   ]     at systems.kinau.fishingbot.network.protocol.NetworkHandler.readCompressed(NetworkHandler.java:803) 
[2023-01-02 20:07:09] [INFO   ]     at systems.kinau.fishingbot.network.protocol.NetworkHandler.readData(NetworkHandler.java:760) 
[2023-01-02 20:07:10] [INFO   ]     at systems.kinau.fishingbot.Bot.connect(Bot.java:407) 
[2023-01-02 20:07:10] [INFO   ]     at systems.kinau.fishingbot.Bot.start(Bot.java:281) 
[2023-01-02 20:07:10] [INFO   ]     at systems.kinau.fishingbot.FishingBot.startBot(FishingBot.java:97) 
[2023-01-02 20:07:10] [INFO   ]     at systems.kinau.fishingbot.gui.GUIController.lambda$startStop$3(GUIController.java:210) 
[2023-01-02 20:07:10] [INFO   ]     at java.base/java.lang.Thread.run(Thread.java:833) 
[2023-01-02 20:07:10] [INFO   ] Caused by: java.io.EOFException 
[2023-01-02 20:07:10] [INFO   ]     at java.base/java.io.DataInputStream.readByte(DataInputStream.java:273) 
[2023-01-02 20:07:10] [INFO   ]     at com.google.common.io.ByteStreams$ByteArrayDataInputStream.readByte(ByteStreams.java:299) 
[2023-01-02 20:07:10] [INFO   ]     ... 12 more 
[2023-01-02 20:07:10] [WARNING] Could not receive packet! Shutting down... 
[2023-01-02 20:07:10] [INFO   ] Module "LoginModule" disabled! 
[2023-01-02 20:07:10] [INFO   ] Module "ClientDefaultsModule" disabled! 
[2023-01-02 20:07:10] [INFO   ] Module "FishingModule" disabled! 
[2023-01-02 20:07:10] [INFO   ] Module "ChatProxyModule" disabled! 
[2023-01-02 20:07:10] [INFO   ] Module "ChatCommandModule" disabled! 
[2023-01-02 20:07:10] [INFO   ] Module "EjectionModule" disabled! 
[2023-01-02 20:07:10] [INFO   ] FishingBot will reconnect in 5 seconds... 
Exception in thread "Thread-8" [2023-01-02 20:07:11] [INFO   ] java.lang.NullPointerException: Cannot invoke "systems.kinau.fishingbot.bot.Player.getHeldItem()" because the return value of "systems.kinau.fishingbot.Bot.getPlayer()" is null 
[2023-01-02 20:07:11] [INFO   ]     at systems.kinau.fishingbot.modules.fishing.FishingModule.lambda$onSetDifficulty$7(FishingModule.java:293) 
[2023-01-02 20:07:11] [INFO   ]     at java.base/java.lang.Thread.run(Thread.java:833) 
Exception in thread "Thread-7" [2023-01-02 20:07:11] [INFO   ] java.util.concurrent.RejectedExecutionException: Task systems.kinau.fishingbot.Bot$$Lambda$1150/0x000000016f8b7338@716d9b16 rejected from java.util.concurrent.ThreadPoolExecutor@5e0842cd[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0] 
[2023-01-02 20:07:11] [INFO   ]     at java.base/java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2065) 
[2023-01-02 20:07:11] [INFO   ]     at java.base/java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:833) 
[2023-01-02 20:07:11] [INFO   ]     at java.base/java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1365) 
[2023-01-02 20:07:11] [INFO   ]     at java.base/java.util.concurrent.Executors$DelegatedExecutorService.execute(Executors.java:721) 
[2023-01-02 20:07:11] [INFO   ]     at systems.kinau.fishingbot.Bot.runCommand(Bot.java:285) 
[2023-01-02 20:07:11] [INFO   ]     at systems.kinau.fishingbot.modules.ClientDefaultsModule.lambda$onSetDifficulty$0(ClientDefaultsModule.java:63) 
[2023-01-02 20:07:11] [INFO   ]     at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) 
[2023-01-02 20:07:11] [INFO   ]     at systems.kinau.fishingbot.modules.ClientDefaultsModule.lambda$onSetDifficulty$1(ClientDefaultsModule.java:62) 
[2023-01-02 20:07:11] [INFO   ]     at java.base/java.lang.Thread.run(Thread.java:833) 
[2023-01-02 20:07:15] [INFO   ] Module "HandshakeModule" enabled! 
[2023-01-02 20:07:15] [INFO   ] Module "LoginModule" enabled! 
[2023-01-02 20:07:15] [INFO   ] Module "ClientDefaultsModule" enabled! 
[2023-01-02 20:07:15] [INFO   ] Module "FishingModule" enabled! 
[2023-01-02 20:07:15] [INFO   ] Module "ChatProxyModule" enabled! 
[2023-01-02 20:07:15] [INFO   ] Module "ChatCommandModule" enabled! 
[2023-01-02 20:07:15] [INFO   ] Module "EjectionModule" enabled! 
[2023-01-02 20:07:16] [INFO   ] Login successful! 
[2023-01-02 20:07:16] [INFO   ] Name: [REDACTED] 
[2023-01-02 20:07:16] [INFO   ] UUID: [REDACTED] 
[2023-01-02 20:07:16] [INFO   ] java.lang.IllegalStateException: java.io.EOFException 
[2023-01-02 20:07:16] [INFO   ]     at com.google.common.io.ByteStreams$ByteArrayDataInputStream.readByte(ByteStreams.java:301) 
[2023-01-02 20:07:16] [INFO   ]     at systems.kinau.fishingbot.network.utils.ByteArrayDataInputWrapper.readByte(ByteArrayDataInputWrapper.java:74) 
[2023-01-02 20:07:16] [INFO   ]     at systems.kinau.fishingbot.network.protocol.Packet.readVarInt(Packet.java:67) 
[2023-01-02 20:07:16] [INFO   ]     at systems.kinau.fishingbot.network.protocol.Packet.readVarInt(Packet.java:59) 
[2023-01-02 20:07:16] [INFO   ]     at systems.kinau.fishingbot.network.protocol.play.PacketInPlayerListItem.read(PacketInPlayerListItem.java:90) 
[2023-01-02 20:07:16] [INFO   ]     at systems.kinau.fishingbot.network.protocol.NetworkHandler.readPacket(NetworkHandler.java:838) 
[2023-01-02 20:07:16] [INFO   ]     at systems.kinau.fishingbot.network.protocol.NetworkHandler.readCompressed(NetworkHandler.java:803) 
[2023-01-02 20:07:16] [INFO   ]     at systems.kinau.fishingbot.network.protocol.NetworkHandler.readData(NetworkHandler.java:760) 
[2023-01-02 20:07:16] [INFO   ]     at systems.kinau.fishingbot.Bot.connect(Bot.java:407) 
[2023-01-02 20:07:16] [INFO   ]     at systems.kinau.fishingbot.Bot.start(Bot.java:281) 
[2023-01-02 20:07:16] [INFO   ]     at systems.kinau.fishingbot.FishingBot.startBot(FishingBot.java:97) 
[2023-01-02 20:07:16] [INFO   ]     at systems.kinau.fishingbot.gui.GUIController.lambda$startStop$3(GUIController.java:210) 
[2023-01-02 20:07:16] [INFO   ]     at java.base/java.lang.Thread.run(Thread.java:833) 
[2023-01-02 20:07:16] [INFO   ] Caused by: java.io.EOFException 
[2023-01-02 20:07:16] [INFO   ]     at java.base/java.io.DataInputStream.readByte(DataInputStream.java:273) 
[2023-01-02 20:07:16] [INFO   ]     at com.google.common.io.ByteStreams$ByteArrayDataInputStream.readByte(ByteStreams.java:299) 
[2023-01-02 20:07:16] [INFO   ]     ... 12 more 
[2023-01-02 20:07:16] [WARNING] Could not receive packet! Shutting down... 
[2023-01-02 20:07:16] [INFO   ] Module "LoginModule" disabled! 
[2023-01-02 20:07:16] [INFO   ] Module "ClientDefaultsModule" disabled! 
[2023-01-02 20:07:16] [INFO   ] Module "FishingModule" disabled! 
[2023-01-02 20:07:16] [INFO   ] Module "ChatProxyModule" disabled! 
[2023-01-02 20:07:16] [INFO   ] Module "ChatCommandModule" disabled! 
[2023-01-02 20:07:16] [INFO   ] Module "EjectionModule" disabled! 
[2023-01-02 20:07:16] [INFO   ] FishingBot will reconnect in 5 seconds... 
Exception in thread "Thread-13" Exception in thread "Thread-12" [2023-01-02 20:07:17] [INFO   ] java.lang.NullPointerException: Cannot invoke "systems.kinau.fishingbot.bot.Player.getHeldItem()" because the return value of "systems.kinau.fishingbot.Bot.getPlayer()" is null 
[2023-01-02 20:07:17] [INFO   ]     at systems.kinau.fishingbot.modules.fishing.FishingModule.lambda$onSetDifficulty$7(FishingModule.java:293) 
[2023-01-02 20:07:17] [INFO   ]     at java.base/java.lang.Thread.run(Thread.java:833) 
[2023-01-02 20:07:17] [INFO   ] java.util.concurrent.RejectedExecutionException: Task systems.kinau.fishingbot.Bot$$Lambda$1150/0x000000016f8b7338@43fe8612 rejected from java.util.concurrent.ThreadPoolExecutor@4d39601d[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0] 
[2023-01-02 20:07:17] [INFO   ]     at java.base/java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2065) 
[2023-01-02 20:07:17] [INFO   ]     at java.base/java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:833) 
[2023-01-02 20:07:17] [INFO   ]     at java.base/java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1365) 
[2023-01-02 20:07:17] [INFO   ]     at java.base/java.util.concurrent.Executors$DelegatedExecutorService.execute(Executors.java:721) 
[2023-01-02 20:07:17] [INFO   ]     at systems.kinau.fishingbot.Bot.runCommand(Bot.java:285) 
[2023-01-02 20:07:17] [INFO   ]     at systems.kinau.fishingbot.modules.ClientDefaultsModule.lambda$onSetDifficulty$0(ClientDefaultsModule.java:63) 
[2023-01-02 20:07:17] [INFO   ]     at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) 
[2023-01-02 20:07:17] [INFO   ]     at systems.kinau.fishingbot.modules.ClientDefaultsModule.lambda$onSetDifficulty$1(ClientDefaultsModule.java:62) 
[2023-01-02 20:07:17] [INFO   ]     at java.base/java.lang.Thread.run(Thread.java:833) 
[2023-01-02 20:07:21] [INFO   ] Module "HandshakeModule" enabled! 
[2023-01-02 20:07:21] [INFO   ] Module "LoginModule" enabled! 
[2023-01-02 20:07:21] [INFO   ] Module "ClientDefaultsModule" enabled! 
[2023-01-02 20:07:21] [INFO   ] Module "FishingModule" enabled! 
[2023-01-02 20:07:21] [INFO   ] Module "ChatProxyModule" enabled! 
[2023-01-02 20:07:21] [INFO   ] Module "ChatCommandModule" enabled! 
[2023-01-02 20:07:21] [INFO   ] Module "EjectionModule" enabled! 
[2023-01-02 20:07:22] [INFO   ] Login successful! 
[2023-01-02 20:07:22] [INFO   ] Name: [REDACTED] 
[2023-01-02 20:07:22] [INFO   ] UUID: [REDACTED] 
[2023-01-02 20:07:22] [INFO   ] java.lang.IllegalStateException: java.io.EOFException 
[2023-01-02 20:07:22] [INFO   ]     at com.google.common.io.ByteStreams$ByteArrayDataInputStream.readByte(ByteStreams.java:301) 
[2023-01-02 20:07:22] [INFO   ]     at systems.kinau.fishingbot.network.utils.ByteArrayDataInputWrapper.readByte(ByteArrayDataInputWrapper.java:74) 
[2023-01-02 20:07:22] [INFO   ]     at systems.kinau.fishingbot.network.protocol.Packet.readVarInt(Packet.java:67) 
[2023-01-02 20:07:22] [INFO   ]     at systems.kinau.fishingbot.network.protocol.Packet.readVarInt(Packet.java:59) 
[2023-01-02 20:07:22] [INFO   ]     at systems.kinau.fishingbot.network.protocol.play.PacketInPlayerListItem.read(PacketInPlayerListItem.java:90) 
[2023-01-02 20:07:22] [INFO   ]     at systems.kinau.fishingbot.network.protocol.NetworkHandler.readPacket(NetworkHandler.java:838) 
[2023-01-02 20:07:22] [INFO   ]     at systems.kinau.fishingbot.network.protocol.NetworkHandler.readCompressed(NetworkHandler.java:803) 
[2023-01-02 20:07:22] [INFO   ]     at systems.kinau.fishingbot.network.protocol.NetworkHandler.readData(NetworkHandler.java:760) 
[2023-01-02 20:07:22] [INFO   ]     at systems.kinau.fishingbot.Bot.connect(Bot.java:407) 
[2023-01-02 20:07:22] [INFO   ]     at systems.kinau.fishingbot.Bot.start(Bot.java:281) 
[2023-01-02 20:07:22] [INFO   ]     at systems.kinau.fishingbot.FishingBot.startBot(FishingBot.java:97) 
[2023-01-02 20:07:22] [INFO   ]     at systems.kinau.fishingbot.gui.GUIController.lambda$startStop$3(GUIController.java:210) 
[2023-01-02 20:07:22] [INFO   ]     at java.base/java.lang.Thread.run(Thread.java:833) 
[2023-01-02 20:07:22] [INFO   ] Caused by: java.io.EOFException 
[2023-01-02 20:07:22] [INFO   ]     at java.base/java.io.DataInputStream.readByte(DataInputStream.java:273) 
[2023-01-02 20:07:22] [INFO   ]     at com.google.common.io.ByteStreams$ByteArrayDataInputStream.readByte(ByteStreams.java:299) 
[2023-01-02 20:07:22] [INFO   ]     ... 12 more 
[2023-01-02 20:07:22] [WARNING] Could not receive packet! Shutting down... 
[2023-01-02 20:07:22] [INFO   ] Module "LoginModule" disabled! 
[2023-01-02 20:07:22] [INFO   ] Module "ClientDefaultsModule" disabled! 
[2023-01-02 20:07:22] [INFO   ] Module "FishingModule" disabled! 
[2023-01-02 20:07:22] [INFO   ] Module "ChatProxyModule" disabled! 
[2023-01-02 20:07:22] [INFO   ] Module "ChatCommandModule" disabled! 
[2023-01-02 20:07:22] [INFO   ] Module "EjectionModule" disabled! 
[2023-01-02 20:07:22] [INFO   ] FishingBot will reconnect in 5 seconds... 
Exception in thread "Thread-18" Exception in thread "Thread-17" [2023-01-02 20:07:23] [INFO   ] java.lang.NullPointerException: Cannot invoke "systems.kinau.fishingbot.bot.Player.getHeldItem()" because the return value of "systems.kinau.fishingbot.Bot.getPlayer()" is null 
[2023-01-02 20:07:23] [INFO   ]     at systems.kinau.fishingbot.modules.fishing.FishingModule.lambda$onSetDifficulty$7(FishingModule.java:293) 
[2023-01-02 20:07:23] [INFO   ]     at java.base/java.lang.Thread.run(Thread.java:833) 
[2023-01-02 20:07:23] [INFO   ] java.util.concurrent.RejectedExecutionException: Task systems.kinau.fishingbot.Bot$$Lambda$1150/0x000000016f8b7338@11dbe4a7 rejected from java.util.concurrent.ThreadPoolExecutor@1f1c18ec[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0] 
[2023-01-02 20:07:23] [INFO   ]     at java.base/java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2065) 
[2023-01-02 20:07:23] [INFO   ]     at java.base/java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:833) 
[2023-01-02 20:07:23] [INFO   ]     at java.base/java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1365) 
[2023-01-02 20:07:23] [INFO   ]     at java.base/java.util.concurrent.Executors$DelegatedExecutorService.execute(Executors.java:721) 
[2023-01-02 20:07:23] [INFO   ]     at systems.kinau.fishingbot.Bot.runCommand(Bot.java:285) 
[2023-01-02 20:07:23] [INFO   ]     at systems.kinau.fishingbot.modules.ClientDefaultsModule.lambda$onSetDifficulty$0(ClientDefaultsModule.java:63) 
[2023-01-02 20:07:23] [INFO   ]     at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) 
[2023-01-02 20:07:23] [INFO   ]     at systems.kinau.fishingbot.modules.ClientDefaultsModule.lambda$onSetDifficulty$1(ClientDefaultsModule.java:62) 
[2023-01-02 20:07:23] [INFO   ]     at java.base/java.lang.Thread.run(Thread.java:833) 
^C14.320u 3.089s 0:33.30 52.2%  0+0k 0+0io 5pf+0w

Maybe I'm missing a setting?

MrKinau commented 1 year ago

Thanks for mentioning this, I've only tested on offline mode servers. I've updated the latest release with a fixed version. I'll leave this issue open until the update is completely working and fully released.

nutjob4life commented 1 year ago

Testing with latest release gives:

[2023-01-03 09:17:05] [INFO   ] Achieved level: 1 
[2023-01-03 09:17:05] [INFO   ] Caught "lily_pad" 
[2023-01-03 09:17:05] [INFO   ] New inventory opened: {"translate":"container.chest"} 
[2023-01-03 09:17:30] [INFO   ] Caught "salmon" 
[2023-01-03 09:17:30] [INFO   ] New inventory opened: {"translate":"container.chest"} 
[2023-01-03 09:17:42] [INFO   ] Achieved level: 2 
[2023-01-03 09:17:42] [INFO   ] Caught "cod" 
[2023-01-03 09:17:42] [INFO   ] New inventory opened: {"translate":"container.chest"} 
[2023-01-03 09:18:12] [INFO   ] Caught "cod" 
[2023-01-03 09:18:12] [INFO   ] New inventory opened: {"translate":"container.chest"} 
[2023-01-03 09:18:24] [INFO   ] Achieved level: 3 
[2023-01-03 09:18:24] [INFO   ] Caught "bowl" 

which is absolutely fantastic.

Thank you!