YamlConfiguration list of allowed characters

Discussion in 'Plugin Development' started by blablubbabc, Jan 3, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    blablubbabc

    Hey,
    I am searching for some kind of list of allowed characters that can be used inside a String (Edit: more precise , a list of strings ) inside a YamlConfiguration.

    What I want to achieve with that, is:
    A Player shall be able to save a (list of) string/s inside a YamlConfiguration via commands etc., but before it is actual saved I want to check this input and replace characters that could lead into yaml errors during the loading.. (characters like '.' or ':'for example I think)

    Any suggestions ?
    bla
     
  2. Offline

    gomeow

    If you put the string into quotes, you can have those characters

    Example: ":"
     
  3. Offline

    blablubbabc

    Hm, but what is with lists? If I want to put a list of strings into a YAMLConfig like:
    PHP:
    ArrayList<String> list = new ArrayList<String>();       
    list.
    add("10:Balls:332:0:15");
    list.
    add("50:Balls:332:0:65");
    list.
    add("100:Balls:332:0:120");
     
    config.set("some.node", list);
    I am very sure I had problems there with ':', and also with '|' , thats the reason I now use '-' as seperator.

    In the current case I also have lists of strings, but random players can put stuff there via commands, so I would like to have it save..
     
  4. Offline

    fireblast709

    I think if you would use that snippet, the YAML parser would just wrap the String in quotes
     
  5. Offline

    blablubbabc

    So I donÄt have to fear any input from users inserting a String into this list ?
     
  6. Offline

    fireblast709

    You should not have to fear that. I assume the YAML parser would handle that perfectly fine :3
     
Thread Status:
Not open for further replies.

Share This Page