Command not firing?

Discussion in 'Plugin Development' started by TheDeviousKitty, Mar 16, 2013.

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


    Not sure if this is due to 1.5 (I doubt it is), but I've made this simple code.

    package me.TheDeviousKitty.HungerGames;
    import java.util.logging.Logger;
    import org.bukkit.ChatColor;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.PluginDescriptionFile;
    public class Game extends JavaPlugin {
        public final Logger logger = Logger.getLogger("Minecraft");
        public static Game plugin;
        public void OnEnable(){
            PluginDescriptionFile pdffile = this.getDescription();
   + " has been disabled!");
        public void OnDisable(){
            PluginDescriptionFile pdffile = this.getDescription();
   + " Version " + pdffile.getVersion() +  " has been enabled!");
        public boolean OnCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
            Player player = (Player) sender;
            if (commandLabel.equalsIgnoreCase("information")){
                player.sendMessage(ChatColor.GOLD + "Info command works!");
            return true;
    When I hop on the server, and type "/information" nothing happens. Nothing errors in the command prompt. Nothing at all.

    I am running the latest version of bukkit. I also get no errors anywhere.
  2. Offline


    Try these and post error results if you get them:
    1) Put a return statement = true inside the if statement, and set the old return statement to false. See if it works.


    2) Dont cast the sender to a player object, just use sender.sendmessage. See if it works.

    It would also help if you gave us your plugin.yml
  3. Offline


    Apart from other code critique I would guess your issue is that you didn't put your command in your plugin.yml :)
Thread Status:
Not open for further replies.

Share This Page