Need help registering a command in plugin.yml

Discussion in 'Plugin Development' started by partycarp, Feb 28, 2013.

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

    partycarp

    Hi all,

    I'm a new poster and brand new plugin creator. I've been trying for a couple of days to create a simple plugin that just returns a "Hello World" when someone enters the /hello command. I took this directly from examples on the web. I can get my little plugin to load properly but always get an "Unknown Command" error when I type /hello. Any help would be appreciated! Here is my main file followed by my plugin.yml file.


    -----Thunder.java---------
    package com.mstweb.Thunder;

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

    public final class Thunder extends JavaPlugin {

    @Override
    public void onEnable() {
    getLogger().info("Thunder onEnable invoked");

    }

    @Override
    public void onDisable() {
    getLogger().info("Thunder onDisable invoked");

    }

    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args)
    {
    if (cmd.getName().equalsIgnoreCase("hello"))

    {
    sender.sendMessage("Hello World!");
    return true;
    }
    return false;
    }

    }


    -------Plugin.yml-------

    name: Thunder
    main: com.mstweb.Thunder.Thunder
    version: .01

    commands:
    hello:
    description: Hello World command
    usage: /hello
    permissions:
    Thunder.hello:
    description: This is a description
    default: true

    I just realized that the last couple of times I copied my Thunder.jar file I copied it to the wrong place, resulting in two different copies. Embarrasing. Newbie, as I said. I'm sure I'll have other questions to come, sorry about this one.

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

    leiger

    Good luck with your future development :D
     
Thread Status:
Not open for further replies.

Share This Page