diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml new file mode 100644 index 0000000..149d2f5 --- /dev/null +++ b/.forgejo/workflows/build.yml @@ -0,0 +1,43 @@ +name: Build + +on: + push: + paths: + - 'src/**' + - '.github/**' + - 'build.gradle.kts' + - 'gradle.properties' + - 'settings.gradle' + +jobs: + build: + runs-on: arch-linux + env: + NEMESIS_VERSION_NAME: "autobuild-${{ github.sha }}" + NEMESIS_BUILD_CHANNEL: "autobuild" + steps: + - name: Checkout + uses: actions/checkout@v6.0.1 + + - name: Setup Java enviroment + uses: actions/setup-java@v5.1.0 + with: + distribution: temurin + java-version: 21 + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v5 + + - name: Download CB1060 + run: | + mkdir -p libs + curl -L -o libs/craftbukkit-1060.jar https://archive.org/download/craftbukkit1060/craftbukkit1-7-3%281060%29.jar + + - name: Build with Gradle + run: ./gradlew buildAll + + + - name: Upload artifacts + uses: actions/upload-artifact@v6.0.0 + with: + path: build/libs/*.jar diff --git a/.forgejo/workflows/release-build.yml b/.forgejo/workflows/release-build.yml new file mode 100644 index 0000000..392e32e --- /dev/null +++ b/.forgejo/workflows/release-build.yml @@ -0,0 +1,40 @@ +name: Release Build + +on: + release: + types: [published] + +jobs: + build-and-release: + runs-on: arch-linux + env: + NEMESIS_VERSION_NAME: "${{ github.ref_name }}" + NEMESIS_BUILD_CHANNEL: "production" + steps: + - name: Checkout + uses: actions/checkout@v6.0.1 + + - name: Set up Java + uses: actions/setup-java@v5.1.0 + with: + distribution: temurin + java-version: 21 + + - name: Set up Gradle + uses: gradle/actions/setup-gradle@v5 + + - name: Download CB1060 + run: | + mkdir -p libs + curl -L -o libs/craftbukkit-1060.jar \ + https://archive.org/download/craftbukkit1060/craftbukkit1-7-3%281060%29.jar + + - name: Build with Gradle + run: ./gradlew buildAll + + - name: Upload JARs to release + uses: softprops/action-gh-release@v2.5.0 + with: + files: build/libs/*.jar + tag_name: ${{ github.ref_name }} + name: ${{ github.ref_name }} diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..ac1941e --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,15 @@ +# These are supported funding model platforms + +github: adrianvic +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry +polar: # Replace with a single Polar username +buy_me_a_coffee: # Replace with a single Buy Me a Coffee username +thanks_dev: # Replace with a single thanks.dev username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..0e8199d --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,44 @@ +name: Build + +on: + workflow_dispatch: + push: + paths: + - 'src/**' + - '.github/**' + - 'build.gradle.kts' + - 'gradle.properties' + - 'settings.gradle' + +jobs: + build: + runs-on: ubuntu-latest + env: + NEMESIS_VERSION_NAME: "autobuild-${{ github.sha }}" + NEMESIS_BUILD_CHANNEL: "autobuild" + steps: + - name: Checkout + uses: actions/checkout@v6.0.1 + + - name: Setup Java enviroment + uses: actions/setup-java@v5.1.0 + with: + distribution: temurin + java-version: 21 + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v5 + + - name: Download CB1060 + run: | + mkdir -p libs + curl -L -o libs/craftbukkit-1060.jar https://archive.org/download/craftbukkit1060/craftbukkit1-7-3%281060%29.jar + + - name: Build with Gradle + run: ./gradlew buildAll + + + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + path: build/libs/*.jar diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml new file mode 100644 index 0000000..9570712 --- /dev/null +++ b/.github/workflows/release-build.yml @@ -0,0 +1,41 @@ +name: Release Build + +on: + release: + types: [published] + +jobs: + build-and-release: + runs-on: ubuntu-latest + env: + NEMESIS_VERSION_NAME: "${{ github.ref_name }}" + NEMESIS_BUILD_CHANNEL: "production" + steps: + - name: Checkout + uses: actions/checkout@v6.0.1 + + - name: Set up Java + uses: actions/setup-java@v5.1.0 + with: + distribution: temurin + java-version: 21 + + - name: Set up Gradle + uses: gradle/actions/setup-gradle@v5 + + - name: Download CB1060 + run: | + mkdir -p libs + curl -L -o libs/craftbukkit-1060.jar \ + https://archive.org/download/craftbukkit1060/craftbukkit1-7-3%281060%29.jar + + - name: Build with Gradle + run: ./gradlew buildAll + + - name: Upload artifacts to release + run: | + curl -X POST \ + -H "Authorization: token ${{ secrets.FORGEJO_TOKEN }}" \ + -H "Content-Type: application/octet-stream" \ + https://inspiran.beetal-castor.ts.net/git/api/v1/repos/${{ github.repository }}/releases/tags/${{ github.ref_name }}/assets \ + --data-binary @build/libs/your-artifact.jar \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1e3abdf --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +.gradle/ +build/ +out/ +.idea/ +libs/ +run/ diff --git a/.gradle/8.8/checksums/checksums.lock b/.gradle/8.8/checksums/checksums.lock deleted file mode 100644 index 1fc7f10..0000000 Binary files a/.gradle/8.8/checksums/checksums.lock and /dev/null differ diff --git a/.gradle/8.8/checksums/md5-checksums.bin b/.gradle/8.8/checksums/md5-checksums.bin deleted file mode 100644 index f239517..0000000 Binary files a/.gradle/8.8/checksums/md5-checksums.bin and /dev/null differ diff --git a/.gradle/8.8/checksums/sha1-checksums.bin b/.gradle/8.8/checksums/sha1-checksums.bin deleted file mode 100644 index e2db85d..0000000 Binary files a/.gradle/8.8/checksums/sha1-checksums.bin and /dev/null differ diff --git a/.gradle/8.8/dependencies-accessors/gc.properties b/.gradle/8.8/dependencies-accessors/gc.properties deleted file mode 100644 index e69de29..0000000 diff --git a/.gradle/8.8/executionHistory/executionHistory.bin b/.gradle/8.8/executionHistory/executionHistory.bin deleted file mode 100644 index 99e1191..0000000 Binary files a/.gradle/8.8/executionHistory/executionHistory.bin and /dev/null differ diff --git a/.gradle/8.8/executionHistory/executionHistory.lock b/.gradle/8.8/executionHistory/executionHistory.lock deleted file mode 100644 index f69dcd5..0000000 Binary files a/.gradle/8.8/executionHistory/executionHistory.lock and /dev/null differ diff --git a/.gradle/8.8/fileChanges/last-build.bin b/.gradle/8.8/fileChanges/last-build.bin deleted file mode 100644 index f76dd23..0000000 Binary files a/.gradle/8.8/fileChanges/last-build.bin and /dev/null differ diff --git a/.gradle/8.8/fileHashes/fileHashes.bin b/.gradle/8.8/fileHashes/fileHashes.bin deleted file mode 100644 index d26d2d2..0000000 Binary files a/.gradle/8.8/fileHashes/fileHashes.bin and /dev/null differ diff --git a/.gradle/8.8/fileHashes/fileHashes.lock b/.gradle/8.8/fileHashes/fileHashes.lock deleted file mode 100644 index 4eb757c..0000000 Binary files a/.gradle/8.8/fileHashes/fileHashes.lock and /dev/null differ diff --git a/.gradle/8.8/fileHashes/resourceHashesCache.bin b/.gradle/8.8/fileHashes/resourceHashesCache.bin deleted file mode 100644 index 772a426..0000000 Binary files a/.gradle/8.8/fileHashes/resourceHashesCache.bin and /dev/null differ diff --git a/.gradle/8.8/gc.properties b/.gradle/8.8/gc.properties deleted file mode 100644 index e69de29..0000000 diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock deleted file mode 100644 index d49b8d6..0000000 Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and /dev/null differ diff --git a/.gradle/buildOutputCleanup/cache.properties b/.gradle/buildOutputCleanup/cache.properties deleted file mode 100644 index 44a92ec..0000000 --- a/.gradle/buildOutputCleanup/cache.properties +++ /dev/null @@ -1,2 +0,0 @@ -#Mon Dec 01 17:53:37 BRT 2025 -gradle.version=8.8 diff --git a/.gradle/buildOutputCleanup/outputFiles.bin b/.gradle/buildOutputCleanup/outputFiles.bin deleted file mode 100644 index 83af394..0000000 Binary files a/.gradle/buildOutputCleanup/outputFiles.bin and /dev/null differ diff --git a/.gradle/file-system.probe b/.gradle/file-system.probe deleted file mode 100644 index 0a94ba4..0000000 Binary files a/.gradle/file-system.probe and /dev/null differ diff --git a/.gradle/vcs-1/gc.properties b/.gradle/vcs-1/gc.properties deleted file mode 100644 index e69de29..0000000 diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 26d3352..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/.idea/.name b/.idea/.name deleted file mode 100644 index 74169cd..0000000 --- a/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -regions \ No newline at end of file diff --git a/.idea/artifacts/regions_jar.xml b/.idea/artifacts/regions_jar.xml deleted file mode 100644 index 321e226..0000000 --- a/.idea/artifacts/regions_jar.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - $PROJECT_DIR$/../../testing/mcregions/plugins/ - - - - - - \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index b86273d..0000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml deleted file mode 100644 index f2c1963..0000000 --- a/.idea/gradle.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml deleted file mode 100644 index 17d4326..0000000 --- a/.idea/inspectionProfiles/Project_Default.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/mcregions.iml b/.idea/mcregions.iml deleted file mode 100644 index d6ebd48..0000000 --- a/.idea/mcregions.iml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 5cd9a10..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/.idea/modules/regions.main.iml b/.idea/modules/regions.main.iml deleted file mode 100644 index bbeeb3e..0000000 --- a/.idea/modules/regions.main.iml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - PAPER - ADVENTURE - - 1 - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/README.md b/README.md index c4aceff..bf357cf 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,24 @@ -# Eye of Nemesis -Eye of Nemesis is a Minecraft Paper plugin that allows server admins to write *policies* that will deny or allow (black/whitelist) players to do specific things. +eye_of_nemesis_social_cover -You can create policies based on player location, ~but other types of policies are available, like permission and player-name policy.~ (WIP) +[![Modrinth Badge](https://img.shields.io/badge/Modrinth-Black?style=social&logo=Modrinth&logoColor=green)](https://modrinth.com/plugin/eye-of-nemesis) +[![English Wiki Badge](https://img.shields.io/badge/English-White?style=flat-square&label=Wiki&color=black)](https://github.com/adrianvic/NemesisEye/wiki) +[![Portuguese Wiki Badge](https://img.shields.io/badge/Portuguese-White?style=flat-square&label=Wiki&color=black)](https://mgr.rf.gd/w/Eye_of_Nemesis) + +> [!IMPORTANT] +> This project is in an early stage, please report any bug you find. + +# Eye of Nemesis +Eye of Nemesis is a plugin that allows server admins to write policies that will deny or allow (black/whitelist) players to do specific things based on the value of nodes. + +## Motivations +I made this plugin as an effort to preserve a village from my private server. Originally from beta 1.7.3 Betalands server, then transferred to RetroMC, and then finally we downloaded the chunks to merge into our server, I was afraid it would not have the same feeling after all the updates, so I had the idea to make a plugin that can block the newer features. + +## Game version and loaders +Since version 1.0.3-SNAPSHOT, Eye of Nemesis has _reflection_, a technique that allows me to target multiple versions of the game while sharing the codebase across versions. + +Currently, we support the following Minecraft versions/loaders: +- **PaperMC** `1.21, 1.21.1, 1.21.2, 1.21.3, 1.21.4, 1.21.5, 1.21.6, 1.21.7, 1.21.8, 1.21.9, 1.21.10` +- **Bukkit** `b1.7.3 (CB1060)` + +## Performance +This plugin is not scalable as it is and will end up running unoptimized checks when your players do things with policies in effect, I made it for a server with a few friends. I'll look forward into writing more performant code after all my other priorities are implemented. diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 36427d7..0000000 --- a/build.gradle +++ /dev/null @@ -1,55 +0,0 @@ -plugins { - id 'java' - id("xyz.jpenilla.run-paper") version "2.3.1" -} - -group = 'io.github.adrianvic' -version = '1.0-SNAPSHOT' - -repositories { - mavenCentral() - maven { - name = "papermc-repo" - url = "https://repo.papermc.io/repository/maven-public/" - } -} - -dependencies { - compileOnly("io.papermc.paper:paper-api:1.21.10-R0.1-SNAPSHOT") -} - -tasks { - runServer { - // Configure the Minecraft version for our task. - // This is the only required configuration besides applying the plugin. - // Your plugin's jar (or shadowJar if present) will be used automatically. - minecraftVersion("1.21") - } -} - -def targetJavaVersion = 21 -java { - def javaVersion = JavaVersion.toVersion(targetJavaVersion) - sourceCompatibility = javaVersion - targetCompatibility = javaVersion - if (JavaVersion.current() < javaVersion) { - toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion) - } -} - -tasks.withType(JavaCompile).configureEach { - options.encoding = 'UTF-8' - - if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) { - options.release.set(targetJavaVersion) - } -} - -processResources { - def props = [version: version] - inputs.properties props - filteringCharset 'UTF-8' - filesMatching('plugin.yml') { - expand props - } -} diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..e2d9a2e --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,154 @@ +plugins { + java + id("xyz.jpenilla.run-paper") version "2.3.1" +} + +group = "io.github.adrianvic" +version = System.getenv("NEMESIS_VERSION_NAME") ?: "unknown" + +repositories { + mavenCentral() + maven("https://repo.papermc.io/repository/maven-public/") +} + +/* ----------------------------------------- */ +/* SUPPORTED VERSIONS */ +/* ----------------------------------------- */ + +val mcVersions = listOf( + "b1_7_3", + "r1_21" +) + +/* ----------------------------------------- */ +/* CREATE SOURCE SET PER VERSION */ +/* ----------------------------------------- */ + +tasks.withType { + inputs.property("version", project.version) + + filesMatching("plugin.yml") { + expand("version" to project.version) + } +} + +mcVersions.forEach { ver -> + val ss = sourceSets.create(ver) { + java.srcDir("src/$ver/java") + + resources.setSrcDirs(listOf("src/$ver/resources", "src/main/resources")) + + compileClasspath += sourceSets["main"].output + runtimeClasspath += output + compileClasspath + } + + tasks.withType { + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + } + + configurations[ss.implementationConfigurationName] + .extendsFrom(configurations["implementation"]) + + configurations[ss.compileOnlyConfigurationName] + .extendsFrom(configurations["compileOnly"]) + +} + +/* ----------------------------------------- */ +/* DEPENDENCIES */ +/* ----------------------------------------- */ + +dependencies { + add("compileOnly", "io.papermc.paper:paper-api:1.21-R0.1-SNAPSHOT") + add("r1_21CompileOnly", "io.papermc.paper:paper-api:1.21-R0.1-SNAPSHOT") + add("b1_7_3CompileOnly", files("libs/craftbukkit-1060.jar")) + + testImplementation("org.junit.jupiter:junit-jupiter:5.10.0") + testImplementation("org.mockito:mockito-core:5.5.0") + testRuntimeOnly("org.junit.platform:junit-platform-launcher") + testImplementation("io.papermc.paper:paper-api:1.21-R0.1-SNAPSHOT") + testImplementation("com.github.seeseemelk:MockBukkit-v1.21:3.102.0") + + // Allow tests to see the versioned implementations + mcVersions.forEach { ver -> + testImplementation(sourceSets[ver].output) + } +} + +tasks.test { + useJUnitPlatform() +} + +/* ----------------------------------------- */ +/* BUILD TASKS */ +/* ----------------------------------------- */ + +mcVersions.forEach { ver -> + tasks.register("jar${ver.replace(".", "_").replace("-", "_").replace("/", "_").capitalize()}") { + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + from(sourceSets["main"].output) + from(sourceSets[ver].output) + archiveClassifier.set(ver) + + manifest { + attributes( + "Nemesis-Impl-Version" to ver, + "Nemesis-Environment" to (System.getenv("NEMESIS_BUILD_CHANNEL") ?: "dev") + ) + } + + } +} + +tasks.register("buildAll") { + dependsOn(tasks.withType()) +} + +tasks.register("shadowJar") { + from(sourceSets["main"].output) + mcVersions.forEach { ver -> + from(sourceSets[ver].output) + } + + // This is kinda gross and, essentially, we shouldn't have it here... + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + + archiveClassifier.set("all-implementations") + archiveVersion.set(project.version.toString()) + + manifest { + attributes( + "Implemented-Versions" to mcVersions.joinToString(",") + ) + } +} + +/* ----------------------------------------- */ +/* JAVA SETTINGS */ +/* ----------------------------------------- */ + +java { + toolchain.languageVersion.set(JavaLanguageVersion.of(21)) +} + +tasks.withType { + options.encoding = "UTF-8" +} + +tasks.runServer { + minecraftVersion("1.21") + downloadPlugins { + modrinth("viaversion", "5.7.0") + modrinth("luckperms", "v5.5.17-bukkit") + } +} + +tasks.register("runServerClean") { + doFirst { + exec { + commandLine("rm", "run/plugins/Eye-of-Nemesis/settings.yml") + } + } + + dependsOn("runServer") +} \ No newline at end of file diff --git a/build/classes/java/main/io/github/adrianvic/nemesiseye/Config.class b/build/classes/java/main/io/github/adrianvic/nemesiseye/Config.class deleted file mode 100644 index fc9103e..0000000 Binary files a/build/classes/java/main/io/github/adrianvic/nemesiseye/Config.class and /dev/null differ diff --git a/build/classes/java/main/io/github/adrianvic/nemesiseye/DataShifter.class b/build/classes/java/main/io/github/adrianvic/nemesiseye/DataShifter.class deleted file mode 100644 index 7dd4a1f..0000000 Binary files a/build/classes/java/main/io/github/adrianvic/nemesiseye/DataShifter.class and /dev/null differ diff --git a/build/classes/java/main/io/github/adrianvic/nemesiseye/EventListener.class b/build/classes/java/main/io/github/adrianvic/nemesiseye/EventListener.class deleted file mode 100644 index 7beeaf7..0000000 Binary files a/build/classes/java/main/io/github/adrianvic/nemesiseye/EventListener.class and /dev/null differ diff --git a/build/classes/java/main/io/github/adrianvic/nemesiseye/Nemesis.class b/build/classes/java/main/io/github/adrianvic/nemesiseye/Nemesis.class deleted file mode 100644 index cced384..0000000 Binary files a/build/classes/java/main/io/github/adrianvic/nemesiseye/Nemesis.class and /dev/null differ diff --git a/build/classes/java/main/io/github/adrianvic/nemesiseye/Validator.class b/build/classes/java/main/io/github/adrianvic/nemesiseye/Validator.class deleted file mode 100644 index 12cf9e4..0000000 Binary files a/build/classes/java/main/io/github/adrianvic/nemesiseye/Validator.class and /dev/null differ diff --git a/build/classes/java/main/io/github/adrianvic/nemesiseye/commands/Eye.class b/build/classes/java/main/io/github/adrianvic/nemesiseye/commands/Eye.class deleted file mode 100644 index 418ee9c..0000000 Binary files a/build/classes/java/main/io/github/adrianvic/nemesiseye/commands/Eye.class and /dev/null differ diff --git a/build/classes/java/main/io/github/adrianvic/nemesiseye/commands/sub/CurrentPolicies.class b/build/classes/java/main/io/github/adrianvic/nemesiseye/commands/sub/CurrentPolicies.class deleted file mode 100644 index 02f78ce..0000000 Binary files a/build/classes/java/main/io/github/adrianvic/nemesiseye/commands/sub/CurrentPolicies.class and /dev/null differ diff --git a/build/classes/java/main/io/github/adrianvic/nemesiseye/commands/sub/ListPolicies.class b/build/classes/java/main/io/github/adrianvic/nemesiseye/commands/sub/ListPolicies.class deleted file mode 100644 index c3f131a..0000000 Binary files a/build/classes/java/main/io/github/adrianvic/nemesiseye/commands/sub/ListPolicies.class and /dev/null differ diff --git a/build/classes/java/main/io/github/adrianvic/nemesiseye/commands/sub/PolicyInfo.class b/build/classes/java/main/io/github/adrianvic/nemesiseye/commands/sub/PolicyInfo.class deleted file mode 100644 index 7b25602..0000000 Binary files a/build/classes/java/main/io/github/adrianvic/nemesiseye/commands/sub/PolicyInfo.class and /dev/null differ diff --git a/build/classes/java/main/io/github/adrianvic/nemesiseye/commands/sub/Reload.class b/build/classes/java/main/io/github/adrianvic/nemesiseye/commands/sub/Reload.class deleted file mode 100644 index 38f2627..0000000 Binary files a/build/classes/java/main/io/github/adrianvic/nemesiseye/commands/sub/Reload.class and /dev/null differ diff --git a/build/classes/java/main/io/github/adrianvic/nemesiseye/commands/sub/Subcommand.class b/build/classes/java/main/io/github/adrianvic/nemesiseye/commands/sub/Subcommand.class deleted file mode 100644 index 6f93a73..0000000 Binary files a/build/classes/java/main/io/github/adrianvic/nemesiseye/commands/sub/Subcommand.class and /dev/null differ diff --git a/build/classes/java/main/io/github/adrianvic/nemesiseye/policy/Action.class b/build/classes/java/main/io/github/adrianvic/nemesiseye/policy/Action.class deleted file mode 100644 index 6f1c0fe..0000000 Binary files a/build/classes/java/main/io/github/adrianvic/nemesiseye/policy/Action.class and /dev/null differ diff --git a/build/classes/java/main/io/github/adrianvic/nemesiseye/policy/LocationPolicy.class b/build/classes/java/main/io/github/adrianvic/nemesiseye/policy/LocationPolicy.class deleted file mode 100644 index a15c3c8..0000000 Binary files a/build/classes/java/main/io/github/adrianvic/nemesiseye/policy/LocationPolicy.class and /dev/null differ diff --git a/build/classes/java/main/io/github/adrianvic/nemesiseye/policy/NodeHandler.class b/build/classes/java/main/io/github/adrianvic/nemesiseye/policy/NodeHandler.class deleted file mode 100644 index 35ed765..0000000 Binary files a/build/classes/java/main/io/github/adrianvic/nemesiseye/policy/NodeHandler.class and /dev/null differ diff --git a/build/classes/java/main/io/github/adrianvic/nemesiseye/policy/NodeHandlers.class b/build/classes/java/main/io/github/adrianvic/nemesiseye/policy/NodeHandlers.class deleted file mode 100644 index 1f38b52..0000000 Binary files a/build/classes/java/main/io/github/adrianvic/nemesiseye/policy/NodeHandlers.class and /dev/null differ diff --git a/build/classes/java/main/io/github/adrianvic/nemesiseye/policy/NodeValueParser.class b/build/classes/java/main/io/github/adrianvic/nemesiseye/policy/NodeValueParser.class deleted file mode 100644 index 86cedeb..0000000 Binary files a/build/classes/java/main/io/github/adrianvic/nemesiseye/policy/NodeValueParser.class and /dev/null differ diff --git a/build/classes/java/main/io/github/adrianvic/nemesiseye/policy/PermissionPolicy.class b/build/classes/java/main/io/github/adrianvic/nemesiseye/policy/PermissionPolicy.class deleted file mode 100644 index 3005c0b..0000000 Binary files a/build/classes/java/main/io/github/adrianvic/nemesiseye/policy/PermissionPolicy.class and /dev/null differ diff --git a/build/classes/java/main/io/github/adrianvic/nemesiseye/policy/PlayerNamePolicy.class b/build/classes/java/main/io/github/adrianvic/nemesiseye/policy/PlayerNamePolicy.class deleted file mode 100644 index 244062f..0000000 Binary files a/build/classes/java/main/io/github/adrianvic/nemesiseye/policy/PlayerNamePolicy.class and /dev/null differ diff --git a/build/classes/java/main/io/github/adrianvic/nemesiseye/policy/PolicyNode.class b/build/classes/java/main/io/github/adrianvic/nemesiseye/policy/PolicyNode.class deleted file mode 100644 index 6645152..0000000 Binary files a/build/classes/java/main/io/github/adrianvic/nemesiseye/policy/PolicyNode.class and /dev/null differ diff --git a/build/classes/java/main/io/github/adrianvic/nemesiseye/policy/handlers/attackWith.class b/build/classes/java/main/io/github/adrianvic/nemesiseye/policy/handlers/attackWith.class deleted file mode 100644 index 8f29cb3..0000000 Binary files a/build/classes/java/main/io/github/adrianvic/nemesiseye/policy/handlers/attackWith.class and /dev/null differ diff --git a/build/classes/java/main/io/github/adrianvic/nemesiseye/policy/handlers/useEnchantment.class b/build/classes/java/main/io/github/adrianvic/nemesiseye/policy/handlers/useEnchantment.class deleted file mode 100644 index 03581d3..0000000 Binary files a/build/classes/java/main/io/github/adrianvic/nemesiseye/policy/handlers/useEnchantment.class and /dev/null differ diff --git a/build/classes/java/main/io/github/adrianvic/nemesiseye/policy/handlers/useItem.class b/build/classes/java/main/io/github/adrianvic/nemesiseye/policy/handlers/useItem.class deleted file mode 100644 index af645a1..0000000 Binary files a/build/classes/java/main/io/github/adrianvic/nemesiseye/policy/handlers/useItem.class and /dev/null differ diff --git a/build/resources/main/plugin.yml b/build/resources/main/plugin.yml deleted file mode 100644 index 612eeed..0000000 --- a/build/resources/main/plugin.yml +++ /dev/null @@ -1,4 +0,0 @@ -name: regions -version: '1.0-SNAPSHOT' -main: io.github.adrianvic.regions.Regions -api-version: '1.21' diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/PlaceListener.class.uniqueId1 b/build/tmp/compileJava/compileTransaction/stash-dir/PlaceListener.class.uniqueId1 deleted file mode 100644 index 816f2df..0000000 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/PlaceListener.class.uniqueId1 and /dev/null differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/Regions.class.uniqueId0 b/build/tmp/compileJava/compileTransaction/stash-dir/Regions.class.uniqueId0 deleted file mode 100644 index fe7a516..0000000 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/Regions.class.uniqueId0 and /dev/null differ diff --git a/build/tmp/compileJava/previous-compilation-data.bin b/build/tmp/compileJava/previous-compilation-data.bin deleted file mode 100644 index 10eecb4..0000000 Binary files a/build/tmp/compileJava/previous-compilation-data.bin and /dev/null differ diff --git a/docs/Nodes.md b/docs/Nodes.md new file mode 100644 index 0000000..57cff1d --- /dev/null +++ b/docs/Nodes.md @@ -0,0 +1,34 @@ +# Nodes +Nodes narrow down even further if an action can be done or not. A node needs _properties_ to know what it should check against, for example, a HIT node needs a _list_ of blocks that it will check if the player is holding; while a USE_ENCHANTMENT node needs a mapping of enchantment to level. Some nodes like glyde don't need a value and will ignore if you provide one. +```yaml +nodes: + - [HIT]: + values: + - 'GOLD_SWORD' + - [USE_ENCHANTMENT]: + values: + - "UNBREAKING": "1" + - [GLYDE] +``` + +## Available nodes +### INTERACT +Triggered on `InteractionEvent`, returns true when the provided `list` contains the material used to interact. + +### HIT +Triggered on `EntityDamageByEntityEvent`, returns true when the provided `list` contains the material used to hit. + +### PLACE +Triggered on `BlockPlaceEvent`, returns true when the provided `list` contains the material being placed. + +### BREAK +Triggered on `BlockBreakEvent`, returns true when the provided `list` contains the material used to break. + +### EQUIP +Triggered on `InventoryClickEvent` and `PlayerInteractEvent` (only if item is an armor), returns true when the provided `list` contains the material being equipped. + +### GLYDE +Triggered on `PlayerMoveEvent`, returns true if player is gliding. + +### USE_ENCHANTMENT +Triggered on `BlockBreakEvent` and `onEntityDamageByEntityEvent`, returns true the used item has an enchantment matching the provided mapping of enchantment-level. \ No newline at end of file diff --git a/docs/Policies.md b/docs/Policies.md new file mode 100644 index 0000000..21d468d --- /dev/null +++ b/docs/Policies.md @@ -0,0 +1,89 @@ +# Policies +Policies are a list of nodes with a specific condition to be met, they also determine what effect a node is going to have. Below is an example policy: +```yaml + - name: "Allow example" + type: "location" + effect: ALLOW + weight: 1 + worlds: [world] + locations: + coordinates: + - corner1: { x: 2100, y: 256, z: 1400 } + corner2: { x: 1000, y: -64, z: 2200 } + nodes: + - [INTERACT, BREAK, HIT, PLACE]: + values: + - AIR +``` + +## Properties +### `name` +Name of the policy, must not contain spaces or else commands that require you to type the policy name will not work. + +Example: `name: "disable-axe-damage"` + +### `type` +One of the policy [types](#Types). + +Example: `type: location` + +### `effect` +Can be `deny` to block the action if a node check returns true, `ALLOW` to revert `DENY` effects if the node check is true or `ALLOWONLY` to allow the action **only** if the node check returns true. + +Example: `effect: DENY` + +### `weight` +A policy with greater weight will override a conflicting policy of lower weight. + +Example: `weight: 0` + +### `nodes` +Must contain a list of node mappings to evaluate if the policy applies to a player. + +Example: +```yaml +nodes: + - [HIT]: + values: + - '.*_AXE$' +``` + +### `locations` +Only used for `type: "location"`, is a list of mappings where corner1 and corner2 should map x, y and z to two corners of a rectangular area where the policy will take effect; `worlds` may be defined here. + +Example: + +```yaml +locations: + worlds: [world] + coordinates: + - corner1: { x: 2100, y: 256, z: 1400 } + corner2: { x: 1000, y: -64, z: 2200 } +``` + +### `permissions` +Only used for `type: "permission"`, is a list of permissions. + +Example: + +```yaml +permissions: + - "server.axehit" +``` + +### `names` +Only used for `type: "playerName"`, is a list of player names. + +## Types + +### `global` +Always matches. + +### `location` +Matches if the player location is inside any rectangle defined in the `locations` property. + +### `playerName` +Matches if the player name is in the `names` property. + +### `permission` +Matches if the player has a permission in the `permissions` property. diff --git a/out/production/resources/plugin.yml b/out/production/resources/plugin.yml deleted file mode 100644 index 8b85727..0000000 --- a/out/production/resources/plugin.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: "Eye-of-Nemesis" -version: '1.0-SNAPSHOT' -main: io.github.adrianvic.nemesiseye.Nemesis -api-version: '1.21' -author: 'Adrian Victor' -website: "https://github.io/adrianvic/NemesisEye" -description: "Change what players can do based in custom criteria." -commands: - eye: - usage: "/eye