Want a better Minecraft server? Read about SpigotMC here!
Separate names with a comma.
Discussion in 'Spigot Plugin Development' started by FatalPacket, May 1, 2017.
Fixed: Access the data file in a static way.
Maybe it crashes when you try to save the config. Check out the logs!
That is most likely the issue. Where is the code that initiates the variable "d"? There might be an issue there. Make sure to stick to Java naming conventions if you plan to share snippets of code.
I think that the rest of the code is fine since it saves his data.yml. It seems that the error is when he tries to save the configuration with the new boolean value.
It does not crash, the plugin doesn't crash. There is no error in logs,
d is File d = new File(Main.getCore().getDataFolder(), "data.yml");
Try my API! https://www.spigotmc.org/resources/omels-api.38380/
Yeah, no thanks. I don't need API's.. I only need Java and Bukkit.
My API is Java/Bukkit
Yeah but it's an API.. It just increases file size (I know it provides stuff). I'll only make my own classes.
Then Learn Java
This is not a nice excuse to not use his API.
As long as it doesn't require the user to install another plugin, I don't see what's wrong. We live in a day where a few extra kb is considered near to nothing.
He knows Java, he's asking for help because the Bukkit API won't do what he wants.
Are you asserting that 96 kilobytes is not a lot?
I think instead of asking this user to use an API, attempt to teach this person how to do what he wants to learn how to do, this is something that's supposed to be working, but it's not.
Let's get back to the actual question how about that?
I have made sure that the Boolean it's changing is not a null value or that it's changing the Boolean in the right path.
If you want I can upload the source code.
Do so, right now we cannot see anything wrong. By the way, you shouldn't load the config every time that method is called for performance sake. It's better to store it and save the config once you are done.
Agreed. Fatal, I suggest making a util class that contains one instance of your files/config, and has specific methods that you need, such as this one. Then access them by creating a singleton instance of the class. This may help, and even fix your problem if it's a performance thing.
This is because for the Violations in the Message to update, unfortunately, it doesn't update without it.
I don't really want to make a class if it's going to be used once. But fine I'll try.