Plugin Development

  • Views Views: 3,984
  • Last updated Last updated:
  • Sub-pages:

    Requirements

    Eclipse

    Create a New Project

    1. Create a new Maven Project, click next until you get to the Archetype and Catalog screen.
    CreateMavenProject_Eclipse.png

    2. Click Configure.
    CreateMavenProject_Eclipse_3.png

    3. Add a remote catalog.
    CreateMavenProject_Eclipse_4.png

    4. Add the Catalog File URL https://repo.opencollab.dev/maven-releases/. Click Ok, then Apply and Close.
    CreateMavenProject_Eclipse_5.png

    5. Press Ok and select NukkitX from the Catalog.
    CreateMavenProject_Eclipse_6.png

    6. Uncheck "Show the last version of Archetype only" and select Version 1.0 to create a Nukkit 1.0 plugin.
    CreateMavenProject_Eclipse_8.png

    7. Fill in the Group Id and Artifact Id for your plugin. The Artifact Id is the name used for creating the final .JAR file.
    CreateMavenProject_Eclipse_9.png

    8. The project will now be created. It may take a few minutes for Maven to download and set everything up. The project package might be incorrect; if this is the case, mouse-over the package name and select the Move to package quick fix.. Add the following line of code to the onLoad() function:
    Java:
    this.getLogger().info("MyFirstPlugin has loaded!");
    CreateMavenProject_Eclipse_11.png

    9. Next we need to create a new Run Configuration.
    CreateMavenProject_Eclipse_12.png

    10. Add "clean install" to the Goals field. Then click Workspace, select your plugin, and press OK. Now press Apply and then Run. Maven will now build the .JAR file. You must click on your project name in the Project Explorer on the left and press F5 to see the newly built .JAR file. Move this file to your NukkitX plugins folder to use it.
    CreateMavenProject_Eclipse_13.png


    To change the name of your plugin from MyPlugin, open the pom.xml file and change it in between the <name></name> tags. The version of your plugin can be changed in the <version></version> tags below the name.
  • Loading…
  • Loading…
Top