Correct plugin.yml?

Discussion in 'Plugin Development' started by Eliteninja42, Jul 25, 2013.

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

    Eliteninja42

    Hello bukkit forums, my server gives me an error about it can not find the plugin.yml in my plugin and I was wondering if I completed my plugin.yml file correctly.

    It looks like this:

    name: SmartSmelt
    main: com.gmail.eliteninja42.SmartSmelt.SmartSmelt
    version: 1.0
    author: EliteNinja42

    commands:
    smelt:
    description: Smelts the ore/food in a player's hand at the time of when the command was given.
    usage: /smelt
    permission: SmartSmelt.smelt

    permissions:
    SmartSmelt.smelt:
    description: Smelts the ore/food in a player's hand at the time of when the command was given.
    default: op
    permission-message: Your character does not contain the qualities to execute this command.



    Is this correct?

    Thanks ahead of time.
     
  2. Offline

    Bammerbom

    Eliteninja42 Please use "Code field" for this.
    Otherways i can't see spaces
     
  3. Offline

    Eliteninja42

    Code:
    name: SmartSmelt
    main: com.gmail.eliteninja42.SmartSmelt.SmartSmelt
    version: 1.0
    author: EliteNinja42
     
        commands:
            smelt:
            description: Smelts the ore/food in a player's hand at the time of when the command was given.
            usage: /smelt
            permission: SmartSmelt.smelt
           
        permissions:
            SmartSmelt.smelt:
                description: Smelts the ore/food in a player's hand at the time of when the command was given.
                default: op
                permission-message: Your character does not contain the qualities to execute this command.
    
     
  4. Offline

    etaxi341

    Eliteninja42 Your plugin.yml needs to be in src and not in your package. thats the problem of the most not working plugin.yml's
     
  5. Offline

    xTrollxDudex

    Eliteninja42
    Remeber to not use tabs but purely spaces alone.
     
  6. Offline

    Eliteninja42

    etaxi341 My plugin.yml is not in my package but it is in my source.
    xTrollxDudex I will change the tabs to spaces, and may I ask why I should not use tabs?
     
  7. Offline

    xTrollxDudex

    Eliteninja42
    The plugin.yml is translated as a YAML file, YAML has special syntax and does not allow tabs. It was only Bukkit's decision to use YAML, not decide on whether to use spaces or not.
     
  8. Offline

    Eliteninja42

    xTrollxDudex I removed all tabs and inserted spaces, however my console gives me an error saying it couldn't load the plugin because of a incorrect plugin.yml. Any other suggestions?
     
  9. Offline

    xTrollxDudex

  10. Offline

    Eliteninja42

    Code:
    16:41:23 [INFO] Starting minecraft server version 1.6.2
    16:41:23 [INFO] Loading properties
    16:41:23 [INFO] Default game type: SURVIVAL
    16:41:23 [INFO] Generating keypair
    16:41:23 [INFO] Starting Minecraft server on *:25565
    16:41:23 [INFO] This server is running CraftBukkit version git-Bukkit-1.5.2-R1.0
    -25-g2a13a5a-b2812jnks (MC: 1.6.2) (Implementing API version 1.6.2-R0.1-SNAPSHOT
    )
    16:41:23 [SEVERE] Could not load 'plugins\SmartSmelt.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
            at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPlug
    inLoader.java:257)
            at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager
    .java:132)
            at org.bukkit.craftbukkit.v1_6_R2.CraftServer.loadPlugins(CraftServer.ja
    va:239)
            at org.bukkit.craftbukkit.v1_6_R2.CraftServer.<init>(CraftServer.java:21
    7)
            at net.minecraft.server.v1_6_R2.PlayerList.<init>(PlayerList.java:56)
            at net.minecraft.server.v1_6_R2.DedicatedPlayerList.<init>(SourceFile:11
    )
            at net.minecraft.server.v1_6_R2.DedicatedServer.init(DedicatedServer.jav
    a:106)
            at net.minecraft.server.v1_6_R2.MinecraftServer.run(MinecraftServer.java
    :391)
            at net.minecraft.server.v1_6_R2.ThreadServerApplication.run(SourceFile:5
    82)
    Caused by: while scanning for the next token
    found character        '\t' that cannot start any token
    in "<reader>", line 6, column 1:
            commands:
        ^
     
            at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.ja
    va:358)
            at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:17
    9)
            at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingKey.produce(Par
    serImpl.java:563)
            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)
            at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:160)
            at org.yaml.snakeyaml.composer.Composer.composeDocument(Composer.java:12
    3)
            at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:106)
     
            at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseCons
    tructor.java:121)
            at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:480)
            at org.yaml.snakeyaml.Yaml.load(Yaml.java:411)
            at org.bukkit.plugin.PluginDescriptionFile.<init>(PluginDescriptionFile.
    java:188)
            at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPlug
    inLoader.java:252)
            ... 8 more
    xTrollxDudex
     
  11. Offline

    xTrollxDudex

    Eliteninja42
    You still have a tab in there at the commands line.
     
  12. Offline

    Eliteninja42

  13. Offline

    xTrollxDudex

    Eliteninja42
    PHP:
    nameSmartSmelt
    main
    com.gmail.eliteninja42.SmartSmelt.SmartSmelt
    version
    1.0
    author
    EliteNinja42
    commands
    :
       
    smelt:
          
    descriptionSmelts the ore/food in a player's hand at the time of when the command was given.
          usage: /smelt
          permission: SmartSmelt.smelt
          permission-message: Your character does not contain the qualities to execute this command.
    permissions:
       SmartSmelt.smelt:
          description: Smelts the ore/food in a player'
    s hand at the time of when the command was given.
          default: 
    op
    Try this
     
  14. Offline

    Eliteninja42

    I now get this message.
    Code:
    >17:27:03 [INFO] Starting minecraft server version 1.6.2
    17:27:03 [INFO] Loading properties
    17:27:03 [INFO] Default game type: SURVIVAL
    17:27:03 [INFO] Generating keypair
    17:27:04 [INFO] Starting Minecraft server on *:25565
    17:27:06 [INFO] This server is running CraftBukkit version git-Bukkit-1.5.2-R1.0
    -25-g2a13a5a-b2812jnks (MC: 1.6.2) (Implementing API version 1.6.2-R0.1-SNAPSHOT
    )
    17:27:06 [SEVERE] Could not load 'plugins\SmartSmelt.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidDescriptionException: commands are of wrong type
            at org.bukkit.plugin.PluginDescriptionFile.loadMap(PluginDescriptionFile
    .java:849)
            at org.bukkit.plugin.PluginDescriptionFile.<init>(PluginDescriptionFile.
    java:188)
            at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPlug
    inLoader.java:252)
            at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager
    .java:132)
            at org.bukkit.craftbukkit.v1_6_R2.CraftServer.loadPlugins(CraftServer.ja
    va:239)
            at org.bukkit.craftbukkit.v1_6_R2.CraftServer.<init>(CraftServer.java:21
    7)
            at net.minecraft.server.v1_6_R2.PlayerList.<init>(PlayerList.java:56)
            at net.minecraft.server.v1_6_R2.DedicatedPlayerList.<init>(SourceFile:11
    )
            at net.minecraft.server.v1_6_R2.DedicatedServer.init(DedicatedServer.jav
    a:106)
            at net.minecraft.server.v1_6_R2.MinecraftServer.run(MinecraftServer.java
    :391)
            at net.minecraft.server.v1_6_R2.ThreadServerApplication.run(SourceFile:5
    82)
    Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java
    .util.Map
            at org.bukkit.plugin.PluginDescriptionFile.loadMap(PluginDescriptionFile
    .java:831)
            ... 10 more
    xTrollxDudex
     
  15. Offline

    xTrollxDudex

  16. Offline

    Samthelord1

    From when does in need to be in the src? It needs to be a dependant file in the SmartSmelt
     
  17. Offline

    Eliteninja42

    xTrollxDudex I did refresh the page and used what you entered the console that i entered was what showed up.
     
  18. Offline

    Samthelord1

    Where is your plugin.yml?
     
  19. Offline

    xTrollxDudex

  20. Offline

    Samthelord1

    Which one?
     
  21. Offline

    Eliteninja42

    Samthelord1 My plugin.yml is in the java project folder but not in any package

    xTrollxDudex
    Code:
    19:19:02 [SEVERE] Could not load 'plugins\SmartSmelt.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: java.lang.ClassNotFoundException: com.
    gmail.eliteninja42.SmartSmelt.SmartSmelt
            at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.j
    ava:184)
            at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.
    java:305)
            at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager
    .java:230)
            at org.bukkit.craftbukkit.v1_6_R2.CraftServer.loadPlugins(CraftServer.ja
    va:239)
            at org.bukkit.craftbukkit.v1_6_R2.CraftServer.<init>(CraftServer.java:21
    7)
            at net.minecraft.server.v1_6_R2.PlayerList.<init>(PlayerList.java:56)
            at net.minecraft.server.v1_6_R2.DedicatedPlayerList.<init>(SourceFile:11
    )
            at net.minecraft.server.v1_6_R2.DedicatedServer.init(DedicatedServer.jav
    a:106)
            at net.minecraft.server.v1_6_R2.MinecraftServer.run(MinecraftServer.java
    :391)
            at net.minecraft.server.v1_6_R2.ThreadServerApplication.run(SourceFile:5
    82)
    Caused by: java.lang.ClassNotFoundException: com.gmail.eliteninja42.SmartSmelt.S
    martSmelt
            at java.net.URLClassLoader$1.run(Unknown Source)
            at java.net.URLClassLoader$1.run(Unknown Source)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(Unknown Source)
            at org.bukkit.plugin.java.PluginClassLoader.findClass0(PluginClassLoader
    .java:80)
            at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.
    java:53)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at java.lang.Class.forName0(Native Method)
            at java.lang.Class.forName(Unknown Source)
            at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.j
    ava:173)
            ... 9 more
    Is it possible i'm not exporting correctly or it is located in the wrong place?

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

    Samthelord1

    Post your class(es) I'm awaiting nub mistake.
     
  23. Offline

    Eliteninja42

    Code:
    package com.gmail.eliteninja42;
     
    import java.util.logging.Logger;
     
    import org.bukkit.Color;
    import org.bukkit.Material;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.material.Command;
    import org.bukkit.plugin.PluginDescriptionFile;
    import org.bukkit.plugin.java.JavaPlugin;
     
    public final class SmartSmelt extends JavaPlugin {
        public final Logger logger = Logger.getLogger("Minecraft");
        public static SmartSmelt plugin;
       
        @Override
        public void onDisable() {
            PluginDescriptionFile pdfFile = this.getDescription();
            this.logger.info(pdfFile.getName() + " Has Been Disabled!");
        }
       
        @Override
        public void onEnable() {
            PluginDescriptionFile pdfFile = this.getDescription();
            this.logger.info(pdfFile.getName() + " Version " + pdfFile.getVersion() + " Has Been Enabled!");
        }
       
        public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
            Player player = (Player) sender;
           
            if (commandLabel.equalsIgnoreCase("smelt")){
                if (player.getItemInHand().getType() == Material.IRON_ORE){
                    ItemStack iron = player.getInventory().getItemInHand();
                    int amount = iron.getAmount();
                    ItemStack smelt = new ItemStack(Material.IRON_INGOT, amount);
                    player.getInventory().setItemInHand(smelt);
                    player.sendMessage(Color.GREEN + "Your Iron Ore has been smelted!");
                   
                }else if (player.getItemInHand().getType() == Material.GOLD_ORE){
                    ItemStack gold = player.getInventory().getItemInHand();
                    int amount = gold.getAmount();
                    ItemStack smelt = new ItemStack(Material.GOLD_INGOT, amount);
                    player.getInventory().setItemInHand(smelt);
                    player.sendMessage(Color.GREEN + "Your Gold Ore has been smelted!");
                   
                }else if (player.getItemInHand().getType() == Material.DIAMOND_ORE){
                    ItemStack diamond = player.getInventory().getItemInHand();
                    int amount = diamond.getAmount();
                    ItemStack smelt = new ItemStack(Material.DIAMOND, amount);
                    player.getInventory().setItemInHand(smelt);
                    player.sendMessage(Color.GREEN + "Your Diamond Ore has been smelted!");
                   
                }else if (player.getItemInHand().getType() == Material.REDSTONE_ORE){
                    ItemStack redstone = player.getInventory().getItemInHand();
                    int amount = redstone.getAmount();
                    ItemStack smelt = new ItemStack(Material.REDSTONE, amount);
                    player.getInventory().setItemInHand(smelt);
                    player.sendMessage(Color.GREEN + "Your Redstone Ore has been smelted!");
                   
            }else if (player.getItemInHand().getType() == Material.COAL_ORE){
                ItemStack coal = player.getInventory().getItemInHand();
                int amount = coal.getAmount();
                ItemStack smelt = new ItemStack(Material.COAL, amount);
                player.getInventory().setItemInHand(smelt);
                player.sendMessage(Color.GREEN + "Your Coal Ore has been smelted!");
               
            }else if(player.getItemInHand().getType() == Material.EMERALD_ORE){
                ItemStack emerald = player.getInventory().getItemInHand();
                int amount = emerald.getAmount();
                ItemStack smelt = new ItemStack(Material.EMERALD, amount);
                player.getInventory().setItemInHand(smelt);
                player.sendMessage(Color.GREEN + "Your Emerald Ore has been smelted!");
               
            }else if(player.getItemInHand().getType() == Material.QUARTZ_ORE){
                ItemStack quartz = player.getInventory().getItemInHand();
                int amount = quartz.getAmount();
                ItemStack smelt = new ItemStack(Material.QUARTZ, amount);
                player.getInventory().setItemInHand(smelt);
                player.sendMessage(Color.GREEN + "Your Quartz Ore has been smelted!");
               
            }else if (player.getItemInHand().getType() == Material.RAW_BEEF){
                ItemStack beef = player.getInventory().getItemInHand();
                int amount = beef.getAmount();
                ItemStack smelt = new ItemStack(Material.COOKED_BEEF, amount);
                player.getInventory().setItemInHand(smelt);
                player.sendMessage(Color.GREEN + "Your Raw Beef has been smelted!");
               
            }else if (player.getItemInHand().getType() == Material.RAW_CHICKEN){
                ItemStack chicken = player.getInventory().getItemInHand();
                int amount = chicken.getAmount();
                ItemStack smelt = new ItemStack(Material.COOKED_CHICKEN, amount);
                player.getInventory().setItemInHand(smelt);
                player.sendMessage(Color.GREEN + "Your Raw Chicken has been smelted!");
               
            }else if (player.getItemInHand().getType() == Material.LAPIS_ORE){
                ItemStack lapis = player.getInventory().getItemInHand();
                int amount = lapis.getAmount();
                ItemStack smelt = new ItemStack(Material.INK_SACK, amount, (byte)4);
                player.getInventory().setItemInHand(smelt);
                player.sendMessage(Color.GREEN + "Your Lapis Lazuli Ore has been smelted!");
               
            }else if (player.getItemInHand().getType() == Material.PORK){
                ItemStack pork = player.getInventory().getItemInHand();
                int amount = pork.getAmount();
                ItemStack smelt = new ItemStack(Material.GRILLED_PORK, amount);
                player.getInventory().setItemInHand(smelt);
                player.sendMessage(Color.GREEN + "Your Raw Pork has been smelted!");
               
            }else if (player.getItemInHand().getType() == Material.RAW_FISH){
                ItemStack fish = player.getInventory().getItemInHand();
                int amount = fish.getAmount();
                ItemStack smelt = new ItemStack(Material.COOKED_FISH, amount);
                player.getInventory().setItemInHand(smelt);
                player.sendMessage(Color.GREEN + "Your Raw Fish has been smelted!");
               
            }else if (player.getItemInHand().getType() == Material.POTATO){
                ItemStack potato = player.getInventory().getItemInHand();
                int amount = potato.getAmount();
                ItemStack smelt = new ItemStack(Material.BAKED_POTATO, amount);
                player.getInventory().setItemInHand(smelt);
                player.sendMessage(Color.GREEN + "Your Potato has been smelted!");
           
            }else if (player.getItemInHand().getType() == Material.WOOD){
                ItemStack wood = player.getInventory().getItemInHand();
                int amount = wood.getAmount();
                ItemStack smelt = new ItemStack(Material.COAL, amount, (short)1);
                player.getInventory().setItemInHand(smelt);
                player.sendMessage(Color.GREEN + "Your Wood has been smelted!");
           
            }else if (player.getItemInHand().getType() == Material.CACTUS){
                ItemStack cactus = player.getInventory().getItemInHand();
                int amount = cactus.getAmount();
                ItemStack smelt = new ItemStack(Material.INK_SACK, amount, (byte)2);
                player.getInventory().setItemInHand(smelt);
                player.sendMessage(Color.GREEN + "Your Cactus has been smelted!");
           
            }else if (player.getItemInHand().getType() == Material.SAND){
                ItemStack sand = player.getInventory().getItemInHand();
                int amount = sand.getAmount();
                ItemStack smelt = new ItemStack(Material.GLASS, amount);
                player.getInventory().setItemInHand(smelt);
                player.sendMessage(Color.GREEN + "Your Sand has been smelted!");
               
            }else if (player.getItemInHand().getType() == Material.COBBLESTONE){
                ItemStack cobblestone = player.getInventory().getItemInHand();
                int amount = cobblestone.getAmount();
                ItemStack smelt = new ItemStack(Material.STONE, amount);
                player.getInventory().setItemInHand(smelt);
                player.sendMessage(Color.GREEN + "Your Cobblestone has been smelted!");
               
            }else if (player.getItemInHand().getType() == Material.CLAY_BALL){
                ItemStack clay = player.getInventory().getItemInHand();
                int amount = clay.getAmount();
                ItemStack smelt = new ItemStack(Material.BRICK, amount);
                player.getInventory().setItemInHand(smelt);
                player.sendMessage(Color.GREEN + "Your Clay has been smelted!");
       
            }else if (player.getItemInHand().getType() == Material.NETHERRACK){
                ItemStack nether = player.getInventory().getItemInHand();
                int amount = nether.getAmount();
                ItemStack smelt = new ItemStack(Material.NETHER_BRICK, amount);
                player.getInventory().setItemInHand(smelt);
                player.sendMessage(Color.GREEN + "Your Netherrack has been smelted!");
           
            }else if (player.getItemInHand().getType() == Material.CLAY){
                ItemStack beef = player.getInventory().getItemInHand();
                int amount = beef.getAmount();
                ItemStack smelt = new ItemStack(Material.HARD_CLAY, amount);
                player.getInventory().setItemInHand(smelt);
                player.sendMessage(Color.GREEN + "Your Clay Block has been smelted!");
               
            }else if (player.getItemInHand().getType() == Material.AIR){
                player.sendMessage(Color.GREEN + "Your hand appears to be empty!");
            }
                {
               
            return false;
        }
            }
            return false;
        }
    }
       
               
           
           
     
     
    
    Samthelord1 It's not really the most efficient way I think, and to tell the truth i'm not entirely sure this is going to work, but this is my first plugin.
     
  24. Offline

    Samthelord1

    Your plugin isn't implementing commandexecutor
     
  25. Offline

    Eliteninja42

  26. Offline

    xTrollxDudex

    Samthelord1
    It doesn't need to, it is inherited from JavaPlugin
     
  27. Offline

    Samthelord1

    It was me who made the nub mistake :p and if I'm right, else ifs aren't needed, just pure out if's although it won't make a diff
     
  28. Offline

    Eliteninja42

    Samthelord1 I still get errors with my plugin.yml file though and without that working I cannot use the plugin. Any more suggestions?
     
  29. Offline

    Samthelord1

    Maybe use this as your plugin.yml test If it makes any diff (sorry for cutting end off)
    name: SmartSmelt
    main: com.gmail.eliteninja42.SmartSmelt.SmartSmelt
    version: 1.0
    author: EliteNinja42
    commands:
    smelt:
    description: Smelts the ore/food in a player's hand at the time of when the command was given.
    usage: /smelt
    permission: SmartSmelt.smelt
    permission-message: Your character does not contain the
     
  30. Offline

    Eliteninja42

    Samthelord1 xTrollxDudex I fixed the problem I added one to many SmartSmelts on the main:
    Thank you both for your help, I appreciate it greatly!
     
    xTrollxDudex likes this.
Thread Status:
Not open for further replies.

Share This Page