Solved Error in copying defaults from config.yml. Can't seem to find the error.

Discussion in 'Plugin Development' started by Mindlessmink, Aug 3, 2016.

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

    Mindlessmink

    Okay, So I just made a /freeze plugin which also has a config.yml. I was planning on uploading it to BukkitDev, But, I was surprised by this console log error:

    Code:
       
    [19:16:50 INFO]: [MinkFreeze] Disabling MinkFreeze v1.0
    [19:16:50 ERROR]: [MinkFreeze] Cannot load configuration from jar
    org.bukkit.configuration.InvalidConfigurationException: while parsing a block ma
    pping
     in 'string', line 1, column 1:
        frozenmessage: '&cYou've been fr ...
        ^
    expected <block end>, but found Scalar
     in 'string', line 1, column 23:
        frozenmessage: '&cYou've been frozen! Join TeamSpeak 3 ...
                              ^
    
            at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlCo
    nfiguration.java:57) ~[bukkit.jar:git-Bukkit-efe04b8]
            at org.bukkit.plugin.java.JavaPlugin.reloadConfig(JavaPlugin.java:214) [
    bukkit.jar:git-Bukkit-efe04b8]
            at org.bukkit.plugin.java.JavaPlugin.getConfig(JavaPlugin.java:162) [buk
    kit.jar:git-Bukkit-efe04b8]
            at me.mink.freeze.Main.<init>(Main.java:20) [MinkFreeze.jar:?]
            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
     [?:1.8.0_91]
            at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
     [?:1.8.0_91]
            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou
    rce) [?:1.8.0_91]
            at java.lang.reflect.Constructor.newInstance(Unknown Source) [?:1.8.0_91
    ]
            at java.lang.Class.newInstance(Unknown Source) [?:1.8.0_91]
            at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.jav
    a:52) [bukkit.jar:git-Bukkit-efe04b8]
            at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.j
    ava:129) [bukkit.jar:git-Bukkit-efe04b8]
            at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.
    java:328) [bukkit.jar:git-Bukkit-efe04b8]
            at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager
    .java:251) [bukkit.jar:git-Bukkit-efe04b8]
            at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugins(CraftServer.ja
    va:289) [bukkit.jar:git-Bukkit-efe04b8]
            at org.bukkit.craftbukkit.v1_8_R3.CraftServer.reload(CraftServer.java:71
    8) [bukkit.jar:git-Bukkit-efe04b8]
            at org.bukkit.Bukkit.reload(Bukkit.java:544) [bukkit.jar:git-Bukkit-efe0
    4b8]
            at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:
    25) [bukkit.jar:git-Bukkit-efe04b8]
            at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:14
    0) [bukkit.jar:git-Bukkit-efe04b8]
            at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServe
    r.java:620) [bukkit.jar:git-Bukkit-efe04b8]
            at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchServerCommand(Craf
    tServer.java:606) [bukkit.jar:git-Bukkit-efe04b8]
            at net.minecraft.server.v1_8_R3.DedicatedServer.aO(DedicatedServer.java:
    372) [bukkit.jar:git-Bukkit-efe04b8]
            at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:3
    36) [bukkit.jar:git-Bukkit-efe04b8]
            at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:6
    29) [bukkit.jar:git-Bukkit-efe04b8]
            at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java
    :537) [bukkit.jar:git-Bukkit-efe04b8]
            at java.lang.Thread.run(Unknown Source) [?:1.8.0_91]
    Caused by: org.yaml.snakeyaml.parser.ParserException: while parsing a block mapp
    ing
     in 'string', line 1, column 1:
        frozenmessage: '&cYou've been fr ...
        ^
    expected <block end>, but found Scalar
     in 'string', line 1, column 23:
        frozenmessage: '&cYou've been frozen! Join TeamSpeak 3 ...
                              ^
    
            at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingKey.produce(Par
    serImpl.java:570) ~[bukkit.jar:git-Bukkit-efe04b8]
            at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:158) ~
    [bukkit.jar:git-Bukkit-efe04b8]
            at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:143)
    ~[bukkit.jar:git-Bukkit-efe04b8]
            at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java
    :224) ~[bukkit.jar:git-Bukkit-efe04b8]
            at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:155) ~
    [bukkit.jar:git-Bukkit-efe04b8]
            at org.yaml.snakeyaml.composer.Composer.composeDocument(Composer.java:12
    2) ~[bukkit.jar:git-Bukkit-efe04b8]
            at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:105)
     ~[bukkit.jar:git-Bukkit-efe04b8]
            at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseCons
    tructor.java:120) ~[bukkit.jar:git-Bukkit-efe04b8]
            at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:450) ~[bukkit.jar:gi
    t-Bukkit-efe04b8]
            at org.yaml.snakeyaml.Yaml.load(Yaml.java:369) ~[bukkit.jar:git-Bukkit-e
    fe04b8]
            at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlCo
    nfiguration.java:55) ~[bukkit.jar:git-Bukkit-efe04b8]
            ... 24 more
    [19:16:50 INFO]: [MinkFreeze] Loading MinkFreeze v1.0
    [19:16:50 INFO]: [MinkFreeze] Enabling MinkFreeze v1.0
    [19:16:50 ERROR]: [MinkFreeze] Cannot load configuration from jar
    org.bukkit.configuration.InvalidConfigurationException: while parsing a block ma
    pping
     in 'string', line 1, column 1:
        frozenmessage: '&cYou've been fr ...
        ^
    expected <block end>, but found Scalar
     in 'string', line 1, column 23:
        frozenmessage: '&cYou've been frozen! Join TeamSpeak 3 ...
                              ^
    
            at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlCo
    nfiguration.java:57) ~[bukkit.jar:git-Bukkit-efe04b8]
            at org.bukkit.plugin.java.JavaPlugin.reloadConfig(JavaPlugin.java:214) [
    bukkit.jar:git-Bukkit-efe04b8]
            at me.mink.freeze.Main.onEnable(Main.java:27) [MinkFreeze.jar:?]
            at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) [bu
    kkit.jar:git-Bukkit-efe04b8]
            at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader
    .java:332) [bukkit.jar:git-Bukkit-efe04b8]
            at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManage
    r.java:404) [bukkit.jar:git-Bukkit-efe04b8]
            at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.jav
    a:342) [bukkit.jar:git-Bukkit-efe04b8]
            at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.
    java:314) [bukkit.jar:git-Bukkit-efe04b8]
            at org.bukkit.craftbukkit.v1_8_R3.CraftServer.reload(CraftServer.java:72
    0) [bukkit.jar:git-Bukkit-efe04b8]
            at org.bukkit.Bukkit.reload(Bukkit.java:544) [bukkit.jar:git-Bukkit-efe0
    4b8]
            at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:
    25) [bukkit.jar:git-Bukkit-efe04b8]
            at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:14
    0) [bukkit.jar:git-Bukkit-efe04b8]
            at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServe
    r.java:620) [bukkit.jar:git-Bukkit-efe04b8]
            at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchServerCommand(Craf
    tServer.java:606) [bukkit.jar:git-Bukkit-efe04b8]
            at net.minecraft.server.v1_8_R3.DedicatedServer.aO(DedicatedServer.java:
    372) [bukkit.jar:git-Bukkit-efe04b8]
            at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:3
    36) [bukkit.jar:git-Bukkit-efe04b8]
            at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:6
    29) [bukkit.jar:git-Bukkit-efe04b8]
            at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java
    :537) [bukkit.jar:git-Bukkit-efe04b8]
            at java.lang.Thread.run(Unknown Source) [?:1.8.0_91]
    Caused by: org.yaml.snakeyaml.parser.ParserException: while parsing a block mapp
    ing
     in 'string', line 1, column 1:
        frozenmessage: '&cYou've been fr ...
        ^
    expected <block end>, but found Scalar
     in 'string', line 1, column 23:
        frozenmessage: '&cYou've been frozen! Join TeamSpeak 3 ...
                              ^
    
            at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingKey.produce(Par
    serImpl.java:570) ~[bukkit.jar:git-Bukkit-efe04b8]
            at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:158) ~
    [bukkit.jar:git-Bukkit-efe04b8]
            at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:143)
    ~[bukkit.jar:git-Bukkit-efe04b8]
            at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java
    :224) ~[bukkit.jar:git-Bukkit-efe04b8]
            at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:155) ~
    [bukkit.jar:git-Bukkit-efe04b8]
            at org.yaml.snakeyaml.composer.Composer.composeDocument(Composer.java:12
    2) ~[bukkit.jar:git-Bukkit-efe04b8]
            at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:105)
     ~[bukkit.jar:git-Bukkit-efe04b8]
            at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseCons
    tructor.java:120) ~[bukkit.jar:git-Bukkit-efe04b8]
            at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:450) ~[bukkit.jar:gi
    t-Bukkit-efe04b8]
            at org.yaml.snakeyaml.Yaml.load(Yaml.java:369) ~[bukkit.jar:git-Bukkit-e
    fe04b8]
            at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlCo
    nfiguration.java:55) ~[bukkit.jar:git-Bukkit-efe04b8]
            ... 18 more
    [19:16:50 INFO]: =-=-=-=-=-=-=-=-=-=-=-=-
    [19:16:50 INFO]: =-=-=-=FreezeOpen-=-=-=-
    [19:16:50 INFO]: =-=-=-=-=-=-=-=-=-=-=-=-
    [19:16:50 INFO]: Server permissions file permissions.yml is empty, ignoring it
           
        }
           
        }
    And so I can't seem to find out what's happening. If you need to look at some of the code, Please tell below. The plugin works fine. It's just you have to manually enter config strings as such. Thank you for your help, And time. Regards.
     
  2. Offline

    mine-care

    The issue is a YML syntax error. Can you show us your configuration file?
     
  3. Offline

    Mindlessmink

    @mine-care Sure, This is the config. It's very simple but anyways:

    Code:
    freezeprefix: '&9[&7MinkFreeze&9] '
    frozenmessage: '&cYou have been frozen! Join TeamSpeak within 3 minuted, Log out and you will be banned!'
     
  4. Offline

    bwfcwalshy Retired Staff

    @Mindlessmink You need to escape the character, change it to, '&cYou''ve been fr... '
     
  5. Offline

    Mindlessmink

    @bwfcwalshy what do you mean by "escape the character"? It looks the same to me what you suggested :/
     
  6. Offline

    bwfcwalshy Retired Staff

    @Mindlessmink For every apostrophe that isn't starting or ending the string you need to do 2. '' not '
     
  7. Offline

    Mindlessmink

Thread Status:
Not open for further replies.

Share This Page