Custom messages from config gets error:

Discussion in 'Plugin Help/Development/Requests' started by MarioNoobProgrammer, Mar 21, 2017.

Thread Status:
Not open for further replies.
  1. I have custom kill messages from my config file. However on start up I get this error:
    Code:
    [00:05:28 ERROR]: [WeedKits] Cannot load configuration from jar
    org.bukkit.configuration.InvalidConfigurationException: while parsing a block mapping
    in 'string', line 2, column 1:
        DEFAULT_KILL_MESSAGE: '&cYou kil ...
        ^
    expected <block end>, but found Scalar
    in 'string', line 11, column 46:
         ... KILLER% &chave ended &e%KILLED%'s &ckillstreak on &e%KILLSTREAK%'
                                             ^
    
            at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlConfiguration.java:57) ~[spigot_server.jar:git-Spigot-c3c767f-33d5de3]
            at org.bukkit.plugin.java.JavaPlugin.reloadConfig(JavaPlugin.java:214) [spigot_server.jar:git-Spigot-c3c767f-33d5de3]
            at org.bukkit.plugin.java.JavaPlugin.getConfig(JavaPlugin.java:162) [spigot_server.jar:git-Spigot-c3c767f-33d5de3]
            at com.creativecode.WeedKits.Main.loadConfiguration(Main.java:110) [WeedKits.jar:?]
            at com.creativecode.WeedKits.Main.onEnable(Main.java:73) [WeedKits.jar:?]
            at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) [spigot_server.jar:git-Spigot-c3c767f-33d5de3]
            at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:335) [spigot_server.jar:git-Spigot-c3c767f-33d5de3]
            at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405) [spigot_server.jar:git-Spigot-c3c767f-33d5de3]
            at org.bukkit.craftbukkit.v1_8_R1.CraftServer.loadPlugin(CraftServer.java:356) [spigot_server.jar:git-Spigot-c3c767f-33d5de3]
            at org.bukkit.craftbukkit.v1_8_R1.CraftServer.enablePlugins(CraftServer.java:316) [spigot_server.jar:git-Spigot-c3c767f-33d5de3]
            at org.bukkit.craftbukkit.v1_8_R1.CraftServer.reload(CraftServer.java:746) [spigot_server.jar:git-Spigot-c3c767f-33d5de3]
            at org.bukkit.Bukkit.reload(Bukkit.java:534) [spigot_server.jar:git-Spigot-c3c767f-33d5de3]
            at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:25) [spigot_server.jar:git-Spigot-c3c767f-33d5de3]
            at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) [spigot_server.jar:git-Spigot-c3c767f-33d5de3]
            at org.bukkit.craftbukkit.v1_8_R1.CraftServer.dispatchCommand(CraftServer.java:646) [spigot_server.jar:git-Spigot-c3c767f-33d5de3]
            at org.bukkit.craftbukkit.v1_8_R1.CraftServer.dispatchServerCommand(CraftServer.java:632) [spigot_server.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.DedicatedServer.aM(DedicatedServer.java:353) [spigot_server.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.DedicatedServer.z(DedicatedServer.java:317) [spigot_server.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.MinecraftServer.y(MinecraftServer.java:634) [spigot_server.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.MinecraftServer.run(MinecraftServer.java:537) [spigot_server.jar:git-Spigot-c3c767f-33d5de3]
            at java.lang.Thread.run(Unknown Source) [?:1.8.0_101]
    Caused by: org.yaml.snakeyaml.parser.ParserException: while parsing a block mapping
    in 'string', line 2, column 1:
        DEFAULT_KILL_MESSAGE: '&cYou kil ...
        ^
    expected <block end>, but found Scalar
    in 'string', line 11, column 46:
         ... KILLER% &chave ended &e%KILLED%'s &ckillstreak on &e%KILLSTREAK%'
                                             ^
    
            at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingKey.produce(ParserImpl.java:570) ~[spigot_server.jar:git-Spigot-c3c767f-33d5de3]
            at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:158) ~[spigot_server.jar:git-Spigot-c3c767f-33d5de3]
            at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:143) ~[spigot_server.jar:git-Spigot-c3c767f-33d5de3]
            at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:226) ~[spigot_server.jar:git-Spigot-c3c767f-33d5de3]
            at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:155) ~[spigot_server.jar:git-Spigot-c3c767f-33d5de3]
            at org.yaml.snakeyaml.composer.Composer.composeDocument(Composer.java:122) ~[spigot_server.jar:git-Spigot-c3c767f-33d5de3]
            at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:105) ~[spigot_server.jar:git-Spigot-c3c767f-33d5de3]
            at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:120) ~[spigot_server.jar:git-Spigot-c3c767f-33d5de3]
            at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:481) ~[spigot_server.jar:git-Spigot-c3c767f-33d5de3]
            at org.yaml.snakeyaml.Yaml.load(Yaml.java:400) ~[spigot_server.jar:git-Spigot-c3c767f-33d5de3]
            at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlConfiguration.java:55) ~[spigot_server.jar:git-Spigot-c3c767f-33d5de3]
            ... 20 more
    [00:05:28 INFO]: [WorldEdit] Enabling WorldEdit v6.0;3342-78f975b9
    [00:05:28 ERROR]: [PermissionsEx] The updater could not contact dev.bukkit.org for updating.
    [00:05:28 ERROR]: [PermissionsEx] If you have not recently modified your configuration and this is the first time you are seeing this message, the site may be experiencing temporary downtime.
    [00:05:28 ERROR]: [PermissionsEx] null
    java.io.IOException: Server returned HTTP response code: 521 for URL: https://api.curseforge.com/servermods/files?projectIds=31279
            at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source) ~[?:1.8.0_101]
            at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) ~[?:1.8.0_101]
            at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source) ~[?:1.8.0_101]
            at ru.tehkode.libs.net.gravitydevelopment.updater.Updater.read(Updater.java:643) [PermissionsEx-1.23.4.jar:?]
            at ru.tehkode.libs.net.gravitydevelopment.updater.Updater.runUpdater(Updater.java:718) [PermissionsEx-1.23.4.jar:?]
            at ru.tehkode.libs.net.gravitydevelopment.updater.Updater.access$100(Updater.java:36) [PermissionsEx-1.23.4.jar:?]
            at ru.tehkode.libs.net.gravitydevelopment.updater.Updater$UpdateRunnable.run(Updater.java:713) [PermissionsEx-1.23.4.jar:?]
            at java.lang.Thread.run(Unknown Source) [?:1.8.0_101]
    This is an example of a line where I set one of the messages:
    Code:
    Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', Main.plugin.getConfig().getString("Every_5_Kill").replace("%KILLER%", killer.getName()).replace("%KILLSTREAK%", String.valueOf(main.getPlayers().get(killer.getUniqueId()).getKillstreak()))));
    My config.yml
    Code:
    #Use %KILLED% to get the name of the person killed.
    DEFAULT_KILL_MESSAGE: '&cYou killed &f%KILLED% &cand gained &e50 coins!'
    VIP_KILL_MESSAGE: '&cYou killed &f%KILLED% &cand gained &e75 coins!'
    MVP_KILL_MESSAGE: '&cYou killed &f%KILLED% &cand gained &e100 coins!'
    ELITE_KILL_MESSAGE: '&cYou killed &f%KILLED% &cand gained &e125 coins!'
    OP_KILL_MESSAGE: '&cYou killed &f%KILLED% &cand gained &e125 coins!'
    
    #Use %KILLER% to get the killer's name and %KILLSTREAK% to get the killstreak
    Every_5_Kill: '&c%KILLER% has a killstreak on &e%KILLSTREAK%'
    #Use %KILLER% to get the killer's name, use %KILLED% to get the killed's name and %KILLSTREAK% to get the killstreak
    Lost_KS: '&e%KILLER% &chave ended &e%KILLED%'s &ckillstreak on &e%KILLSTREAK%'
    Why wont I recive the custom messages and why do I get the error?
     
  2. Offline

    theone1000

    Try changing
    Code:
    Lost_KS: '&e%KILLER% &chave ended &e%KILLED%'s &ckillstreak on &e%KILLSTREAK%'
    to
    Code:
    Lost_KS: '&e%KILLER% &chave ended &e%KILLED%''s &ckillstreak on &e%KILLSTREAK%'
    That should fix the error.
     
  3. @theone1000

    Thanks that fixed it :p I re-did the entire deathevent so many times just for this one line in the config :p

    Anyways, im also wondering why these dont get generated inside my config?
    #Use %KILLED% to get the name of the person killed.

    They used to get created, however now they dont.
     
Thread Status:
Not open for further replies.

Share This Page