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 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…