whats wrong in this plugin yaml?

Discussion in 'Plugin Development' started by Onzonekid101, Jun 3, 2014.

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


    package me.Nicolas.AstroPlugin;
    import java.util.logging.Logger;
    import org.bukkit.ChatColor;
    import org.bukkit.GameMode;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.inventory.Inventory;
    import org.bukkit.plugin.PluginManager;
    import org.bukkit.plugin.java.JavaPlugin;
    public class AstroPlugin extends JavaPlugin {
    private static final Logger log = Logger.getLogger("Minecraft");
    public void onEnable() {
    log.info("[AstroPlugin] has been enabled!");
    PluginManager pm = getServer().getPluginManager();
    public void onDisable() {
    log.info("[AstroPlugin] has been disabled!");
    public boolean onCommand (CommandSender sender, Command cmd, String label, String[] args) {
    String player = sender.getName();
    Player prayer = (Player) sender;
    String noperm = ChatColor.RED + "You do not have permission to use this command";
    String nocon = ChatColor.RED + "Please do not preform this command from the console";
    if (cmd.getName().equalsIgnoreCase("ping")) {
        if (sender instanceof Player){
    sender.sendMessage(ChatColor.GOLD + "Pong " + player);
        if (!(sender instanceof Player)){
            sender.sendMessage(ChatColor.RED + "Pong Console");
    return true;
    if (cmd.getName().equalsIgnoreCase("superping")) {
        if (sender instanceof Player)
          if (sender.hasPermission("astroplugin.superping")) {
              sender.sendMessage(ChatColor.AQUA + "SUPERPING FOR YOU  " + ChatColor.GOLD + ChatColor.BOLD + player + ChatColor.RED + ChatColor.MAGIC + " lol");
              else if (! sender.hasPermission("astroplugin.superping")) {
        else if (!(sender instanceof Player)) {
            sender.sendMessage(ChatColor.RED + "Please do not preform this command from the console");
    if (cmd.getName().equalsIgnoreCase("gm")) {
        if (!(sender instanceof Player)) {
            sender.sendMessage(ChatColor.RED + "You can not your gamemode in the console");
        if (sender instanceof Player)
            if (sender.hasPermission("astroplugin.gamemode")) {       
        if (args.length == 0) {
            sender.sendMessage(ChatColor.GREEN + "Which gamemode? " + ChatColor.BLUE + "survival, creative , or Adventure");
        if (args.length == 1) {
        if (args[0].equalsIgnoreCase("0")) {
            ((Player) sender).setGameMode(GameMode.SURVIVAL);
            sender.sendMessage(ChatColor.DARK_GREEN + "You have set your gamemode to " + ChatColor.GOLD + "SURVIVAL " + player + ChatColor.AQUA + player);     
        else if (args[0].equalsIgnoreCase("1")) {
                ((Player) sender).setGameMode(GameMode.CREATIVE);
                sender.sendMessage(ChatColor.DARK_GREEN + "You have set your gamemode to " + ChatColor.GOLD + "CREATIVE " + ChatColor.AQUA + player);     
        else if (args[0].equalsIgnoreCase("2")) {
                ((Player) sender).setGameMode(GameMode.ADVENTURE);
                sender.sendMessage(ChatColor.DARK_GREEN + "You have set your gamemode to " + ChatColor.GOLD + "ADVENTURE " + ChatColor.AQUA + player);  }
        else if (! args[0].equalsIgnoreCase("1") || ! args[0].equalsIgnoreCase("2") || ! args[0].equalsIgnoreCase("3")) {
          sender.sendMessage(ChatColor.RED + "Enter a valid gamemode please!");
            else if (! sender.hasPermission("astroplugin.gamemode")) {
                sender.sendMessage(noperm); }
    if (cmd.getName().equalsIgnoreCase("name")) {
        if (sender instanceof Player) {
            if (sender.hasPermission("astroplugin.name")) {
        sender.sendMessage(ChatColor.GOLD + "Your name is " + player); }
            else if (! sender.hasPermission("astroplugin.name")) {
        else if (!(sender instanceof Player)) {
            sender.sendMessage(ChatColor.GOLD + "You are the console DUHHH!");
    if (cmd.getName().equalsIgnoreCase("trash")) {
        if (!(sender instanceof Player)) {
            sender.sendMessage(nocon); }
        if (sender instanceof Player) {
            if (sender.hasPermission("astroplugin.trash")) {
        Inventory inv =
                  getServer().createInventory(prayer, 27, "Trash");
                prayer.openInventory(inv); }
            else if (! sender.hasPermission("astroplugin.trash")) {
    return false;
    1. name: AstroPlugin
    2. version: 1.3
    3. description: The AstroCraft commands!
    4. author: TheMonkeyMining
    5. website: [url]http://www.planetminecraft.com/server/astrocraft-2896996/[/url]
    6. main: me.Nicolas.AstroPlugin.AstroPlugin
    9. permissions:
    10. astroplugin.*:
    11. description: all Astroplugin commands!
    12. astroplugin.superping:
    13. description: superping
    14. astroplugin.gamemode:
    15. description: set your gamemode
    16. astroplugin.name:
    17. description: get your name
    18. astroplugin.trash:
    19. description: disposal command!
    22. commands:
    23. ping:
    24. description: Pong
    25. superping:
    26. description: A SUPER PING!!!!
    27. gm:
    28. description: sets your gamemode!
    29. name:
    30. description: tells you your name!
    31. trash:
    32. description: A disposal Command!

    that was my plugin.yml can someone please help me I get the error in console "Invalid Plugin.yml"

    [edit by JaguarJo: merged posts. Please use the edit option next time to add more information to your post. It keeps things looking neater. Thanks!
  2. Offline


    Onzonekid101 Can you post the full error you have in the console?
  3. Offline


    Onzonekid101 Stop making new threads about the same thing, and please post the full stacktrace of the error.
  4. Offline


    im so sorry everyone it just that noone will answer :'( and i will post the error

    Ok The error says "Could not load 'plugins\AstroPlugin.jar' in folder 'plugins' Invalid plugin.yml"
    I'm sorry I didn't post the actual console its just i dont know how .-.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jun 30, 2016
  5. Offline


    Make sure you plugin.yml is valid. :p

    ps yml file cannot contains tab
  6. Offline


    Step 1. Learn what files you can find wherever you server files are.
    Step 2. Suggest learning Java first
    Step 3. Come back to Bukkit API
    Step 4. [removed]

    [edit by JaguarJo: You can get your point across without resorting to insults. Please keep this discussion friendly. Thank you.]
  7. Offline


    Onzonekid101 Check the logs and post the actual full error, or just post a full startup log of your server on pastebin.com. Just this line of the error is useless and with that we can't help you. In console you could rightclick and use 'select all' and the press enter to copy the text. Then use CTRL+V on pastebin.com and post the link to the past here.

    PS: Delete these things in the code:
    1. log.info("[AstroPlugin] has been enabled!")

    Bukkit will already say your plugin has been enabled. And also don't use the 'Minecraft' logger but just use this.getLogger() to get the logger of your plugin, it will already include a prefix with your plugin name in the message.
  8. Offline


    you are so rude Konkz <:( and yes QxJeremyCx I didn't use tabs. But how do I make the plugin.yml valid?

    ok nlthijs48 here is the error

    Loading libraries, please wait...
    [06:05:06 INFO]: Starting minecraft server version 1.7.9
    [06:05:06 INFO]: Loading properties
    [06:05:06 INFO]: Default game type: SURVIVAL
    [06:05:06 INFO]: Generating keypair
    [06:05:06 INFO]: Starting Minecraft server on *:25565
    [06:05:06 INFO]: This server is running CraftBukkit version git-Bukkit-1.7.2-R0.
    3-66-g43d8943-b3078jnks (MC: 1.7.9) (Implementing API version 1.7.9-R0.1-SNAPSHO
    [06:05:07 ERROR]: Could not load 'plugins\AstroPlugin.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
            at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPlug
    inLoader.java:160) ~[custom.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
            at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager
    .java:133) [custom.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
            at org.bukkit.craftbukkit.v1_7_R3.CraftServer.loadPlugins(CraftServer.ja
    va:357) [custom.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
            at org.bukkit.craftbukkit.v1_7_R3.CraftServer.<init>(CraftServer.java:31
    9) [custom.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
            at net.minecraft.server.v1_7_R3.PlayerList.<init>(PlayerList.java:68) [c
            at net.minecraft.server.v1_7_R3.DedicatedPlayerList.<init>(SourceFile:14
    ) [custom.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
            at net.minecraft.server.v1_7_R3.DedicatedServer.init(DedicatedServer.jav
    a:126) [custom.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
            at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java
    :436) [custom.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
            at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:6
    28) [custom.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
    Caused by: org.yaml.snakeyaml.scanner.ScannerException: while scanning for the n
    ext token; found character      '\t' that cannot start any token
            at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.ja
    va:358) ~[custom.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
            at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:17
    9) ~[custom.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
            at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingKey.produce(Par
    serImpl.java:563) ~[custom.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
            at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:161) ~
            at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:146)
            at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java
    :230) ~[custom.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
            at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:160) ~
            at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java
    :237) ~[custom.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
            at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:160) ~
            at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java
    :237) ~[custom.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
            at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:160) ~
            at org.yaml.snakeyaml.composer.Composer.composeDocument(Composer.java:12
    3) ~[custom.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
            at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:106)
            at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseCons
    tructor.java:121) ~[custom.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
            at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:480) ~[custom.jar:gi
            at org.yaml.snakeyaml.Yaml.load(Yaml.java:411) ~[custom.jar:git-Bukkit-1
            at org.bukkit.plugin.PluginDescriptionFile.<init>(PluginDescriptionFile.
    java:189) ~[custom.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
            at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPlug
    inLoader.java:155) ~[custom.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
            ... 8 more
    [06:05:07 INFO]: Preparing level "world"
    [06:05:07 INFO]: Preparing start region for level 0 (Seed: 5697398473679133859)
    [06:05:07 INFO]: ----- Bukkit Auto Updater -----
    [06:05:07 INFO]: It appears that you're running a Development Build, when you've
    specified in bukkit.yml that you prefer to run Recommended Builds.
    [06:05:07 INFO]: If you would like to be kept informed about new Development Bui
    ld releases, it is recommended that you change 'preferred-channel' in your bukki
    t.yml to 'dev'.
    [06:05:07 INFO]: With that set, you will be told whenever a new version is avail
    able for download, so that you can always keep up to date and secure with the la
    test fixes.
    [06:05:07 INFO]: If you would like to disable this warning, simply set 'suggest-
    channels' to false in bukkit.yml.
    [06:05:07 INFO]: ----- ------------------- -----
    [06:05:08 INFO]: Preparing spawn area: 2%
    [06:05:09 INFO]: Preparing spawn area: 54%
    [06:05:09 INFO]: Preparing start region for level 1 (Seed: 8046695118812766643)
    [06:05:10 INFO]: Preparing spawn area: 60%
    [06:05:11 INFO]: Preparing start region for level 2 (Seed: 8046695118812766643)
    [06:05:11 INFO]: Server permissions file permissions.yml is empty, ignoring it
    [06:05:12 INFO]: Done (5.095s)! For help, type "help" or "?"
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jun 30, 2016
  9. Offline


    Don't use Logger.getLogger("Minecraft")... Don't cast to Player before you have checked if(sender instanceof Player)

    O and you cannot use tabs (that's the \t in the error) in YAML
  10. Offline


    there you go and thanks for teaching me how to do this! :)
  11. Offline


    [removed] Learn Java first. As I've read in other posts (literally 30 sec ago):

    [edit by JaguarJo: Rudeness may not be your intention, but it comes across that way when you use certain phrases. Please try to be considerate of other people's feelings even when you're trying to make a point; then the other person will likely be more receptive towards your advice.]
  12. Offline


  13. Offline


    Once again, basic Java knowledge.

    Player bukkitPlayer = (Player) event.getEntity();
    ^ I made the getEntity 100% into player, if it's a mob then there's a problem...
  14. Offline


    You did
    1. Player prayer = (Player)sender;
    without checking if the sender is a Player. If it was executed from the console, it would've thrown a ClassCastException
  15. Offline


    Onzonekid101 You have a tab in your plugin.yml, check for tabs and replace them with spaces.
  16. Offline


    ok i fixed the tabs but i still get the same error

    and i changed it to what you said fireblast709

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jun 30, 2016
  17. Offline


    Onzonekid101 Please post your new config.yml file here, and indentation included so that I can check if it is correct.
  18. Offline


Thread Status:
Not open for further replies.

Share This Page