Solved getCommand() method in another class

Discussion in 'Plugin Development' started by Orange Tabby, Apr 6, 2015.

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

    Orange Tabby

    I am trying to get commands in a public void and register that void in the onEnable method but it keeps saying
    no method found.

    NOTE: there is noting miss if there is its because i wrote up this example in
    the create thread page.

    Main class :
    Code:
    package that.is;
    
    import org.bukkit.Bukkit;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class Main extends JavaPlugin {
    
        public void onEnable() {
        Commands.getMyCommands();
    }
            
    Commands class :
    Code:
    package that.is;
    
    import org.bukkit.Bukkit;
    
    public class Commands {
    
        public static void getMyCommands() {
        getCommand("mycommand").setExecutor(new MyCommand()); // this is the bug
           
        }
    
    }
    Please help and thank you.

    lol i miss spelled missing

    i fixed it.

    Okay so I'm making a nanosuit plugin and I have made a command /nanosuit to get the suit pieces... but I want a command /nano speed that adds potion effects, is timed with cool down, and can only be run while having the suit on, but I have been looking for an hour ...

    Fyi I know how to add potion effects

    Ok, that could be. However, it doesn't work with only 1 as well.

    The problem is not that the code is wrong, however because my item has a custom name: "Tin, Copper, etc." the program doesn't recognize that "Copper" is actually Redstone_Ore with a custom display name. Is there any way to test for that or get Minecraft to test for the base material.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 12, 2016
Thread Status:
Not open for further replies.

Share This Page