Closed kayc01 closed 7 years ago
Hey, after watching the error it appears to be an abrupt interruption betweent the stream of data and the data. The lib can't do anything to prevent this, I recommend making a cache of the mods and only updating it from time to time (At the end it really isn't a value that will be changing) and surround your code with a try catch to avoid a crash.
How do you suggest I create a cache properly? Ill research it. Otherwise you mean some sort of text file with the mods stored and seeing if the mod name exists in the file? Could you give an example of this code/if check. I am only used to Bukkit YML Configuration, not default java txt files.
Cache comes in many ways, the basic concept: Don't request every time, store it to make it accessible easier, like RAM.
I'm not an expert when it comes to algorithms and ways of storing and making cache, so you will have to make your own research there. But yes, cache comes in very ways and it all depends on your needs.
I managed to create a .txt file with a scanner that adds each mod (as written) to a list. I then see if the user.toString.toLowercase exists in the modsList. :)
Problem solved for now! :)
Not sure what caused this, or what it means. Though it's a result of a null point exception but points to a few lines of code...
Error: java.io.IOException: Premature EOF at sun.net.www.http.ChunkedInputStream.readAheadBlocking(Unknown Source) at sun.net.www.http.ChunkedInputStream.readAhead(Unknown Source) at sun.net.www.http.ChunkedInputStream.read(Unknown Source) at java.io.FilterInputStream.read(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(Unknown Source) at sun.nio.cs.StreamDecoder.readBytes(Unknown Source) at sun.nio.cs.StreamDecoder.implRead(Unknown Source) at sun.nio.cs.StreamDecoder.read(Unknown Source) at java.io.InputStreamReader.read(Unknown Source) at java.io.BufferedReader.fill(Unknown Source) at java.io.BufferedReader.readLine(Unknown Source) at java.io.BufferedReader.readLine(Unknown Source) at com.cavariux.twitchirc.Chat.Channel.getMods(Channel.java:227) at com.cavariux.twitchirc.Chat.Channel.isMod(Channel.java:249) at com.cavariux.twitchirc.Chat.User.isMod(User.java:53) at me.ckay.bot.CkayBotClass.onMessage(CkayBotClass.java:304) at com.cavariux.twitchirc.Core.TwitchBot.start(TwitchBot.java:308) at me.ckay.bot.Main.main(Main.java:17) Exception in thread "main" java.lang.NullPointerException at com.cavariux.twitchirc.Chat.Channel.isMod(Channel.java:249) at com.cavariux.twitchirc.Chat.User.isMod(User.java:53) at me.ckay.bot.CkayBotClass.onMessage(CkayBotClass.java:304) at com.cavariux.twitchirc.Core.TwitchBot.start(TwitchBot.java:308) at me.ckay.bot.Main.main(Main.java:17)
Lines of code:
at com.cavariux.twitchirc.Chat.Channel.isMod(Channel.java:249) at com.cavariux.twitchirc.Chat.User.isMod(User.java:53) - I have no access to see what code these lines are.
at me.ckay.bot.CkayBotClass.onMessage(CkayBotClass.java:304) - if (user.isMod(channel)) {
at com.cavariux.twitchirc.Core.TwitchBot.start(TwitchBot.java:308) - No access to see what this is.
at me.ckay.bot.Main.main(Main.java:17) bot.start();
You will have to dot up the other error's on the API. Any help is appreciated. Only ever happens on isMod from time to time.
Thanks.