Need a bit of help with Plugin!

Discussion in 'Plugin Development' started by AboveExpertt, Oct 12, 2012.

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

    AboveExpertt

    I have been trying to work on a basic plugin and I have made some before, but this one for some reason is just not working. I imported the bukkit jar and everything. Here is my code.

    Code:
    package me.aboveexpertt.spawnfail;
     
    import java.util.logging.Logger;
     
    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;
     
    public class SpawnFail extends JavaPlugin {
       
        public final Logger logger = Logger.getLogger("Minecraft");
        public static SpawnFail plugin;
       
        @Override
        public void onEnable(){
            PluginDescriptionFile pdfFile = this.getDescription();
            this.logger.info(pdfFile.getName() + " Has been Enabled!" + pdfFile.getVersion());
        }
       
        public void onDisable(){
            PluginDescriptionFile pdfFile = this.getDescription();
            this.logger.info(pdfFile.getName() + " Has been Disabled!" + pdfFile.getVersion());
        }
     
        public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
        Player player = (Player) sender;
           
            if(commandLabel.equalsIgnoreCase("spawm")){
                player.sendMessage("Steve and his typos.");
            }
            return false;
        }
    }
     
  2. Offline

    xXSniperzzXx_SD

    1. You don't need to log the enable and disable, bukkit already does this
    2. What doesn't work about it?
    3. My guess is you didn't add it to your plugin.yml

    Also you're not checking if a Player actually did the command put
    Code:
    if(sender instanceof Player){
    }
     
Thread Status:
Not open for further replies.

Share This Page