simplix-softworks / simplixstorage Goto Github PK
View Code? Open in Web Editor NEWLibrary to store data in a better way
License: Apache License 2.0
Library to store data in a better way
License: Apache License 2.0
ive been tryin to join your discord for support but all the links seem to be expired or invalid
Describe the bug
Everytime I use (in 3.0.5) : getOrSetDefault(), a message of the type of data I got is send in the console.
Like : "OBJ: String T: String"
To Reproduce
Yaml YamlConfig = new Yaml("config","test");
String strengthstring = YamlConfig.getOrSetDefault("test","hey :D");
Expected behavior
Send nothing
hey i wanted to ask if your library will be updated in the future so that you can use it in the future as well
Describe the bug
I have a plugin that allows players to create shops and bank accounts. When either of these are created, their information is written to a json file so the information can later be accessed by the plugin.
When I create a shop, the plugin doesn't seem to be reading an updated version of the file until I reload or restart the server. I can get it to work by using the forceReload() method before opening the GUI, however if I try to do this directly after writing to the file, it doesn't work; this leads me to believe that the issue could be in how I'm accessing the information, but I'm really not sure.
The same thing seems to happen with the bank accounts, however, the GUI is updated perfectly fine if I create more accounts after I create one account & reload the server.
I'd also like to mention that, upon opening the file(s) in question, the data is all there, as expected, when these issues occur.
To Reproduce
My shop storage class: https://gist.github.com/test414EFF/6656433ce12c8f6e9912c4060393f52a
My account storage class: https://gist.github.com/test414EFF/6ac16a978b9b1f6d2939792487564e62
ShopGUI Method: https://gist.github.com/test414EFF/2d048c2a5959605c5fcd1f4c5cc36201
AccountSelector Method: https://gist.github.com/test414EFF/fd68829ab058add44941881627b6eeba
Expected behavior
When I access data in a json file through my plugin, I expect the data to be up to date/consistent with what I can see upon opening the file in a text editor.
Version
I'm running Lightning Storage 3.0.7.
Additional context
I've also tried changing the reload settings to all of the available settings and testing. These seemed to make no difference at all.
Is your feature request related to a problem? Please describe.
I agree with issue #22 that examples would be helpful.
Describe the solution you'd like
I wrote code to create config files with identical key/value pairs. If you like it I'd be honored if you add it to your wiki, or feel free to change it however you like.
Describe alternatives you've considered
Considered letting someone else do it ^_^
Additional context
Issue #29 will affect the resultant example lightning file.
0001-Add-sample-files-to-FileTypes-wiki-page.patch.gz
0002-Add-example-code-and-file-style-to-Examples-wiki-pag.patch.gz
Hi, is it possible to use custom serialization objects (classes that implements ConfigurationSerializable, Cloneable) with this library?
The documentation seems to be quite outdated, and perhaps, lacking in some places. If you want me to scroll over it and let you know exactly what I think needs updating, please don't be afraid to ask.
I wish to highlight that adding a FAQ (Frequently Asked Questions) page might be very beneficial, covering the questions you are frequently asked - saving you time that would otherwise be spent answering such question ;)
This isn't anything important - just a suggestion from me to improve the resource. Additionally, I would contribute to the Wiki myself if - if I had the knowledge. I've only just got back into using SimplixStorage (last used it when it was named LightningStorage), so I'm quite reliant on the documentation as I learn how to use this resource.
List:
Thanks. :)
Describe the bug
When the reload callback is executed, there is throw an error.
To Reproduce
Steps to reproduce the behavior:
Desktop (please complete the following information):
Additional context
[Server thread/ERROR]: Error occurred while enabling InteractiveBooks v1.5.6 (Is it up to date?) net.leonardo_dgs.interactivebooks.simplixstorage.internal.exceptions.LightningValidationException: FileData mustn't be null at net.leonardo_dgs.interactivebooks.simplixstorage.util.Valid.notNull(Valid.java:36) ~[?:?] at net.leonardo_dgs.interactivebooks.simplixstorage.internal.FlatFile.getFileData(FlatFile.java:341) ~[?:?] at net.leonardo_dgs.interactivebooks.simplixstorage.internal.FlatFile.get(FlatFile.java:142) ~[?:?] at net.leonardo_dgs.interactivebooks.simplixstorage.internal.DataStorage.getOrDefault(DataStorage.java:285) ~[?:?] at net.leonardo_dgs.interactivebooks.simplixstorage.internal.DataStorage.getString(DataStorage.java:113) ~[?:?] at net.leonardo_dgs.interactivebooks.ConfigManager.registerBook(ConfigManager.java:64) ~[?:?] at net.leonardo_dgs.interactivebooks.ConfigManager.lambda$loadBookConfigs$0(ConfigManager.java:55) ~[?:?] at net.leonardo_dgs.interactivebooks.simplixstorage.internal.FlatFile.forceReload(FlatFile.java:291) ~[?:?] at net.leonardo_dgs.interactivebooks.simplixstorage.Yaml.<init>(Yaml.java:101) ~[?:?] at net.leonardo_dgs.interactivebooks.simplixstorage.Config.<init>(Config.java:53) ~[?:?] at net.leonardo_dgs.interactivebooks.simplixstorage.LightningBuilder.createConfig(LightningBuilder.java:128) ~[?:?] at net.leonardo_dgs.interactivebooks.ConfigManager.loadBookConfigs(ConfigManager.java:57) ~[?:?] at net.leonardo_dgs.interactivebooks.ConfigManager.loadAll(ConfigManager.java:30) ~[?:?] at net.leonardo_dgs.interactivebooks.InteractiveBooks.onEnable(InteractiveBooks.java:35) ~[?:?] at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[spigot-1.17.1.jar:3242-Spigot-6c1c1b2-d3cc412] at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:342) ~[spigot-1.17.1.jar:3242-Spigot-6c1c1b2-d3cc412] at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:480) ~[spigot-1.17.1.jar:3242-Spigot-6c1c1b2-d3cc412] at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugin(CraftServer.java:514) ~[spigot-1.17.1.jar:3242-Spigot-6c1c1b2-d3cc412] at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugins(CraftServer.java:428) ~[spigot-1.17.1.jar:3242-Spigot-6c1c1b2-d3cc412] at net.minecraft.server.MinecraftServer.loadWorld(MinecraftServer.java:619) ~[spigot-1.17.1.jar:3242-Spigot-6c1c1b2-d3cc412] at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:266) ~[spigot-1.17.1.jar:3242-Spigot-6c1c1b2-d3cc412] at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1010) ~[spigot-1.17.1.jar:3242-Spigot-6c1c1b2-d3cc412] at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:305) ~[spigot-1.17.1.jar:3242-Spigot-6c1c1b2-d3cc412] at java.lang.Thread.run(Thread.java:833) [?:?]
Describe the bug
java.lang.ClassNotFoundException
To Reproduce
My pom.xml : https://pastebin.com/YksCJG6B
My package: https://i.imgur.com/AVoa4K8.png
My code: https://i.imgur.com/HZsbRFi.png
The error: https://i.imgur.com/eB7eUiS.png
Is your feature request related to a problem? Please describe.
It would be useful to make consistent configs for Sponge plugins.
Describe the solution you'd like
Support for HOCON files.
Describe the bug
When there is a dot (.) in the key of a valid json (or any other) file like this :
{
"test" : {
"test2.test3": "Should work"
}
}
FlatFile#get("test.test2.test3") doesn't return anything.
But
{
"test" : {
"test2": {
"test3" : "It works "
}
}
}
Correctly return "It works"
Expected behavior
When the key of a file contains a dot, it should still work.
Desktop (please complete the following information):
Is your feature request related to a problem? Please describe.
At the moment we as users of this api cannot act on exceptions thrown within this api since they are already being caught.
Describe the solution you'd like
A clear and concise description of what you want to happen.
Rethrow the exception so we as users of the api can handle them they way we want to.
Describe alternatives you've considered
We'll a different api but without this issue there is no need to.
Additional context
Some examples of internal exception handling within the api
https://github.com/Simplix-Softworks/SimplixStorage/blob/master/src/main/java/de/leonhard/storage/internal/FlatFile.java#L126
https://github.com/Simplix-Softworks/SimplixStorage/blob/master/src/main/java/de/leonhard/storage/internal/FlatFile.java#L282
https://github.com/Simplix-Softworks/SimplixStorage/blob/master/src/main/java/de/leonhard/storage/internal/FlatFile.java#L298
Describe the bug
I added the plugin as shown in the images below, but it does not generate any files.
I don't know if it's a bug or if I'm doing something wrong, but I spent a few hours reviewing my gradle settings, and it seems ok.
Screenshots
The logs do not appear all, only the "Here 01" when i start the server
It seems that it hangs when calling SimplixBuilder and does not start the rest of the plugin
Desktop:
Desktop:
Describe the bug
Json files can't be modified because of an input stream not being closed. I believe this input stream is the problem:
https://github.com/JavaFactoryDev/LightningStorage/blob/63a7086cf8cb5f7dc87fdbb69e730455ad07980f/src/main/java/de/leonhard/storage/Json.java#L36
If the input stream does need to constantly stay open can you add a close() method that we can call when we're done with the json so we can modify the file?
To Reproduce
I was specifically testing with deleting the json file which fails since the input stream isnt closed
Json json = new Json("test", "C:\\some\\path\\");
Files.delete(json.getFile().toPath());
Caused by: java.nio.file.FileSystemException: The process cannot access the file because it is being used by another process.
Describe the bug
getLongList seems to return an integer list?
List<Long> legacy = userdata.getLongList(profile.getPk() + ".followers");
When trying to loop through it i get
Exception in thread "main" java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long
Here is an example of the list: https://paste.md-5.net/mitokajuni.json
Yes the list is getting returned as is, not empty.
To Reproduce
Steps to reproduce the behavior:
Create a List using #getLongList()
Loop through it using for (long entry : list), throws this error
Expected behavior
it should loop but i think it's casting Integer while creating the loop or something?
Screenshots
N/A
Desktop (please complete the following information):
Additional context
N/A
Describe the solution you'd like
It would be useful to implement comment preservation and header methods on Toml files.
Describe the bug
When the plugin creates the file add a dot before the extension name for example Rewards.yml became Rewards..yml
To Reproduce
Watch my code.
Expected behavior
Only one dot.
Screenshots
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
Describe the bug
Trying to use remove() to delete a hashmap in a JSON file results in this error:
https://hastebin.com/ovasapukam.sql
To Reproduce
Use remove() on a hashmap in a json file. I have not tested this with other file types or other datatypes.
Expected behavior
I expected this to remove the data from the file.
Desktop (please complete the following information):
Is your feature request related to a problem? Please describe.
My data files are not synchronized on several servers, or several machines
Describe the solution you'd like
I will find it more comfortable if you can add MySQL support. With the same methods (well almost), it would be really productive to be able to store data from one database and retrieve it from another server. It is a necessity for me, would you say?
Describe alternatives you've considered
You can add support of MySQL database as if they were files
Additional context
This functionality would be in my opinion one more reason to use the library
Hello! I am new to using everything that is Simplix Storage and I have a question, how can I get the data from a file? What I am doing is a constructor to create the configuration files easier, and I create them in my main plugin, but how can I access the config from another class? I would also like you to leave sample codes if possible, but mainly that is my question, since when using String aString = yaml.getString ("Key") ; // Default: "", I don't know how to use it well and also the "yaml" doesn't recognize me, maybe it's an easy question to answer but I don't know what to do, I am waiting for an answer, and thank you very much for reading!
Main Class:
When I reload my server/plugin, the .yml is corrupted
How to reproduce (in my case):
The first load the correct encodage, but nexts (re)load corrupt the file
I can't use special character :/
Is your feature request related to a problem? Please describe.
My plugin needs to do something while reloading.
I like auto-reloads, it's smart, but I didn't found some like callback stuff.
Describe the solution you'd like
A clear and concise description of what you want to happen.
Some thing like:
Config config = LightningBuilder.fromFile( FILE ).reloadCallback( (config) -> { /* do something */ } ).createConfig();
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
nothing
Additional context
Add any other context or screenshots about the feature request here.
nope
Hi where can I download the jar of this library?
Is your feature request related to a problem? Please describe.
Jar file size reduction.
Describe the solution you'd like
A jar file size reduced.
Describe alternatives you've considered
None yet.
Describe the bug
When trying to get a list from a yaml file (or any other file like Json), the first time it returns a string with no error, the second time : an error.
To Reproduce
Use this code :
Yaml YamlConfig = new Yaml("config","storagetest");
String [] defaulteffect = {"test1","test2","test3"};
System.out.println(YamlConfig.getOrSetDefault("test", defaulteffect).getClass());
First time the output is : "class [Ljava.lang.String;"
second time :
"java.lang.ClassCastException: java.util.ArrayList cannot be cast to [Ljava.lang.String;"
Expected behavior
Return a String[] containing "test1","test2" and "test3"
Describe the bug
When you remove something from storage, there is a console spam.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
No console output when removing entries from storage.
Describe the bug
When you use Yaml#addDefaultsFromInputStream, the saved config is no longer ordered, even if you set DataType.SORTED
.
To Reproduce
The following code produces an unordered Yaml file.
private Yaml loadLangConfig(String langCode) {
File file = new File(langFolder.toPath().toString(), langCode + ".yml");
Yaml langConfig = SimplixBuilder.fromFile(file)
.setReloadSettings(ReloadSettings.INTELLIGENT)
.setDataType(DataType.SORTED)
.createYaml();
InputStream resource = getDefaultLangFileStream(langCode);
if (resource == null) {
resource = getDefaultLangFileStream(settings.getDefaultLanguage());
if (resource == null)
resource = getDefaultLangFileStream("en_us.yml");
}
langConfig.addDefaultsFromInputStream(resource);
return langConfig;
}
Cannot use the latest version because it is not present in the Nexus repository.
I manually browsed the Nexus repository and only up to version 1.9.1 is present.
I can fork the repository and compile install
it manually, but that isn't ideal especially since there is a Nexus repository available.
Looking forward to incorporating JSON based storage for GlobalWarming, but would like to see the latest artifacts uploaded. Thanks!
Is your feature request related to a problem? Please describe.
Having all the code in one module means even if I am not using something such as the toml class, because its all in one module I have to have it increasing the size of my final jar. I know it's bot much but it would also be cleaner imo
Describe the solution you'd like
Split the project into 5 modules:
Describe alternatives you've considered
I believe you can remove classes your not using in maven however thats something not all developers know
Hello JavaFactoryDev,
I found something in FileUtils where you are throwing this:
throw new IllegalStateException("Can't return null as byte[]");
The comment Can't return null as byte[]
is not needed, as I tried in my Java Project (Java Version 12.0.1). I created a Method that expected a byte array as return value and I could just return null.
public byte[] getBytes() {
return null;
}
I tried this code and my IDE (Intelij IDEA CE) did not warn me that something is wrong. Could it be that you think that byte is a primitive but an array of a primitive is an Object? You can see this in effect while looking at a List<>
.
// This does not work as 'byte' is not an Object.
List<byte> bytes = new ArrayList<>();
// This does work because 'byte[]' is a Object.
List<byte[]> bytes = new ArrayList<>();
Edit-0:
What about returning an empty byte array instead of returning null?
Edit-1:
Changed some typos.
Describe the bug
An NPE is thrown when you try to use a json created from the (final File file) constructor. This does not happen when using a different constructor. I also tested the (final File file) constructor with yaml and that does work
To Reproduce
Json json = new Json(new File("C:\\some\\path\\test.json"));
json.set("test", 1);
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.NullPointerException
at de.leonhard.storage.Json.reload(Json.java:156)
at de.leonhard.storage.Json.set(Json.java:444)
Describe the bug
When I load/create config, the comments dissappear if I use
.addDefaultsFromInputStream()
Using:
LightningBuilder.fromFile(new File(location, fileName)) .addInputStreamFromResource(fileName) //Optional .setDataType(DataType.SORTED) .setReloadSettings(ReloadSettings.INTELLIGENT) .setConfigSettings(ConfigSettings.PRESERVE_COMMENTS) .createConfig()
Works, but that wouldnt add defaults from my resource file.
So Need to use .addDefaultsFromInputStream()
,
But that will remove 90% of the comments. Out of like 100x comments like 4 stay on the file for some reason.
Desktop (please complete the following information):
Describe the bug
LightningStorage generates a new line character after each Yaml config key and even a space after a section key, it's annoying.
If it is expected, in the API should be added the mentioned styling options.
Code
Yaml yamlConfig = LightningBuilder
.fromPath("test.yml", getDataFolder().getPath())
.setDataType(DataType.SORTED)
.setConfigSettings(ConfigSettings.PRESERVE_COMMENTS)
.setReloadSettings(ReloadSettings.MANUALLY)
.createConfig();
yamlConfig.addHeader("asdasd", "abbbb");
yamlConfig.setPathPrefix("taaaa");
yamlConfig.setDefault("b", "asdsadads");
yamlConfig.setDefault("a", 32);
yamlConfig.setDefault("c.a", "tetetetesst");
Config output
taaaa:
a: 32
b: asdsadads
c:
a: tetetetesst
Expected behavior
I expected that Yaml configs would be generated like in the screenshots in the SpigotMC plugin page.
Hey, just a fair warning, you might want to update the LightningBuilder to SimplixBuilder in the config
Hello JavaFactoryDev,
I looked through your code and tried to look at examples for every config format you support. I was thinking about some JSON examples, some YAML examples, some TOML examples and some LightningFile examples. It would help me and some other creators to get some examples and ideas how to use the config files. This would especially be useful for the LightningFile as there is no known documentation I have found.
Regards,
Edit-0:
Regards section
Describe the bug
LightningStorage file type does not store list correctly
To Reproduce
Steps to reproduce the behavior:
private void setupConfig () {
String string1 = "string";
String nest1 = "Nested Value";
String nest2 = "Another nested value";
String[] list = new String[]{"List item one", "Another item", "The last one, I promise"};
int ultimateAnswer = 42;
boolean boo = true;
Json json = new Json("lightning.json", getDataFolder().toString());
Yaml yaml = new Yaml("lightning.yaml", getDataFolder().toString());
Toml toml = new Toml("lightning.toml", getDataFolder().toString());
LightningFile lightningFile = new LightningFile("lightning.ltn", getDataFolder().toString());
List <String> header = new ArrayList <String>();
header.add("This is a header");
header.add("It supports array list");
header.add("for multiple line comments.");
header.add("Only available in YAML");
json.setDefault("key1", string1);
json.setDefault("nested.key1", nest1);
json.setDefault("nested.key2", nest2);
json.setDefault("next_key", "next_value");
json.setDefault("the_answer_to_everything", ultimateAnswer);
json.setDefault("listExample", list);
yaml.setHeader(header);
yaml.write();
yaml.setDefault("key1", string1);
yaml.setDefault("nested.key1", nest1);
yaml.setDefault("nested.key2", nest2);
yaml.setDefault("next_key", "next_value");
yaml.setDefault("the_answer_to_everything", ultimateAnswer);
yaml.setDefault("listExample", list);
toml.setDefault("key1", string1);
toml.setDefault("nested.key1", nest1);
toml.setDefault("nested.key2", nest2);
toml.setDefault("next_key", "next_value");
toml.setDefault("the_answer_to_everything", ultimateAnswer);
toml.setDefault("listExample", list);
lightningFile.setDefault("key1", string1);
lightningFile.setDefault("nested.key1", nest1);
lightningFile.setDefault("nested.key2", nest2);
lightningFile.setDefault("next_key", "next_value");
lightningFile.setDefault("the_answer_to_everything", ultimateAnswer);
lightningFile.setDefault("listExample", list);
}
key1 = string nested { key1 = Nested Value key2 = Another nested value } next_key = next_value the_answer_to_everything = 42 listExample = [Ljava.lang.String;@25288e12
Expected behavior
Strings would be stored, not just a reference to java object.
Also tested with Json, Yaml and Toml with perfect results. I realize this is an array, not a list and is similar to #20 but not quite the same as I am using v3.1.0
{ "key1": "string", "listExample": [ "List item one", "Another item", "The last one, I promise" ], "next_key": "next_value", "nested": { "key1": "Nested Value", "key2": "Another nested value" }, "the_answer_to_everything": 42 } key1: string nested: key1: Nested Value key2: Another nested value next_key: next_value the_answer_to_everything: 42 listExample: - List item one - Another item - The last one, I promise key1 = "string" next_key = "next_value" the_answer_to_everything = 42 listExample = ["List item one", "Another item", "The last one, I promise", ] [nested] key1 = "Nested Value" key2 = "Another nested value"
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
Add any other context about the problem here.
Describe the bug
Toml comments are not preserved when setting a value in an existing commented file.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Preservation of comments in Toml files
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Describe the bug
Whenever I try to compile my 1.17 Bukkit plugin (using java 16), if SimplixStrage is added and shaded, I get the following error while compiling: Unsupported class file major version 60
. When I remove it, it compiles fine
To Reproduce
Steps to reproduce the behaviour:
Expected behavior
It should just build
Desktop (please complete the following information):
Additional context
This is a paper plugin. And the shade plugin version is 3.2.4
Describe the bug
My shops file doesn't seem to be updated automatically even when my accounts file is. Everything works as intended after I either restart the server or do /reload.
To Reproduce
My shop storage class: https://gist.github.com/test414EFF/6656433ce12c8f6e9912c4060393f52a
Expected behavior
Both JSON files should be updated without having to reload the server.
Additional context
JSON file: https://gist.github.com/test414EFF/ffa5a20d23b632db19ce3eaa799281f3
Is your feature request related to a problem? Please describe.
It's bit boring to write setPathPrefix(null) everytime I have to go to my root section using the lib. Moreover I think it's a more elegant way to reset it using a function made for it.
Describe the solution you'd like
Just mapping a new function resetPathPrefix to setPathPrefix(null)
Is your feature request related to a problem? Please describe.
JSON too large
Describe the solution you'd like
I would like there to be an option to modify the file, i.e. there is no more space, no comments, and everything to be on one line
Describe alternatives you've considered
Remove all space
Describe the bug
UTF-8 characters get broken and duplicated every time when config(yml) is edited.
To Reproduce
Steps to reproduce the bug:
Expected behavior
It should be no corruption of characters when plugin is editing the config file.
Desktop (please complete the following information):
Describe the bug
Yaml
configuration, some integer values are rewritten to be strings in that configuration file.Yaml#getOrSetDefault()
are rewritten, though I cannot 100% verify thisTo Reproduce
Yaml
classYaml config = new Yaml(new File(getDataFolder(), "config.yml"));
getOrSetDefault()
config.getOrSetDefault("test.defaulttest", 1);
test:
defaulttest: 1
test:
defaulttest: '1'
Expected behavior
The configuration value should be saved as integer in the yaml file, and not changed on reload.
Example code
Yaml config = new Yaml(new File(getDataFolder(), "config.yml"));
config.setConfigSettings(ConfigSettings.PRESERVE_COMMENTS);
// unmodified config option
config.set("test.test", 1);
config.setDefault("test.test", 2);
getLogger().info(Integer.toString(config.getInt("test.test")));
// config option that magically transforms
config.getOrSetDefault("test.defaulttest", 1);
Version
(from maven)
com.github.simplix-softworks:SimplixStorage:jar:3.2.2
com.esotericsoftware.yamlbeans:yamlbeans:jar:1.13
org.json:json:jar:20200518
Server
Minecraft: Paper 1.16.5 v662, implementing API 1.16.5-R0.1-SNAPSHOT
Java: Java 11 (OpenJDK 64-Bit Server VM 11.0.11+9) Host: Linux 5.4.106-1-pve (amd64)
Additional context
(1) YAML file after addition of values with code above:
test:
test: 1
defaulttest: 1
(2) YAML file after server restart/plugin reload:
test:
test: 1
defaulttest: '1'
I have found a little bug:
In de.leonhard.storage.Json at method write() :
The writer was not closed.
And,
In de.leonhard.storage.util.JsonUtils at getJsonFromMap() :
Use Map.Entry (one time loop) instead of KeySet (loop + find)
Describe the bug
In the latest release(3.2.5), it shows version 3.2.4 instead of 3.2.5
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Library imports succesfully
See:
com.github.simplix-softworks
SimplixStorage
3.2.4
Version should be 3.2.5
Thanks for maintaining this library. Your work is appreciated
Describe the bug
Unsorted and Sorted return both LinkedHashMap internally.
Expected behavior
Have one return HashMap and the other LinkedHashMap
Desktop (please complete the following information):
Current master build
Example i have player storage like this
Low_Scarlet.json
money: 90
Low_Scarlet2.json
money: 99999
Low_Scarlet3.json
money: 0
How to get top money here?
Is your feature request related to a problem? Please describe.
You could say yes, Yaml for example allows comments in a file and even if there are modifications the comments are kept, but in Toml this is not the case.
Describe the solution you'd like
I suggest that comments should be allowed in a Toml file as in Yaml. There are users that use my plugin that when there is some modification in the configuration as it is a Toml file the comments are lost.
Describe the bug
When you do json.set("Path", value) and pass value as a double, it saves an int to the file instead of a double.
double x = loc.getX();
json.set("Sirens." + openId + ".X", x);
leads to a value in the .json file of -> "X": -9992,
calling json.getDouble("Sirens." + i + ".X") then returns the int instead of a double
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.