Problem scoreboard list config HELP

Discussion in 'Spigot Plugin Development' started by ElbestHD, Jun 5, 2018.

  1. Hello, I have a problem with the scoreboard that I want to do 100% edit in the config.yml and I get some errors in the console will be able to help me

    code:
    Code (Text):
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerJoinEvent;
    import org.bukkit.event.player.PlayerQuitEvent;

    import com.TheEdwardVz.BuildFFA.Main;


    public class Scoreboard
    implements Listener {

       
       
        @EventHandler
        public void onPlayerJoin(PlayerJoinEvent event) {
            Player p = event.getPlayer();
            ScoreHelper helper = ScoreHelper.createScore(p);
            stats sta = stats.getConfig();
            String uuid = p.getUniqueId().toString();
            String kills = sta.getString("Players." + uuid + ".Kills");
            int deaths = sta.getInt("Players." + uuid + ".Deaths");
           
            helper.setTitle(Main.getInstance().getConfig().getString("ScoreBoard").replace("&", "§"));
            helper.setSlot(5, Main.getInstance().getConfig().getString("ScoreBoard.Line5").replace("&", "§"));
            helper.setSlot(4, Main.getInstance().getConfig().getString("ScoreBoard.Line4").replace("&", "§").replace("%player%", p.getName()));
            helper.setSlot(3, Main.getInstance().getConfig().getString("ScoreBoard.Line3").replace("&", "§").replace("%kills%", kills));
            helper.setSlot(2, Main.getInstance().getConfig().getString("ScoreBoard.Line2").replace("&", "§"));
            helper.setSlot(1, Main.getInstance().getConfig().getString("ScoreBoard.Line1").replace("&", "§"));
        }
       
     

        @EventHandler
        public void onPlayerQuit(PlayerQuitEvent event) {
            Player player = event.getPlayer();
            if(ScoreHelper.hasScore(player)) {
                ScoreHelper.removeScore(player);
            }
        }

    }
     
    Error:
    Code (Text):
    [12:39:43 ERROR]: [BuildFFA] Cannot load configuration from jar
    org.bukkit.configuration.InvalidConfigurationException: while parsing a block mapping
    in 'string', line 10, column 1:
        config-version: 3.0
        ^
    expected <block end>, but found BlockMappingStart
    in 'string', line 64, column 4:
           Line5: "&7hola"
           ^

        at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlConfiguration.java:57) ~[spigot1649.jar:git-PaperSpigot-43]
        at org.bukkit.plugin.java.JavaPlugin.reloadConfig(JavaPlugin.java:209) [spigot1649.jar:git-PaperSpigot-43]
        at org.bukkit.plugin.java.JavaPlugin.getConfig(JavaPlugin.java:157) [spigot1649.jar:git-PaperSpigot-43]
        at com.TheEdwardVz.BuildFFA.Main.registerConfig(Main.java:105) [BuildFFA.jar:?]
        at com.TheEdwardVz.BuildFFA.Main.onEnable(Main.java:74) [BuildFFA.jar:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:316) [spigot1649.jar:git-PaperSpigot-43]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:332) [spigot1649.jar:git-PaperSpigot-43]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:412) [spigot1649.jar:git-PaperSpigot-43]
        at org.bukkit.craftbukkit.v1_7_R4.CraftServer.loadPlugin(CraftServer.java:477) [spigot1649.jar:git-PaperSpigot-43]
        at org.bukkit.craftbukkit.v1_7_R4.CraftServer.enablePlugins(CraftServer.java:395) [spigot1649.jar:git-PaperSpigot-43]
        at net.minecraft.server.v1_7_R4.MinecraftServer.n(MinecraftServer.java:354) [spigot1649.jar:git-PaperSpigot-43]
        at net.minecraft.server.v1_7_R4.MinecraftServer.g(MinecraftServer.java:328) [spigot1649.jar:git-PaperSpigot-43]
        at net.minecraft.server.v1_7_R4.MinecraftServer.a(MinecraftServer.java:284) [spigot1649.jar:git-PaperSpigot-43]
        at net.minecraft.server.v1_7_R4.DedicatedServer.init(DedicatedServer.java:227) [spigot1649.jar:git-PaperSpigot-43]
        at net.minecraft.server.v1_7_R4.MinecraftServer.run(MinecraftServer.java:493) [spigot1649.jar:git-PaperSpigot-43]
        at net.minecraft.server.v1_7_R4.ThreadServerApplication.run(SourceFile:628) [spigot1649.jar:git-PaperSpigot-43]
    Caused by: org.yaml.snakeyaml.parser.ParserException: while parsing a block mapping; expected <block end>, but found BlockMappingStart;  in 'string', line 64, column 4:
           Line5: "&7hola"
           ^
        at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingKey.produce(ParserImpl.java:570) ~[spigot1649.jar:git-PaperSpigot-43]
        at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:158) ~[spigot1649.jar:git-PaperSpigot-43]
        at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:143) ~[spigot1649.jar:git-PaperSpigot-43]
        at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:230) ~[spigot1649.jar:git-PaperSpigot-43]
        at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:159) ~[spigot1649.jar:git-PaperSpigot-43]
        at org.yaml.snakeyaml.composer.Composer.composeDocument(Composer.java:122) ~[spigot1649.jar:git-PaperSpigot-43]
        at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:105) ~[spigot1649.jar:git-PaperSpigot-43]
        at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:120) ~[spigot1649.jar:git-PaperSpigot-43]
        at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:481) ~[spigot1649.jar:git-PaperSpigot-43]
        at org.yaml.snakeyaml.Yaml.load(Yaml.java:400) ~[spigot1649.jar:git-PaperSpigot-43]
        at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlConfiguration.java:55) ~[spigot1649.jar:git-PaperSpigot-43]
        ... 15 more
     
  2. maybe show us the config? Or how you set the config
     
  3. And shows us this class com.TheEdwardVz.BuildFFA.Main
     
  4. Maximvdw

    Benefactor

    config problems. Use yamllint
     
  5. A. YAML issue.
    B. Please Stop....
    Rename your Main Class to something more descriptive.
    Pass Instance of your Main class.
    C. NOOOO
     
    #5 KingTux, Jun 5, 2018
    Last edited: Jun 5, 2018
    • Winner Winner x 1