Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
763 views
in Technique[技术] by (71.8m points)

yaml - Spigot API - not getting value from config.yml - what is wrong? Java

Code:

setGameState((int) configManager.getEntry("INGAME_STATE"));

I call the setGameState(integer) method in the constructor of the Class. The Method sets the current game state to the parameter. I debugged some and I know that everything works perfectly fine except the (int) configManager.getEntry("INGAME_STATE") part. It returns 0 whatever value the config contains under this entry "INGAME_STATE".

When I set the value in the config to 1 for example, after a reload (which is needed to call the class and therefore the constructor) the value switches to 0.

When executing a /reload, the server first stops = calls onDisable() and then starts = calls onEnable(). I found out that after stopping the server completely (which only calls the onDisable method since the server doesn't start up after) the value in the config is already changed to 0.

I checked all code in the onDisable() method but nothing is there that writes something in the config.yml file.

I don't know what is causing this.. Do you need more code or something? I am really confused.

question from:https://stackoverflow.com/questions/65602673/spigot-api-not-getting-value-from-config-yml-what-is-wrong-java

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...