Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
808 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.


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

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...