My plugin doesn't work correctly

Discussion in 'Plugin Requests' started by KonarJG, Mar 12, 2018.

Thread Status:
Not open for further replies.
  1. Hi! I'm learning how to write plugins. I want to make skywars plugin from this in the future and i tested the Player class but my whole plugin doesn't work. (It's visible in console when i write /plugins). Can someone tell me what have I done wrong? Thank you.

    Here's the link for the code:
    https://bitbucket.org/konarjg/minecraft/src/Plugin-code/
     
  2. Could you elaborate on what isn't working. It's been a while since I've developed any plugins but I'm starting back up.
     
  3. Offline

    Tabuu_

    You have not registered the event nor the command.

    Code:
    this.getCommand("command label").setExecutor(this);
    this.getServer().getPluginManager().registerEvents(this, this);
    Also your main class should imlement CommandExecutor for the command to work.

    I would highly discourage putting eventhandlers and commandexecutors in the main class (since this is not object oriented). I would suggest leaning a bit of Java (or any other comarable language).
     
  4. Offline

    timtower Administrator Administrator Moderator

    1. Something that small is no issue to put in the Main class.
    2. You don't need to register the CommandExecutor if it is the main class, main class is the executor by default.

    @KonarJG Remove the constructor in the Main, Bukkit can't handle it or do anything with it. Will mark the plugin as invalid.
    Check the length of args before you use args[0]
     
  5. Offline

    Tabuu_

    1. I was talking about the eventhandlers and commandexecutors themselfs and not the registration of them.
    2. I would not know about that, I always make a separate class for the commandexecutor. Anyway I don't think registering it even when it is the main class will do any harm.
     
Thread Status:
Not open for further replies.

Share This Page