Coding Issue Please Help!

Discussion in 'Plugin Development' started by cronikkk, Apr 27, 2011.

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

    cronikkk

    Code:
    package com.elitecraft.cronikkk.help;
    
    import org.bukkit.ChatColor;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.PluginDescriptionFile;
    import org.bukkit.plugin.java.JavaPlugin;
    
    /**
     * Help for Bukkit
     *
     * @author cronikkk
     */
    
    public class Help extends JavaPlugin{
    
        public void onDisable() {
            PluginDescriptionFile pdfFile = this.getDescription();
            System.out.println( pdfFile.getName() + " is disabled!" );
        }
        public void onEnable() {
            PluginDescriptionFile pdfFile = this.getDescription();
            System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" ); }
    
        public boolean onCommand(CommandSender sender, Command command, String label, String[] arguments) {
                String subCommand = arguments[0];
                Player player = (Player) sender;
                if(subCommand.equals("help"))
                {
                    sender.sendMessage("You've typed /help!");
                }
    
            return true;
        }
    
    }
    hey,
    It took forever but I got the plugin to finally ENABLE but the thing is, When they type /help it doesn't do anything! and the console says:
    Code:
    10:38:33 [INFO] cronikkk tried command: help
    I don't know what else to do. Can someone help me and tell me why this isn't sending?
     
  2. First of all check your config.yml file and make sure the command is the one you want eg:
    Code:
    #===CONFIG.YML===
    commands:
      help:
        description:
        usage: |
    
    It's also possible that your plugin is clashing with the Bukkit /help command.

    Try changing your onCommand class to override.
    Code:
    @ Override public boolean onCommand(...
    If that doesn't work then you should try changing your default command.
     
Thread Status:
Not open for further replies.

Share This Page