MoonSouhayl
Explore posts from serversJCHJava Community | Help. Code. Learn.
•Created by MoonSouhayl on 5/9/2024 in #java-help
timer already canceled
as u can see in the file, i am scheduling two tasks using TimerTask, and in the first line of the code in each task, u will see that i am returning if
huntEnded
is true, and while that works fine, the reason i am doing it like that is because, when i set the huntEnded
to true and try to do timer.cancel()
i just get a Timer already canceled
, and i dont understand, why? i am not even trying to cancel while the task is being executed
(sorry but i cant provide any error messages, i had this issue a while ago and replicating the thing will be painful but it basically just said timer already cancelled and pointed to the line where i have the timer.cancel()
)23 replies
JCHJava Community | Help. Code. Learn.
•Created by MoonSouhayl on 3/20/2024 in #java-help
Json file not having everything
So I have the class below, and my problem is, when I update it and add a new variable, if you launch it while you have already used it previously, your JSON file won't have all the variables needed, so they are just set to null, and that produces some problems later.
To fix this, the only idea I have is just a bunch of if statements, and while that's not really a big deal in the class example I just gave, I have other classes with many variables, and using if will make everything messy.
Anyone got any ideas? I have also thought about Gson having something for this case, but couldn't find anything.
25 replies
JCHJava Community | Help. Code. Learn.
•Created by MoonSouhayl on 3/9/2024 in #java-help
Gradle telling me smth is bad in my code
Note: C:\Users\lordo\Desktop\everythingV2\Projects\LavenderMC-ServerSide\src\main\java\org\imsouhay\pokehunt\util\Utils.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
7 replies
JCHJava Community | Help. Code. Learn.
•Created by MoonSouhayl on 2/29/2024 in #java-help
Fastest Way to search for something in big data
I have a lot of data and i need to search in it and get the respond as fast as possible, example:
if u search for
Sou
u should get :
even tho i know how to make this, the list of data is huge, so i am looking for the fastest way to do this, the list is originally stored in a txt file or a json, loaded from that file once so no need for optimization there
into a data structure that i havent decided yet, i need the best for this, and then i will need to search for stuff, the searching will happen often
let me know if u need anymore info18 replies
JCHJava Community | Help. Code. Learn.
•Created by MoonSouhayl on 2/1/2024 in #java-help
String to Json turning ' to unicode
when i turn the string:
"You have set your @pokemon's nature to @nature."
to a json file using Gson i get:
"nature": "You have set your @pokemon\u0027s nature to @nature.",
and u can see that the '
turned into \u0027s its working well, and loading from json to string as expected but i want it to stay as '
and not change
my code:
8 replies
JCHJava Community | Help. Code. Learn.
•Created by MoonSouhayl on 12/2/2023 in #java-help
Apply texture pack in forge
I want a texture pack that exists in resourcepacks/LavenderTexturePack.zip to be applied i tried but i failed, the pack is applied inside minecraft/options/resourcepacks in game but doesnt actually apply it to the items until i click on the apply button
4 replies
JCHJava Community | Help. Code. Learn.
•Created by MoonSouhayl on 11/17/2023 in #java-help
downloading .zip from a link
16 replies
JCHJava Community | Help. Code. Learn.
•Created by MoonSouhayl on 5/13/2023 in #java-help
JavaFX
so i have a 16*16 matrix, and when i click on one of them i need something that tell me it position,
anyone got any ideas ?
32 replies
JCHJava Community | Help. Code. Learn.
•Created by MoonSouhayl on 5/9/2023 in #java-help
what am i doing wrong ?
23 replies
JCHJava Community | Help. Code. Learn.
•Created by MoonSouhayl on 5/1/2023 in #java-help
Error
i get:
Exception in thread "main" java.lang.NoSuchMethodError: 'void Test.Do(int)'
at Main.main(Main.java:17)
how can i fix this ?
16 replies
JCHJava Community | Help. Code. Learn.
•Created by MoonSouhayl on 4/1/2023 in #java-help
remove spaces from string
how can i remove spaces from a string ? i tried split(), but it give me [Ljava.lang.String;@7b23ec81
9 replies
JCHJava Community | Help. Code. Learn.
•Created by MoonSouhayl on 3/30/2023 in #java-help
LocaleDate
how can i use LocaleDate to get the current year as an int ?
7 replies