Need help with plugin

Discussion in 'Spigot Plugin Development' started by shieken, May 21, 2015.

  1. Today I developed my very first plugin :D how exciting!!

    Well it sucks if it don't work. I made the plugin, following all the steps in a video I watched. I know the video was accurate, because almost everything worked—except the command. I made the command say something to the user, but when I tried it it said nothing. Anyone know how to fix this?
  2. Firstly, please don't try copying code from a video. More than likely it's teaching you bad practices and is probably out-of-date. Secondly, what does your command processor look like? It's hard to help when we can't see what you've tried/come up with.
    • Agree Agree x 2
  3. Just a tip for when you ask questions here next time. If you want us to see what's wrong with your code, post your code as well so we know where to look. :)

    @NinjaWaffles He didn't say he copied the code. He just said that he followed the steps.
  4. You mustn't learn from videos in general. That's what he is saying.
  5. Learning from videos isn't wrong. Some people find it easier to learn from videos. I learned most of my knowledge in Bukkit and Java from watching videos. It depends on what videos you watch. As long as the videos practice proper conventions to encourage good programming practices along with explaning properly, watching videos are fine.
    • Agree Agree x 1
  6. Code (Text):
    public boolean onCommand(CommandSender cs, Command c, String s, String[] args){
            Player p = (Player) cs;
  7. Thats how I learnt, then I moved onto bukkit (looking at code, teaching myself, looking online for things I cant figure out). That was 2 years ago when I was 12 1/2
    I'm 15 now and there is still more to learn
  8. Now something on topic;
    Depending on what command you have made, you need to define it in the plugin.yml file.
    Make one by right clicking the folder (aka java project) and click New -> File and name it "plugin.yml"
    You need these variables inside:
    Code (Text):
    name: NameofPlugin
    version: Version
    main: me.YourName.plugin.mainclass (Whatever your package is then .yourmainclass)
    After that, you want to set up your command.
    Code (Text):
            usage: /<command> (keep this the same)
            description: <description>
    If you have added a permission inside of the code, for instance
    Code (Text):
    if(cmd.getName().equalsIgnoreCase()) {
        if(p.hasPermission("perm.ission") {
    You need to define the permissions into the plugin.yml. FOR INSTANCE
    Code (Text):
        perm.*: (You always need this(you don't need it if no permissions in the plugin)
            description: Description for this permission
            default: op (Use this in all permissions)
            children: List all the other permissions you define
                 perm.ission: true
            description: <description>
            default: op
    Simple as that. You should now be able to use the command
    If you cant use the command, its either got no code inside of it to run OR theres an error in the console. Please post that error if so.
  9. I don't mean to advertise anyone, (and don't obviously don't just copy the code) but PogoStick29Dev is a trustworthy Java developer/youtuber. Watch his coding tutorials if you are getting started but don't want to learn Java too in-depth. However, the errors could be caused by your plugin.yml, and many other things.
  10. for all of you who said the video isnt accurate, it is, i just made a mistake

    CommandSender sender, Command cmd, <--those were switched around
    • Like Like x 1
  11. Well, you now know a little bit about fixing bugs in your code, your learning!
    If you don't understand something, research, research, research until you find a solution! If none post on here.
    Glad you fixed it:)

    Please, like @TheCodeMonkey said watch PogoStick29Dev, he was the one who encouraged and started me with the bukkit API.
    • Like Like x 1