Example plugin.yml

Discussion in 'Plugin Development' started by black_ixx, Jan 20, 2012.

Thread Status:
Not open for further replies.
  1. Hi
    Im very new at developing plugins, that means I have started today...
    Can somebody please give me an example for an plugin.yml ?
     
    thomas15v likes this.
  2. Offline

    saul100

  3. ok thanks :D

    I have created a beginning....
    But the server says:
    2012-01-21 02:16:25 [SEVERE] Could not load 'plugins\Test.jar' in folder 'plugins':
    java.io.FileNotFoundException: Jar does not contain plugin.yml
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:66)
    at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:215)
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:136)
    at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:151)
    at org.bukkit.craftbukkit.CraftServer.reload(CraftServer.java:434)
    at org.bukkit.Bukkit.reload(Bukkit.java:187)
    at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:22)
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:165)
    at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:378)
    at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:374)
    at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:564)
    at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:541)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:425)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:457)


    But I have a plugin.yml:

    name: test
    version: 0.1
    description: First Plugin
    author: Black_ixx
    website: http://felix.neuby.de

    main: me.black_ixx.test.test

    commands:


    Can you help me please?

    I have the problem: The plugin.yml was at the package me.black_ixx.test
    Now the plugin can say if its enabled/disabled....
    Not very good, but a Start

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 23, 2016
  4. Offline

    surtic

    :) now you can make the first command... have fun bukkit is a grate api to programming plugins for the server :D
     
    Hoppys and black_ixx like this.
  5. First (now) Im watching a video, and create the Plugin like in it.
    Then if I know, how to create, I will start creating my own Plugin.
    First simple things, like you type /rules, and then you can read them.

    One thing: whats about " { " whats the rule, when I have to place it?

    Up to now it looks like that:

    package me.black_ixx.test;

    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.plugin.java.JavaPlugin;

    public class test extends JavaPlugin {

    @Override
    public void onDisable() {

    System.out.println("test disabled");

    }

    @Override
    public void onEnable() {

    System.out.println("test enabled");

    }


    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {

    boolean succeed = false;

    return false;

    if (sender instanceof Player) {

    Player player = (Player) sender;

    if (cmd.getName() .equalsIgnoreCase ("testplugin"){

    if (args.length == 0 ) {

    } else {
    player.sendMessage ()
    }
    }
    }
    }

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 23, 2016
  6. Offline

    emericask8ur

    I made a Tut on my site here if you dont understand so well ;)
     
  7. Oh I have the Plugin.yml already:
    saul100 gave me a link :D
    Now my problems are " ; " and " { "
    Do you know, when to place this?
     
  8. Offline

    emericask8ur

    Can you www.Pastie.org Your code?
     
  9. Offline

    emericask8ur

    Main Class
    Code:
    package com.emericask8ur.Notes;
    import org.bukkit.ChatColor;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class PMain extends JavaPlugin{
    @Override
    public void onDisable() {
      // TODO Auto-generated method stub
     
    }
    @Override
    public void onEnable() {
      // TODO Auto-generated method stub
     
    }
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String cmdLabel, String[] args) {
      if(cmdLabel.equalsIgnoreCase("emericask8ur")){
      sender.sendMessage(ChatColor.RED + "Yeah im emericask8ur!");
      return true;
      }
      return true;
     
    }
    }
    
    YML
    Code:
    name: Notes
    version: 0.1
    main:  com.emericask8ur.Notes.PMain
    commands:
      emericask8ur:
      description: Uses
      usage: /emericask8ur
    
     
    black_ixx likes this.
  10. Offline

    emericask8ur

    it should be like this
    if(cmdLabel.equalsIgnoreCase("a") && args.length > 0)){

    if(args.length==1){
    //Do stuff for Arguments of 1 Example command: /a <param>
    }
    else if (args.length==2){
    //Do stuff for arg of 2 example: /a <param> <param>
    }

    Get where its going?
     
    black_ixx likes this.
  11. Ok thanks, I think, now I know it.
    And when, I use " ; " ?
     
  12. Offline

    emericask8ur

    No you dont add those after every placement.
    just like
    player.dosomething();
    }
    etc
     
    black_ixx likes this.
  13. ok thanks
    No my first Plugin would be ready, if there was not this error:
    [​IMG]
    And if I delete }, its like that:
    [​IMG]
    Do you know, what I can do?
     
  14. Offline

    theguynextdoor

    You're probably missing a } at the end
     
  15. Offline

    Luphie

    In that section you have an extra closing bracket } in your if statement, before else and you are missing an opening bracket { after else:
    Code:
                    if(args.length==0){
                        //Befehl: /testplugin
                        player.getInventory().setHelmet(new ItemStack(310, 1)) ;
                        player.getInventory().setChestplate(new ItemStack(311, 1)) ;
                        player.getInventory().setLeggings(new ItemStack(312, 1)) ;
                        player.getInventory().setBoots(new ItemStack(313, 1)) ;
               
                        succeed = true;
               
                    }
               
                    } else
                        player.sendMessage (ChatColor.RED + "[Test]" + ChatColor.BLUE + "this command has no arguments!!!") ;
                        succeed = false;
                    }
                }
        }
    }
    
    would be:
    Code:
                    if(args.length==0){
                        //Befehl: /testplugin
                        player.getInventory().setHelmet(new ItemStack(310, 1)) ;
                        player.getInventory().setChestplate(new ItemStack(311, 1)) ;
                        player.getInventory().setLeggings(new ItemStack(312, 1)) ;
                        player.getInventory().setBoots(new ItemStack(313, 1)) ;
               
                        succeed = true;
               
                    } else {
                        player.sendMessage (ChatColor.RED + "[Test]" + ChatColor.BLUE + "this command has no arguments!!!") ;
                        succeed = false;
                    }
                }
        }
    }
     
    black_ixx likes this.
  16. Sry Im new in developing....
    and it still have an error, if I add { :
    [​IMG]

    can you add the right code in pastebin?
     
  17. Offline

    Luphie

    The only thing in there that I see in there that would cause a problem is one extra } before "else"
    Code:
    }
     
    } else {
    would become
    Code:
     
    } else {
    full paste:
    http://pastebin.com/YCm9YqH4
     
    black_ixx likes this.
  18. Oh, I watched the tutorial again, and had some other errors. Now im fixing them

    yeah my first testplugin is ready :D


    Edit:
    My Nitrado Server is still 1.0.1, and I wanna update it. Where can I download it?
    And is there something special, that I must look for?

    Edit2:
    The command for the plugin is /test and gives you a diamond armor

    How, I can make, that my plugin changes the group (permissionsbukkit) of the user, who types the command?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Dec 25, 2020
  19. Offline

    emericask8ur

    Trust me dont go adding permissios yet. You cant master the } yet -.-
     
    SwagiWagi and mc_myster like this.
  20. maybe you can help me :D you look like an good developer. I think with testing and trying out, I will learn faster...


    Edit: Ok you are right.... I should start with easier things.
    I will say it, if I have some problems

    I think, that now, I know all about the }

    Now its so:
    Commands:
    /diamond gives diamond armor
    /gold gives gold armor
    /leather gives leather armor
    /iron gives iron armor
    /chain gives chainmail armor

    Can you help me please with permissionsbukkit support?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 23, 2016
    mc_myster likes this.
  21. I will open a new thread, this one has the name example plugin.yml, and thats now the wrong name
     
  22. Offline

    ItsHarry

    If you don't know when to put {, you have a lot to learn..
     
    SwagiWagi likes this.
  23. I think, now I know all about this.

    Now I can start with more difficult things like permissions
     
  24. Offline

    ArcheCane

    if p.hasPermission("");
     
  25. You really need to look into the basics of java before diving into plugin development, your just going to make yourself confused and will end up giving up.
     
  26. Theres the new thread:
    http://forums.bukkit.org/threads/permissionsbukkit-integration.55995/

    Now I have permissions, and I only dont know, how to make this config.yml at the thread
     
  27. Offline

    ArcheCane

Thread Status:
Not open for further replies.

Share This Page