Plugin.yml help

Discussion in 'Plugin Development' started by kmccmk9, May 15, 2011.

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

    kmccmk9

    Ok so this is my code and I'm still getting unknown command errors

    Code:
    package com.kmccmk9.ServerReloader;
    
    import java.util.logging.Logger;
    
    import org.bukkit.Server;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class ServerReloader extends JavaPlugin {
        public static ServerReloader plugin;
        Server server;
        Logger log = Logger.getLogger("Minecraft");
        Player player;
        String enteredtime;
        int time;
        int time2;
        int time3;
        public void onDisable() {
            // TODO Auto-generated method stub
            log.info("ServerReloader has been disabled.");
        }
    
        public void onEnable() {
            // TODO Auto-generated method stub
            server = this.getServer();
            plugin = this;
            log.info("ServerReloader has been enabled.");
    
        }
    
        public boolean onCommand(final CommandSender sender, Command command, String commandLabel, String[] args)
        {
            if (sender instanceof Player) {
                player = (Player) sender;
                if(commandLabel.equalsIgnoreCase("serverreload")) {
                    {
                        if (args.length >= 0)
                        {
                            enteredtime = args[0];
                            time = Integer.parseInt(enteredtime);
                            time = time * 60;
                            time2 = time / 2;
                            time3 = time - 10;
                            if (args[0] == "help")
                            {
                                player.sendMessage("The correct format is /serverreload <time in minutes>");
                                player.sendMessage("using /serverreload help - Will list the help file");
                            }
                            else if (args[0] == null)
                            {
                                player.sendMessage("The correct format is /serverreload <time in minutes>");
                            }
                            else
                            {
                            server.dispatchCommand(sender, "The server will reload in " + time/60 + " minutes");
                            server.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
                                public void run() {
                                    server.dispatchCommand(sender, "say Server Reloading in " + time2/60 + " minutes");
                                }
                            }, time2 * 20L);
                            server.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
                                public void run() {
                                    server.dispatchCommand(sender, "say Server Reloading");
                                    server.dispatchCommand(sender, "reload");
                                }
                            }, time * 20L);
                            }
                        }
                    }
                }
            }
            return true;
        }
    }
    
     
  2. Offline

    iPhysX

    Send your .yml because.. this is most likely the cause of unknown command problems
     
  3. Offline

    kmccmk9

    Code:
    name: ServerReloader
    main: com.kmccmk9.ServerReloader.ServerReloader
    version: 0.01
    commands:
      serverreload:
        description: A plugin that allows for in game server reloads!
        usage: |
                /serverreload <time in minutes>
                
     
  4. Offline

    iPhysX

    i never use..

    Code:
    usage: |
                /serverreload <time in minutes>
    try just
    Code:
    usage: /serverreload <time in minutes>
     
  5. Offline

    kmccmk9

    Ok well fixing that still didn't seem to change anything
     
  6. Offline

    iPhysX

    eurgh. im not sure why you are getting unrecognised command.
     
  7. Offline

    kmccmk9

    Lol I can't figure it out either. It's so strange. Maybe I will scrap the whole thing and start over idk. What's worse is that the plugin actually functions but throws this error for some reason.
     
  8. Offline

    Jayjay110

    once you fixed your .yml did u refresh it in eclipse then export it?
     
  9. Offline

    kmccmk9

    I edited the yml in eclipse so I did not refresh but I did re export.
     
  10. Offline

    Jayjay110

    maybe you havnt been refreshing the file after editing it so its not exporting the correct one ?
     
  11. Offline

    iPhysX

    @JayJay
    if he exported it he wouldnt have been able to do that without it being up to date :/
     
  12. Offline

    Jayjay110

    ah k wasnt sure
     
  13. Offline

    kmccmk9

    Right, and I also know the format is right. Is it possible there is a problem with my plugin code?
     
  14. Offline

    Jayjay110

    Yes, how is it set up in eclipse post screens
     
  15. Offline

    kmccmk9

    What do you want screen caps of?
     
Thread Status:
Not open for further replies.

Share This Page