Solved Config Problem

Discussion in 'Plugin Development' started by tkuiyeager1, Sep 17, 2015.

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

    tkuiyeager1

    I'm trying to make %player% be replaced with player name in the config.
    Code:
    [17:13:28 ERROR]: [JoinTeleport] Cannot load configuration from jar
    org.bukkit.configuration.InvalidConfigurationException: while scanning for the n
    ext token
    found character % '%' that cannot start any token. (Do not use % for indentation
    )
    in 'string', line 7, column 16:
        JoinMessage: &b%player% Joiend The Server.
                       ^
    
            at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlCo
    nfiguration.java:57) ~[spigot.jar:git-Spigot-f928e7a-f27339c]
            at org.bukkit.plugin.java.JavaPlugin.reloadConfig(JavaPlugin.java:214) [
    spigot.jar:git-Spigot-f928e7a-f27339c]
            at org.bukkit.plugin.java.JavaPlugin.getConfig(JavaPlugin.java:162) [spi
    got.jar:git-Spigot-f928e7a-f27339c]
            at me.TKUIYEAGER1.JoinTeleport.Main.onEnable(Main.java:18) [JoinTeleport
    .jar:?]
            at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) [sp
    igot.jar:git-Spigot-f928e7a-f27339c]
            at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader
    .java:340) [spigot.jar:git-Spigot-f928e7a-f27339c]
            at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManage
    r.java:405) [spigot.jar:git-Spigot-f928e7a-f27339c]
            at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.jav
    a:356) [spigot.jar:git-Spigot-f928e7a-f27339c]
            at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.
    java:316) [spigot.jar:git-Spigot-f928e7a-f27339c]
            at org.bukkit.craftbukkit.v1_8_R3.CraftServer.reload(CraftServer.java:74
    2) [spigot.jar:git-Spigot-f928e7a-f27339c]
            at org.bukkit.Bukkit.reload(Bukkit.java:534) [spigot.jar:git-Spigot-f928
    e7a-f27339c]
            at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:
    25) [spigot.jar:git-Spigot-f928e7a-f27339c]
            at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:14
    1) [spigot.jar:git-Spigot-f928e7a-f27339c]
            at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServe
    r.java:642) [spigot.jar:git-Spigot-f928e7a-f27339c]
            at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchServerCommand(Craf
    tServer.java:628) [spigot.jar:git-Spigot-f928e7a-f27339c]
            at net.minecraft.server.v1_8_R3.DedicatedServer.aO(DedicatedServer.java:
    404) [spigot.jar:git-Spigot-f928e7a-f27339c]
            at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:3
    68) [spigot.jar:git-Spigot-f928e7a-f27339c]
            at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:6
    57) [spigot.jar:git-Spigot-f928e7a-f27339c]
            at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java
    :560) [spigot.jar:git-Spigot-f928e7a-f27339c]
            at java.lang.Thread.run(Unknown Source) [?:1.8.0_60]
    Caused by: org.yaml.snakeyaml.scanner.ScannerException: while scanning for the n
    ext token
    found character % '%' that cannot start any token. (Do not use % for indentation
    )
    in 'string', line 7, column 16:
        JoinMessage: &b%player% Joiend The Server.
                       ^
    
            at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.ja
    va:420) ~[spigot.jar:git-Spigot-f928e7a-f27339c]
            at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:22
    6) ~[spigot.jar:git-Spigot-f928e7a-f27339c]
            at org.yaml.snakeyaml.parser.ParserImpl.parseNode(ParserImpl.java:388) ~
    [spigot.jar:git-Spigot-f928e7a-f27339c]
            at org.yaml.snakeyaml.parser.ParserImpl.parseBlockNodeOrIndentlessSequen
    ce(ParserImpl.java:368) ~[spigot.jar:git-Spigot-f928e7a-f27339c]
            at org.yaml.snakeyaml.parser.ParserImpl.access$2300(ParserImpl.java:116)
    ~[spigot.jar:git-Spigot-f928e7a-f27339c]
            at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingValue.produce(P
    arserImpl.java:588) ~[spigot.jar:git-Spigot-f928e7a-f27339c]
            at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:158) ~
    [spigot.jar:git-Spigot-f928e7a-f27339c]
            at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:143)
    ~[spigot.jar:git-Spigot-f928e7a-f27339c]
            at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:132) ~
    [spigot.jar:git-Spigot-f928e7a-f27339c]
            at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java
    :229) ~[spigot.jar:git-Spigot-f928e7a-f27339c]
            at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:155) ~
    [spigot.jar:git-Spigot-f928e7a-f27339c]
            at org.yaml.snakeyaml.composer.Composer.composeDocument(Composer.java:12
    2) ~[spigot.jar:git-Spigot-f928e7a-f27339c]
            at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:105)
    ~[spigot.jar:git-Spigot-f928e7a-f27339c]
            at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseCons
    tructor.java:120) ~[spigot.jar:git-Spigot-f928e7a-f27339c]
            at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:450) ~[spigot.jar:gi
    t-Spigot-f928e7a-f27339c]
            at org.yaml.snakeyaml.Yaml.load(Yaml.java:369) ~[spigot.jar:git-Spigot-f
    928e7a-f27339c]
            at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlCo
    nfiguration.java:55) ~[spigot.jar:git-Spigot-f928e7a-f27339c]
            ... 19 more
    please help me to fix this problem
     
  2. I've had a similar problem in the past. Use <player> instead, and the issue should be fixed.
     
  3. @tkuiyeager1
    Just a tip: It's easier for an issue to be solved when you post your code( + config in this case).
     
  4. Offline

    tkuiyeager1

    config line:
    Code:
    JoinMessage: &b%player% Joiend The Server.
    code:
    got this from an forum post in the bukkit dev
    Code:
    String joinmessage = getConfig().getString("JoinMessage").replaceAll("%player", e.getPlayer().getName());
    @0ct0berBkkitPlgins its the same problem with: <> and &.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 11, 2016
  5. @tkuiyeager1
    Use .replace instead of .replaceAll. String#replaceAll checks for "regular expressions" while String#replace just replaces plain text. Stuff like %, <> are special characters in replaceAll. Also, try putting the config string in quotes
     
  6. Offline

    tkuiyeager1

    It's still doesnt work, i changed it to replace.
    code:
    Code:
    String joinmessage = getConfig().getString("JoinMessage").replace("<player>", e.getPlayer().getName());
    Error:
    Edit: I put the correct error and correct code
     
  7. @tkuiyeager1
     
  8. Offline

    tkuiyeager1

    here is the line of the config:
     
  9. Offline

    Binner_Done

    As
    @megamichiel said I think it is because your config file hasn't got quotes in the JoinMessage bit, try adding them and see what happens
     
  10. Offline

    tkuiyeager1

Thread Status:
Not open for further replies.

Share This Page