MoonSouhayl
MoonSouhayl
Explore posts from servers
JCHJava 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:
Jerry Arthur
Souhay
Jerry Island
No Comment
Java Bot
Java Server
Soul Society
Jerry Arthur
Souhay
Jerry Island
No Comment
Java Bot
Java Server
Soul Society
if u search for Sou u should get :
Souhay
Soul Society
Souhay
Soul Society
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 info
18 replies
VVALORANT
Created by MoonSouhayl on 2/18/2024 in #community-help
Stuck in loading screen
This problem just started today, when i try to join a game, i just get stuck on the loading screen for too long and i sometimes get kicked with a popup saying that valorant lost connection, relaunch the game, i remember seeing the codes 92 and 1, i just started getting this problem today and i got many timeouts because of it, it may be a known issue so pleases let me know if you have a solution or need more info!
2 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:
Gson gson = Utils.newGson();
String data = gson.toJson(this);
CompletableFuture<Boolean> futureWrite = Utils.writeFileAsync(PokeTrainer.POKE_TRAINER_PATH, "feedbacks.json", data);
Gson gson = Utils.newGson();
String data = gson.toJson(this);
CompletableFuture<Boolean> futureWrite = Utils.writeFileAsync(PokeTrainer.POKE_TRAINER_PATH, "feedbacks.json", data);
public static Gson newGson() {
return new GsonBuilder().setPrettyPrinting().create();
}
public static Gson newGson() {
return new GsonBuilder().setPrettyPrinting().create();
}
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
private static void applypack(){
PackRepository packRep=Minecraft.getInstance().getResourcePackRepository();
if(packRep.getAvailableIds().contains("file/LavenderTexturePack.zip")){
packRep.addPack("file/LavenderTexturePack.zip");
packRep.reload();
}
}
private static void applypack(){
PackRepository packRep=Minecraft.getInstance().getResourcePackRepository();
if(packRep.getAvailableIds().contains("file/LavenderTexturePack.zip")){
packRep.addPack("file/LavenderTexturePack.zip");
packRep.reload();
}
}
4 replies
JCHJava Community | Help. Code. Learn.
Created by MoonSouhayl on 11/17/2023 in #java-help
downloading .zip from a link
No description
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 ?
No description
23 replies
JCHJava Community | Help. Code. Learn.
Created by MoonSouhayl on 5/1/2023 in #java-help
eh
No description
18 replies
JCHJava Community | Help. Code. Learn.
Created by MoonSouhayl on 5/1/2023 in #java-help
Error
class Test{
private int g=0;
void Do(int input){
g=input+1000;
System.out.println(g);
}
int Get(){
return g;
}
}

public class Main {
public static void main(String[] args) {

Test test=new Test();

test.Do(5);

int result=test.Get();

System.out.println(result+"...");
}
}
class Test{
private int g=0;
void Do(int input){
g=input+1000;
System.out.println(g);
}
int Get(){
return g;
}
}

public class Main {
public static void main(String[] args) {

Test test=new Test();

test.Do(5);

int result=test.Get();

System.out.println(result+"...");
}
}
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