minecraft-dev / MinecraftDev

Plugin for IntelliJ IDEA that gives special support for Minecraft modding projects.
https://minecraftdev.org/
GNU Lesser General Public License v3.0
1.5k stars 187 forks source link

Support for Nukkit Plugins #2070

Open DeathGOD7 opened 1 year ago

DeathGOD7 commented 1 year ago

Minecraft Development for IntelliJ plugin version

2023.2-1.6.6

Description of the feature request

Add support for making a project of the nukkit plugin.

Mysterious-Dev commented 1 year ago

Do you have any documentation on this?

DeathGOD7 commented 1 year ago

Nukkit Wiki : https://cloudburstmc.org/wiki/nukkit

Gradle (build.gradle) file :

plugins {
    id 'java'
}

group = 'com.github.deathgod7'
version = '1.0-SNAPSHOT'

repositories {
    mavenCentral()
    maven {
        name = "nukkit-release"
        url = "https://repo.opencollab.dev/maven-releases"
    }
    maven {
        name = "nukkit-snapshot"
        url = "https://repo.opencollab.dev/maven-snapshots/"
    }
}

dependencies {
    //noinspection VulnerableLibrariesLocal
    compileOnly "cn.nukkit:nukkit:1.0-SNAPSHOT"
}

def targetJavaVersion = 8
java {
    def javaVersion = JavaVersion.toVersion(targetJavaVersion)
    sourceCompatibility = javaVersion
    targetCompatibility = javaVersion
    if (JavaVersion.current() < javaVersion) {
        toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
    }
}

tasks.withType(JavaCompile).configureEach {
    if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
        options.release = targetJavaVersion
    }
}

Main Class File

package com.github.deathgod7.unexpectedspawnnukkit;

import cn.nukkit.plugin.PluginBase;

public final class UnexpectedSpawn extends PluginBase {

    @Override
    public void onEnable() {
        // Plugin startup logic

    }

    @Override
    public void onDisable() {
        // Plugin shutdown logic
    }
}

And to note, it's not in maven-releases but in maven-snapshots. Repo Browser : https://repo.opencollab.dev/#/