Bungee - Proxy Yamler 2.4.0

Easy API for saving and interacting with YAML Configs

  1. geNAZt

    Supporter

    The String you input into Yaml is incorrect. Please be sure you have valid Yaml in your File
     
  2. geNAZt

    Supporter

    geNAZt updated Yamler with a new update entry:

    Static fields and API Changes

    Read the rest of this update entry...
     
  3. geNAZt

    Supporter

  4. It's nice to know you are still alive :)
     
    • Agree Agree x 2
  5. Hey guy ;) You can add the possibility if the annotation @Comment or @Comments is empty to don't write the '#' ?
    Thanks
     
  6. Moi ça marche niquel perso. Envoie ta classe entière pour voir ;)
    For me It's works. Send your full class ;)
     
  7. Sorry, it was a problem I generated by myself (I copied my old config.yml)
     
  8. lol ok
     
  9. @geNAZt Can you answer me about this, guy ? o_O Thanks :)
     
  10. geNAZt

    Supporter

    Why do you use the @Comment Annotations when you don't want the Comment? I will not change the behaviour of that since i use it for formatting Comments.
     
  11. How to add space ;)
     
  12. Work newrst version in 1.8.8
     
  13. Hi,

    would it be possible to avoid the forced line breaks in values? I use it for from-plugin-class-autogenerated-locales mainly, and colors are reset when a line break is forced. The YAML format does not need those linebreaks.

    Thank you
     
  14. Hi @geNAZt,
    I have following problem:

    My setup,
    I've two (simplified) models:
    DailyTask with a UUID, title, description and itemStack
    TaskKeeper with a UUID and a list of DailyTasks

    I've two converter to set & load the models.
    In my config I added both converter.

    But the generated result is broken and the plugin is crashing while reading it.

    If I store a list of TaskKeepers, the TaskKeeperConverter is (probably) used, the ItemStack from the DailyTask looks fine, but the DailyTask is broken.
    Code (Text):
    keepers:
    - uuid: cc575b14-caac-4590-bc22-afc520f58504
      dailytasks:
      - !!de.b1acksheep.model.DailyTask
        uuid: !!java.util.UUID '50d9e8be-74c8-4e0a-9520-5215bd2a963b'
        title: Name
        description:
        - Foo
        - Bar
        item: amount: 1
            data:
              data: 0
            durability: 0
            type: DIAMOND
            typeId: 264
    If I store a list of DailyTasks, the DailyTaskConverter is (probably) used, but the ItemStack is broken.
    Code (Text):
    tasks:
    - uuid: 95f1c8c5-84f9-4e70-9b76-4ca85a8cc2b2
      title: Name
      description:
      - Foo
      - Bar
      item: !!org.bukkit.inventory.ItemStack
        amount: 1
        data:
          data: 0
        durability: 0
        type: BOOK
        typeId: 340

    I've tried your approach (from the ItemStack with the ItemMeta), to load the DailyTaskConverter while converting the TaskKeeper, but with this solution it won't store the ItemStacks (To get the ItemStackConverter raises a null pointer)

    Is this a bug or a mistake in my setup?
     
  15. I'm kinda confused on how I use it still i have
    package main;

    import java.io.File;

    import net.cubespace.Yamler.Config.Comment;
    import net.cubespace.Yamler.Config.Config;
    import net.md_5.bungee.api.plugin.Plugin;

    @SuppressWarnings("deprecation")
    public class Yaml extends Config {
    public Yaml(Plugin plugin) {
    CONFIG_HEADER = new String[]{"Configuration of the Database"};
    CONFIG_FILE = new File(plugin.getDataFolder(), "Bans.yml");
    }
    @Comment("Banned players ex: [Lel, Wife]");
    private String BannedPlayers = "[]";
    }
    so far but how do implement it into main?
     
    • Funny Funny x 1
  16. I DONT KNOW HOW TO CREATE A CLASS OR ANYTHING :( ALL I KNOW IS THAT WHEN I PUT YAMLER IN MY BUNGEE PLUGINS FOLDER AND RESTART MY PROXY THE YAMLER PLUGIN WONT CREATE A FOLDER WITH A CONFIG :( :( :( PLEASE HELP!!!!
     
  17. Hey guys just looking for a resolution

    I have a class extending yamlconfig that has 2 public members that are booleans. Now an existing config may or maynot have these new members. Hence when converting they are going to possibly be null. The converter will throw the following error if that occurs.

    Code (Text):
     Caused by: java.lang.IllegalArgumentException: Can not set boolean field au.com.addstar.bc.config.ChatChannel.subscribe to null value
    2017-08-17 15:27:55 [SEVERE]     at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167)
    2017-08-17 15:27:55 [SEVERE]     at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171)
    2017-08-17 15:27:55 [SEVERE]     at sun.reflect.UnsafeBooleanFieldAccessorImpl.set(UnsafeBooleanFieldAccessorImpl.java:80)
    2017-08-17 15:27:55 [SEVERE]     at java.lang.reflect.Field.set(Field.java:764)
    2017-08-17 15:27:55 [SEVERE]     at net.cubespace.Yamler.Config.InternalConverter.fromConfig(InternalConverter.java:112)
    2017-08-17 15:27:55 [SEVERE]     at net.cubespace.Yamler.Config.ConfigMapper.loadFromMap(ConfigMapper.java:89)
    2017-08-17 15:27:55 [SEVERE]     at net.cubespace.Yamler.Config.Converter.Config.fromConfig(Config.java:34)
    2017-08-17 15:27:55 [SEVERE]     at net.cubespace.Yamler.Config.Converter.Map.fromConfig(Map.java:78)
    2017-08-17 15:27:55 [SEVERE]     at net.cubespace.Yamler.Config.InternalConverter.fromConfig(InternalConverter.java:90)
    2017-08-17 15:27:55 [SEVERE]     at net.cubespace.Yamler.Config.YamlConfig.internalLoad(YamlConfig.java:185)
    2017-08-17 15:27:55 [SEVERE]     ... 8 more
     
    Obviously you cant set a boolean as null. My solution would be to make those fields Boolean and allow null setting however I definitively don't want to do that...I never want them as null I want the either true if set , false if set, or false if null. Is this where a custom converter comes into play - ??
     
  18. In fact the primitive converter says it handles boolean however it just returns the unprocessed section which can be null...?

    Code (Text):
    @Override
    public Object fromConfig(Class type, Object section, ParameterizedType genericType) throws Exception {
        switch(type.getSimpleName()) {
            case "short":
                return (section instanceof Short) ? section : new Integer((int) section).shortValue();
            case "byte":
                return (section instanceof Byte) ? section : new Integer((int) section).byteValue();
            case "float":
                if ( section instanceof Integer ) {
                    return new Double( (int) section ).floatValue();
                }

                return (section instanceof Float) ? section : new Double((double) section).floatValue();
            case "char":
                return (section instanceof Character) ? section : ((String) section).charAt(0);
            default:
                return section;
        }
    }