join message bug! help me

Discussion in 'BungeeCord Plugin Help' started by Deiutz, May 27, 2017.

  1. I have this bug in console... i think its from config. can you help me?


    Code (Text):
    [15:25:51 INFO]:
    [15:28:57] [Server thread/ERROR]: [JoinMessage] Cannot load configuration from jar
    org.bukkit.configuration.InvalidConfigurationException: Top level is not a Map.
        at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlConfiguration.java:59) ~[spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52]
        at org.bukkit.plugin.java.JavaPlugin.reloadConfig(JavaPlugin.java:214) [spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52]
        at org.bukkit.plugin.java.JavaPlugin.getConfig(JavaPlugin.java:162) [spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52]
        at ro.deiutz.joinmessage.Main.onEnable(Main.java:20) [WelcomeMessage.jar:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) [spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:340) [spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405) [spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:357) [spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:317) [spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52]
        at net.minecraft.server.v1_8_R3.MinecraftServer.s(MinecraftServer.java:414) [spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52]
        at net.minecraft.server.v1_8_R3.MinecraftServer.k(MinecraftServer.java:378) [spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52]
        at net.minecraft.server.v1_8_R3.MinecraftServer.a(MinecraftServer.java:333) [spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52]
        at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:263) [spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52]
        at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:525) [spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_131]
     

    Code (Text):
    package ro.deiutz.joinmessage;


    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerJoinEvent;
    import org.bukkit.plugin.java.JavaPlugin;

    public class Main extends JavaPlugin implements Listener {

        @Override
        public void onEnable() {
       
            getLogger().info("JoinMessage has been Enabled");
       
            Bukkit.getPluginManager().registerEvents(this, this);
            getConfig().options().copyDefaults(true);
            saveConfig();
       
        }

        @Override
        public void onDisable() {
       
            getLogger().info("JoinMessage has been Disabled");
       
       
        }
        @EventHandler
        public void JoinPlayer(PlayerJoinEvent e) {
       
            Player p = e.getPlayer();
            p.sendMessage(getConfig().getString(ChatColor.translateAlternateColorCodes('&', "Message")));
        }

    }
    Code (Text):
    #Join Message File
    #1.0
    Message: '&5welcome to server!'
    /SPOILER]
     
    #1 Deiutz, May 27, 2017
    Last edited: May 27, 2017
  2. electronicboy

    IRC Staff

    add a new line between the header of the config and the Message:

    also, getString returns a string from the config that you pass to it, calling translate... on that isn't going to get you anywhere, you need to translate the returned string of that method
     
  3. aaa i am new in coding :)) pls translate me :))