Problem/Bug Please help. I need help figuring out the problem with my code.

Discussion in 'Plugin Help/Development/Requests' started by samyounes03, Mar 13, 2015.

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

    samyounes03

    I am very new to coding Bukkit plugins, and i need help with this really simple one:
    Its supposed to tell the player hello when he types in the command /hello.
    Here is the code:
    ---------------------------------------------------------------------------------------------------------------------

    package me.samyounes03.fakejoin;

    import org.bukkit.ChatColor;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.java.JavaPlugin;

    public class Main extends JavaPlugin{

    public void onEnable() {
    getLogger().info("Plugin successfully enabled");
    }

    public void onDisable() {
    getLogger().info("Plugin Disabled");
    }

    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {

    if (sender instanceof Player) {
    Player player = (Player) sender;
    if (cmd.getName().equalsIgnoreCase("hello")) {


    player.sendMessage("Hello, " + player.getName() + "!");

    return true;


    }

    return false;

    }
    return false;
    }
    }

    -----------------------------------------------------------------------------------------------------------------------------------------
    When I put it into my plugins folder and run the server, I can't find it in the plugins list, neither in the help, and when i type the command: it tells me "unknown command". Help Please!
    [​IMG]

     

    Attached Files:

    • ph.PNG
      ph.PNG
      File size:
      51.6 KB
      Views:
      4
  2. Offline

    Kilorbine

    Does your server say "Plugin successfully enabled" ?
    If not : are you sure you have compile your plugin? is it in the plugin folder of your server?

    if yes : it's yout plugin.yml file that is not good, but for this I cannot help you, because I don't really understqnd why it works.
    Sometime, i can add a commend, and sometime no.
     
  3. Offline

    pie_flavor

    @samyounes03 Please post your plugin.yml as well. Also, it is more helpful to use [code=java][/code], [syntax=java][/syntax], or pastebin.com with Java syntax highlighting.
     
  4. Offline

    samhep

    It will be a problem with you plugin.yml - post it on here or pastebin so we can see it :)
     
  5. Offline

    nverdier

    @samyounes03 Is this problem solved? If so, please mark your thread as solved! See this for more info.
     
  6. Offline

    schwabfl

    Move your plugin.yml file into the src folder
     
Thread Status:
Not open for further replies.

Share This Page