Solved Need help having 2 classes for commands

Discussion in 'Plugin Development' started by Assasinsheep, Sep 18, 2016.

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

    Assasinsheep

    recently I tried using the bukkit wiki on how to make it so you can have the command code in a separate class but unfortunately I was getting errors what would be the best way to do this? I will show a image of the classes etc

    [​IMG]


    [​IMG]

    I have 2 classes the OnOffenable is the main class since it contains the on and off code when starting up

    and the maincommands is where I want the commands in :)
     
  2. Offline

    timtower Moderator Moderator

    @Assasinsheep 1. Don't log, you don't need it.
    2. Make a class that extends or implements CommandExecutor
    Set the executor of your command to an instance of above class.
     
  3. Offline

    frostalf

    @timtower is right, you don't need to log, however it is a good habit to get into doing though for other things like exceptions as it can provide the user or even you when testing as to where the exception is happening and why possibly.

    Anyways, to help with what you are wanting, I think looking at an example would benefit you.
    Here is a link to the repo of ServerTutorial created by HawkFalcon and myself. The link points you to the commands section.

    ServerTutorial Github
     
Thread Status:
Not open for further replies.

Share This Page