diff --git a/.github/workflows/java_ci.yml b/.github/workflows/ci.yml similarity index 60% rename from .github/workflows/java_ci.yml rename to .github/workflows/ci.yml index 127e3e86..8e1ecc34 100644 --- a/.github/workflows/java_ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,5 @@ # Builds, tests the project with Gradle and uploads to Modrinth -name: Java CI +name: CI Tests & Publish on: push: @@ -35,7 +35,7 @@ jobs: - name: Get Version run: | echo "version_name=${{steps.fetch-version.outputs.VERSION_NAME}}" >> $GITHUB_ENV - - name: Upload to Modrinth + - name: Upload to Modrinth (Spigot) uses: Kir-Antipov/mc-publish@v3.2 with: modrinth-id: J6U9o3JG @@ -46,7 +46,7 @@ jobs: dynmap | suggests | * pl3xmap | suggests | * files-primary: target/HuskHomes-Plugin-*.jar - name: HuskHomes v${{ env.version_name }} + name: HuskHomes (Spigot) v${{ env.version_name }} version: ${{ env.version_name }} version-type: alpha changelog: ${{ github.event.head_commit.message }} @@ -60,8 +60,36 @@ jobs: 1.18.2 1.19.4 java: 16 + - name: Upload to Modrinth & CurseForge (Fabric) + uses: Kir-Antipov/mc-publish@v3.2 + with: + modrinth-id: J6U9o3JG + modrinth-featured: false + modrinth-token: ${{ secrets.MODRINTH_TOKEN }} + curseforge-id: 849217 + curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} + dependencies: | + fabric-api | requires | * + bluemap | suggests | * + dynmap | suggests | * + luckperms | suggests | * + files-primary: target/HuskHomes-Fabric-*.jar + name: HuskHomes (Fabric) v${{ env.version_name }} + version: ${{ env.version_name }} + version-type: alpha + changelog: ${{ github.event.head_commit.message }} + loaders: | + fabric + game-versions: | + 1.19.4 + java: 17 + - name: Upload GitHub Artifact (Spigot) + uses: actions/upload-artifact@v2 + with: + name: HuskHomes (Spigot) + path: target/HuskHomes-Plugin-*.jar - name: Upload GitHub Artifact uses: actions/upload-artifact@v2 with: - name: HuskHomes Plugin - path: target/HuskHomes-Plugin-*.jar \ No newline at end of file + name: HuskHomes (Fabric) + path: target/HuskHomes-Fabric-*.jar \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..2fce2c1b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,88 @@ +# Publishes a release to Modrinth and CurseForge when a release is published on GitHub. +name: Release Test & Publish + +on: + release: + types: [ published ] + +permissions: + contents: read + checks: write + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + - name: Build with Gradle + uses: gradle/gradle-build-action@v2 + with: + arguments: build test + - name: Publish Test Report + uses: mikepenz/action-junit-report@v3 + if: success() || failure() # always run even if the previous step fails + with: + report_paths: '**/build/test-results/test/TEST-*.xml' + - name: Upload to Modrinth (Spigot) + uses: Kir-Antipov/mc-publish@v3.2 + with: + modrinth-id: J6U9o3JG + modrinth-featured: false + modrinth-token: ${{ secrets.MODRINTH_TOKEN }} + modrinth-dependencies: | + bluemap | suggests | * + dynmap | suggests | * + pl3xmap | suggests | * + files-primary: target/HuskHomes-Plugin-*.jar + name: HuskHomes (Spigot) v${{ github.event.release.tag_name }} + version: ${{ github.event.release.tag_name }} + version-type: release + changelog: ${{ github.event.release.body }} + loaders: | + spigot + paper + purpur + game-versions: | + 1.16.5 + 1.17.1 + 1.18.2 + 1.19.4 + java: 16 + - name: Upload to Modrinth & CurseForge (Fabric) + uses: Kir-Antipov/mc-publish@v3.2 + with: + modrinth-id: J6U9o3JG + modrinth-featured: false + modrinth-token: ${{ secrets.MODRINTH_TOKEN }} + curseforge-id: 849217 + curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} + dependencies: | + fabric-api | requires | * + bluemap | suggests | * + dynmap | suggests | * + luckperms | suggests | * + files-primary: target/HuskHomes-Fabric-*.jar + name: HuskHomes (Fabric) v${{ github.event.release.tag_name }} + version: ${{ github.event.release.tag_name }} + version-type: release + changelog: ${{ github.event.release.body }} + loaders: | + fabric + game-versions: | + 1.19.4 + java: 17 + - name: Upload GitHub Artifact (Spigot) + uses: actions/upload-artifact@v2 + with: + name: HuskHomes (Spigot) + path: target/HuskHomes-Plugin-*.jar + - name: Upload GitHub Artifact + uses: actions/upload-artifact@v2 + with: + name: HuskHomes (Fabric) + path: target/HuskHomes-Fabric-*.jar \ No newline at end of file diff --git a/HEADER b/HEADER new file mode 100644 index 00000000..1ee179f2 --- /dev/null +++ b/HEADER @@ -0,0 +1,16 @@ +This file is part of HuskHomes, licensed under the Apache License 2.0. + + Copyright (c) William278 + Copyright (c) contributors + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/README.md b/README.md index c00d1cdf..7d8cc6c5 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@


-**HuskHomes** is a powerful, intuitive and flexible teleportation plugin for Spigot-based Minecraft servers. The plugin supports a wide array of features; from teleporting between players, teleport requests, public and private homes, warps, random teleporting and more. +**HuskHomes** is a powerful, intuitive and flexible teleportation plugin for Spigot and Fabric-based Minecraft servers. The plugin supports a wide array of features; from teleporting between players, teleport requests, public and private homes, warps, random teleporting and more. All of this is supported on standalone and cross-server setups; players can set home and teleport on and between multiple servers on a proxy network. @@ -43,7 +43,7 @@ All of this is supported on standalone and cross-server setups; players can set **⭐ Extensible API & open-source** — Still not enough? Extend the plugin with the HuskHomes API. Or, submit a pull request—we're open-source! ## Building -HuskHomes requires Java 17 to build (required for Paper plugin 1.19.x support). To build, simply run the following in the root of the repository: +HuskHomes requires Java 17 to build. To build, simply run the following in the root of the repository: ```bash ./gradlew clean build @@ -62,7 +62,7 @@ Translations of the plugin locales are welcome to help make the plugin more acce ## Links - [Docs](https://william278.net/docs/huskhomes/) — Read the plugin documentation! -- [Spigot](https://www.spigotmc.org/resources/huskhomes.83767/) — View the Spigot resource page (Also: [Polymart](https://polymart.org/resource/huskhomes.284/), [Modrinth](https://modrinth.com/plugin/huskhomes)) +- [Spigot](https://www.spigotmc.org/resources/huskhomes.83767/) — View the Spigot resource page (Also: [Polymart](https://polymart.org/resource/huskhomes.284/), [Modrinth](https://modrinth.com/plugin/huskhomes), [CurseForge](https://www.curseforge.com/minecraft/mc-mods/huskhomes/)) - [Issues](https://github.com/WiIIiam278/HuskHomes2/issues) — File a bug report or feature request - [Discord](https://discord.gg/tVYhJfyDWG) — Get help, ask questions - [bStats](https://bstats.org/plugin/bukkit/HuskHomes/8430) — View plugin metrics diff --git a/build.gradle b/build.gradle index 7fcb2298..f640cdfa 100644 --- a/build.gradle +++ b/build.gradle @@ -2,6 +2,7 @@ import org.apache.tools.ant.filters.ReplaceTokens plugins { id 'com.github.johnrengelman.shadow' version '8.1.1' + id 'org.cadixdev.licenser' version '0.6.1' apply false id 'org.ajoberstar.grgit' version '5.0.0' id 'maven-publish' id 'java' @@ -9,6 +10,7 @@ plugins { group 'net.william278' version "$ext.plugin_version-${versionMetadata()}" +defaultTasks 'licenseFormat', 'build' ext { set 'version', version.toString() @@ -19,6 +21,7 @@ ext { allprojects { apply plugin: 'com.github.johnrengelman.shadow' + apply plugin: 'org.cadixdev.licenser' apply plugin: 'java' compileJava.options.encoding = 'UTF-8' @@ -29,6 +32,7 @@ allprojects { repositories { mavenLocal() mavenCentral() + maven { url 'https://maven.fabricmc.net/' } maven { url 'https://libraries.minecraft.net/' } maven { url 'https://api.modrinth.com/maven' } maven { url 'https://repo.papermc.io/repository/maven-public/' } @@ -50,29 +54,40 @@ allprojects { useJUnitPlatform() } + license { + header = rootProject.file('HEADER') + include '**/*.java' + newLine = true + } + processResources { - filesNotMatching(['**/*.png', '**/*.svg']) { + filesMatching(['**/*.json', '**/*.yml']) { filter ReplaceTokens as Class, beginToken: '${', endToken: '}', tokens: rootProject.ext.properties } } + } subprojects { version rootProject.version archivesBaseName = "${rootProject.name}-${project.name.capitalize()}" + compileJava.options.encoding = 'UTF-8' - if ('paper'.contains(project.name)) { + jar { + from '../LICENSE' + } + + if (['paper', 'fabric'].contains(project.name)) { compileJava.options.release.set 17 } - if (['bukkit', 'paper', 'plugin'].contains(project.name)) { + if (['bukkit', 'paper', 'plugin', 'fabric'].contains(project.name)) { shadowJar { destinationDirectory.set(file("$rootDir/target")) archiveClassifier.set('') } - // API publishing if (['bukkit'].contains(project.name)) { java { withSourcesJar() @@ -120,4 +135,5 @@ def versionMetadata() { return System.getenv("GITHUB_RUN_NUMBER") ? 'build.' + System.getenv("GITHUB_RUN_NUMBER") : 'unknown' } return grgit.head().abbreviatedId + (grgit.status().clean ? '' : '-indev') -} \ No newline at end of file +} + diff --git a/bukkit/build.gradle b/bukkit/build.gradle index 3882dfe0..f103f6ac 100644 --- a/bukkit/build.gradle +++ b/bukkit/build.gradle @@ -1,5 +1,5 @@ dependencies { - implementation project(path: ':common') + implementation project(':common') implementation 'org.bstats:bstats-bukkit:3.0.2' implementation 'io.papermc:paperlib:1.0.8' @@ -43,7 +43,6 @@ shadowJar { relocate 'org.yaml.snakeyaml', 'net.william278.huskhomes.libraries.snakeyaml' relocate 'com.google.gson', 'net.william278.huskhomes.libraries.gson' relocate 'net.kyori', 'net.william278.huskhomes.libraries' - relocate 'org.bstats', 'net.william278.huskhomes.libraries.bstats' relocate 'io.papermc.lib', 'net.william278.huskhomes.libraries.paperlib' relocate 'me.lucko.commodore', 'net.william278.huskhomes.libraries.commodore' diff --git a/bukkit/src/main/java/net/william278/huskhomes/BukkitHuskHomes.java b/bukkit/src/main/java/net/william278/huskhomes/BukkitHuskHomes.java index ace758aa..96c04c54 100644 --- a/bukkit/src/main/java/net/william278/huskhomes/BukkitHuskHomes.java +++ b/bukkit/src/main/java/net/william278/huskhomes/BukkitHuskHomes.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes; import io.papermc.lib.PaperLib; diff --git a/bukkit/src/main/java/net/william278/huskhomes/api/HuskHomesAPI.java b/bukkit/src/main/java/net/william278/huskhomes/api/HuskHomesAPI.java index 317c246e..a8d6add3 100644 --- a/bukkit/src/main/java/net/william278/huskhomes/api/HuskHomesAPI.java +++ b/bukkit/src/main/java/net/william278/huskhomes/api/HuskHomesAPI.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.api; import net.william278.huskhomes.BukkitHuskHomes; diff --git a/bukkit/src/main/java/net/william278/huskhomes/command/BrigadierUtil.java b/bukkit/src/main/java/net/william278/huskhomes/command/BrigadierUtil.java index 7bc800be..3b975574 100644 --- a/bukkit/src/main/java/net/william278/huskhomes/command/BrigadierUtil.java +++ b/bukkit/src/main/java/net/william278/huskhomes/command/BrigadierUtil.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.command; import me.lucko.commodore.CommodoreProvider; diff --git a/bukkit/src/main/java/net/william278/huskhomes/command/BukkitCommand.java b/bukkit/src/main/java/net/william278/huskhomes/command/BukkitCommand.java index 23efc6a0..d81aebf6 100644 --- a/bukkit/src/main/java/net/william278/huskhomes/command/BukkitCommand.java +++ b/bukkit/src/main/java/net/william278/huskhomes/command/BukkitCommand.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.command; import me.lucko.commodore.CommodoreProvider; diff --git a/bukkit/src/main/java/net/william278/huskhomes/event/BukkitEventDispatcher.java b/bukkit/src/main/java/net/william278/huskhomes/event/BukkitEventDispatcher.java index a32be4fb..a9919a2e 100644 --- a/bukkit/src/main/java/net/william278/huskhomes/event/BukkitEventDispatcher.java +++ b/bukkit/src/main/java/net/william278/huskhomes/event/BukkitEventDispatcher.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.event; import net.william278.huskhomes.position.Home; diff --git a/bukkit/src/main/java/net/william278/huskhomes/event/DeleteAllHomesEvent.java b/bukkit/src/main/java/net/william278/huskhomes/event/DeleteAllHomesEvent.java index 8da31a03..8002f072 100644 --- a/bukkit/src/main/java/net/william278/huskhomes/event/DeleteAllHomesEvent.java +++ b/bukkit/src/main/java/net/william278/huskhomes/event/DeleteAllHomesEvent.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.event; import net.william278.huskhomes.user.CommandUser; diff --git a/bukkit/src/main/java/net/william278/huskhomes/event/DeleteAllWarpsEvent.java b/bukkit/src/main/java/net/william278/huskhomes/event/DeleteAllWarpsEvent.java index 2658dcf3..98eaa396 100644 --- a/bukkit/src/main/java/net/william278/huskhomes/event/DeleteAllWarpsEvent.java +++ b/bukkit/src/main/java/net/william278/huskhomes/event/DeleteAllWarpsEvent.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.event; import net.william278.huskhomes.user.CommandUser; diff --git a/bukkit/src/main/java/net/william278/huskhomes/event/HomeCreateEvent.java b/bukkit/src/main/java/net/william278/huskhomes/event/HomeCreateEvent.java index dbb5a2b7..9eb21fba 100644 --- a/bukkit/src/main/java/net/william278/huskhomes/event/HomeCreateEvent.java +++ b/bukkit/src/main/java/net/william278/huskhomes/event/HomeCreateEvent.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.event; import net.william278.huskhomes.position.Position; diff --git a/bukkit/src/main/java/net/william278/huskhomes/event/HomeDeleteEvent.java b/bukkit/src/main/java/net/william278/huskhomes/event/HomeDeleteEvent.java index 7ea06f13..b90cad08 100644 --- a/bukkit/src/main/java/net/william278/huskhomes/event/HomeDeleteEvent.java +++ b/bukkit/src/main/java/net/william278/huskhomes/event/HomeDeleteEvent.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.event; import net.william278.huskhomes.position.Home; diff --git a/bukkit/src/main/java/net/william278/huskhomes/event/HomeEditEvent.java b/bukkit/src/main/java/net/william278/huskhomes/event/HomeEditEvent.java index 55cf2414..9a1faf35 100644 --- a/bukkit/src/main/java/net/william278/huskhomes/event/HomeEditEvent.java +++ b/bukkit/src/main/java/net/william278/huskhomes/event/HomeEditEvent.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.event; import net.william278.huskhomes.position.Home; diff --git a/bukkit/src/main/java/net/william278/huskhomes/event/HomeListEvent.java b/bukkit/src/main/java/net/william278/huskhomes/event/HomeListEvent.java index d622e783..b864fddb 100644 --- a/bukkit/src/main/java/net/william278/huskhomes/event/HomeListEvent.java +++ b/bukkit/src/main/java/net/william278/huskhomes/event/HomeListEvent.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.event; import net.william278.huskhomes.position.Home; diff --git a/bukkit/src/main/java/net/william278/huskhomes/event/ReceiveTeleportRequestEvent.java b/bukkit/src/main/java/net/william278/huskhomes/event/ReceiveTeleportRequestEvent.java index 3f88234c..751aeb36 100644 --- a/bukkit/src/main/java/net/william278/huskhomes/event/ReceiveTeleportRequestEvent.java +++ b/bukkit/src/main/java/net/william278/huskhomes/event/ReceiveTeleportRequestEvent.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.event; import net.william278.huskhomes.teleport.TeleportRequest; diff --git a/bukkit/src/main/java/net/william278/huskhomes/event/ReplyTeleportRequestEvent.java b/bukkit/src/main/java/net/william278/huskhomes/event/ReplyTeleportRequestEvent.java index cd8a2e57..7976a39d 100644 --- a/bukkit/src/main/java/net/william278/huskhomes/event/ReplyTeleportRequestEvent.java +++ b/bukkit/src/main/java/net/william278/huskhomes/event/ReplyTeleportRequestEvent.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.event; import net.william278.huskhomes.teleport.TeleportRequest; diff --git a/bukkit/src/main/java/net/william278/huskhomes/event/SendTeleportRequestEvent.java b/bukkit/src/main/java/net/william278/huskhomes/event/SendTeleportRequestEvent.java index 5d746f48..d30ab0e2 100644 --- a/bukkit/src/main/java/net/william278/huskhomes/event/SendTeleportRequestEvent.java +++ b/bukkit/src/main/java/net/william278/huskhomes/event/SendTeleportRequestEvent.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.event; import net.william278.huskhomes.teleport.TeleportRequest; diff --git a/bukkit/src/main/java/net/william278/huskhomes/event/TeleportBackEvent.java b/bukkit/src/main/java/net/william278/huskhomes/event/TeleportBackEvent.java index 938e65e1..187d4aad 100644 --- a/bukkit/src/main/java/net/william278/huskhomes/event/TeleportBackEvent.java +++ b/bukkit/src/main/java/net/william278/huskhomes/event/TeleportBackEvent.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.event; import net.william278.huskhomes.position.Position; diff --git a/bukkit/src/main/java/net/william278/huskhomes/event/TeleportEvent.java b/bukkit/src/main/java/net/william278/huskhomes/event/TeleportEvent.java index b1802195..0e98b11d 100644 --- a/bukkit/src/main/java/net/william278/huskhomes/event/TeleportEvent.java +++ b/bukkit/src/main/java/net/william278/huskhomes/event/TeleportEvent.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.event; import net.william278.huskhomes.teleport.Teleport; diff --git a/bukkit/src/main/java/net/william278/huskhomes/event/TeleportWarmupEvent.java b/bukkit/src/main/java/net/william278/huskhomes/event/TeleportWarmupEvent.java index f1417192..62ac5c00 100644 --- a/bukkit/src/main/java/net/william278/huskhomes/event/TeleportWarmupEvent.java +++ b/bukkit/src/main/java/net/william278/huskhomes/event/TeleportWarmupEvent.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.event; import net.william278.huskhomes.teleport.TimedTeleport; diff --git a/bukkit/src/main/java/net/william278/huskhomes/event/WarpCreateEvent.java b/bukkit/src/main/java/net/william278/huskhomes/event/WarpCreateEvent.java index a70b6740..0045a72b 100644 --- a/bukkit/src/main/java/net/william278/huskhomes/event/WarpCreateEvent.java +++ b/bukkit/src/main/java/net/william278/huskhomes/event/WarpCreateEvent.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.event; import net.william278.huskhomes.position.Position; diff --git a/bukkit/src/main/java/net/william278/huskhomes/event/WarpDeleteEvent.java b/bukkit/src/main/java/net/william278/huskhomes/event/WarpDeleteEvent.java index 1bb307bc..7234d6cd 100644 --- a/bukkit/src/main/java/net/william278/huskhomes/event/WarpDeleteEvent.java +++ b/bukkit/src/main/java/net/william278/huskhomes/event/WarpDeleteEvent.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.event; import net.william278.huskhomes.position.Warp; diff --git a/bukkit/src/main/java/net/william278/huskhomes/event/WarpEditEvent.java b/bukkit/src/main/java/net/william278/huskhomes/event/WarpEditEvent.java index 3d1f133c..1e495d50 100644 --- a/bukkit/src/main/java/net/william278/huskhomes/event/WarpEditEvent.java +++ b/bukkit/src/main/java/net/william278/huskhomes/event/WarpEditEvent.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.event; import net.william278.huskhomes.position.Warp; diff --git a/bukkit/src/main/java/net/william278/huskhomes/event/WarpListEvent.java b/bukkit/src/main/java/net/william278/huskhomes/event/WarpListEvent.java index 8e91f20f..b9f9aa39 100644 --- a/bukkit/src/main/java/net/william278/huskhomes/event/WarpListEvent.java +++ b/bukkit/src/main/java/net/william278/huskhomes/event/WarpListEvent.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.event; import net.william278.huskhomes.position.Warp; diff --git a/bukkit/src/main/java/net/william278/huskhomes/hook/PlaceholderAPIHook.java b/bukkit/src/main/java/net/william278/huskhomes/hook/PlaceholderAPIHook.java index a331b361..65de4a92 100644 --- a/bukkit/src/main/java/net/william278/huskhomes/hook/PlaceholderAPIHook.java +++ b/bukkit/src/main/java/net/william278/huskhomes/hook/PlaceholderAPIHook.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.hook; import me.clip.placeholderapi.PlaceholderAPIPlugin; diff --git a/bukkit/src/main/java/net/william278/huskhomes/hook/RedisEconomyHook.java b/bukkit/src/main/java/net/william278/huskhomes/hook/RedisEconomyHook.java index 5723288f..0c48b93c 100644 --- a/bukkit/src/main/java/net/william278/huskhomes/hook/RedisEconomyHook.java +++ b/bukkit/src/main/java/net/william278/huskhomes/hook/RedisEconomyHook.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.hook; import dev.unnm3d.rediseconomy.api.RedisEconomyAPI; diff --git a/bukkit/src/main/java/net/william278/huskhomes/hook/VaultEconomyHook.java b/bukkit/src/main/java/net/william278/huskhomes/hook/VaultEconomyHook.java index eb2fa23c..170c5367 100644 --- a/bukkit/src/main/java/net/william278/huskhomes/hook/VaultEconomyHook.java +++ b/bukkit/src/main/java/net/william278/huskhomes/hook/VaultEconomyHook.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.hook; import net.milkbowl.vault.economy.Economy; diff --git a/bukkit/src/main/java/net/william278/huskhomes/listener/BukkitEventListener.java b/bukkit/src/main/java/net/william278/huskhomes/listener/BukkitEventListener.java index 10ad1939..e1bca7ec 100644 --- a/bukkit/src/main/java/net/william278/huskhomes/listener/BukkitEventListener.java +++ b/bukkit/src/main/java/net/william278/huskhomes/listener/BukkitEventListener.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.listener; import net.william278.huskhomes.BukkitHuskHomes; diff --git a/bukkit/src/main/java/net/william278/huskhomes/user/BukkitUser.java b/bukkit/src/main/java/net/william278/huskhomes/user/BukkitUser.java index 438be6c9..07926cbb 100644 --- a/bukkit/src/main/java/net/william278/huskhomes/user/BukkitUser.java +++ b/bukkit/src/main/java/net/william278/huskhomes/user/BukkitUser.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.user; import io.papermc.lib.PaperLib; diff --git a/bukkit/src/main/java/net/william278/huskhomes/util/BukkitAdapter.java b/bukkit/src/main/java/net/william278/huskhomes/util/BukkitAdapter.java index 8af76edf..0a480ef0 100644 --- a/bukkit/src/main/java/net/william278/huskhomes/util/BukkitAdapter.java +++ b/bukkit/src/main/java/net/william278/huskhomes/util/BukkitAdapter.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.util; import net.william278.huskhomes.position.Location; diff --git a/bukkit/src/main/java/net/william278/huskhomes/util/BukkitTaskRunner.java b/bukkit/src/main/java/net/william278/huskhomes/util/BukkitTaskRunner.java index dbac0f8d..274bb7d8 100644 --- a/bukkit/src/main/java/net/william278/huskhomes/util/BukkitTaskRunner.java +++ b/bukkit/src/main/java/net/william278/huskhomes/util/BukkitTaskRunner.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.util; import net.william278.huskhomes.BukkitHuskHomes; @@ -23,8 +42,8 @@ public interface BukkitTaskRunner extends TaskRunner { } @Override - default int runSync(@NotNull Runnable runnable) { - return Bukkit.getScheduler().runTask((BukkitHuskHomes) getPlugin(), runnable).getTaskId(); + default void runSync(@NotNull Runnable runnable) { + Bukkit.getScheduler().runTask((BukkitHuskHomes) getPlugin(), runnable).getTaskId(); } @Override @@ -36,8 +55,8 @@ public interface BukkitTaskRunner extends TaskRunner { } @Override - default int runLater(@NotNull Runnable runnable, long delay) { - return Bukkit.getScheduler().runTaskLater((BukkitHuskHomes) getPlugin(), runnable, delay).getTaskId(); + default void runLater(@NotNull Runnable runnable, long delay) { + Bukkit.getScheduler().runTaskLater((BukkitHuskHomes) getPlugin(), runnable, delay).getTaskId(); } @Override diff --git a/bukkit/src/test/java/net/william278/huskhomes/BukkitPluginTests.java b/bukkit/src/test/java/net/william278/huskhomes/BukkitPluginTests.java index eed5c559..03f0fe81 100644 --- a/bukkit/src/test/java/net/william278/huskhomes/BukkitPluginTests.java +++ b/bukkit/src/test/java/net/william278/huskhomes/BukkitPluginTests.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes; import be.seeseemelk.mockbukkit.MockBukkit; diff --git a/common/build.gradle b/common/build.gradle index ad5971bc..9c528abd 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -1,43 +1,35 @@ +plugins { + id 'java-library' +} + +test { + useJUnitPlatform() +} + dependencies { - implementation 'commons-io:commons-io:2.11.0' - implementation 'org.apache.commons:commons-text:1.10.0' - implementation 'de.themoep:minedown-adventure:1.7.2-SNAPSHOT' - implementation 'com.google.code.gson:gson:2.10.1' - implementation 'net.william278:Annotaml:2.0.1' - implementation 'net.william278:PagineDown:1.1' - implementation 'net.william278:DesertWell:1.1.1' - implementation 'dev.dejvokep:boosted-yaml:1.3.1' - implementation 'net.kyori:adventure-api:4.13.0' - implementation('com.zaxxer:HikariCP:5.0.1') { + api 'commons-io:commons-io:2.11.0' + api 'org.apache.commons:commons-text:1.10.0' + api 'de.themoep:minedown-adventure:1.7.2-SNAPSHOT' + api 'com.google.code.gson:gson:2.10.1' + api 'net.william278:Annotaml:2.0.1' + api 'net.william278:PagineDown:1.1' + api 'net.william278:DesertWell:1.1.1' + api 'dev.dejvokep:boosted-yaml:1.3.1' + api 'net.kyori:adventure-api:4.13.1' + api('com.zaxxer:HikariCP:5.0.1') { exclude module: 'slf4j-api' } - compileOnly 'org.jetbrains:annotations:24.0.1' - compileOnly 'com.google.guava:guava:31.1-jre' compileOnly 'redis.clients:jedis:' + jedis_version compileOnly 'org.xerial:sqlite-jdbc:' + sqlite_driver_version compileOnly 'com.mysql:mysql-connector-j:' + mysql_driver_version + + compileOnly 'org.jetbrains:annotations:24.0.1' + compileOnly 'com.google.guava:guava:31.1-jre' compileOnly 'com.github.plan-player-analytics:Plan:5.5.1923' compileOnly 'com.github.BlueMap-Minecraft:BlueMapAPI:2.5.0' compileOnly 'us.dynmap:DynmapCoreAPI:3.4' testImplementation 'com.github.plan-player-analytics:Plan:5.5.1923' testImplementation 'com.github.yuriy-g:simple-java-plot:5c502c2e98' -} - -shadowJar { - relocate 'org.apache.commons.io', 'net.william278.huskhomes.libraries.commons.io' - relocate 'org.apache.commons.text', 'net.william278.huskhomes.libraries.commons.text' - relocate 'org.apache.commons.lang3', 'net.william278.huskhomes.libraries.commons.lang3' - relocate 'de.themoep', 'net.william278.huskhomes.libraries' - relocate 'org.jetbrains', 'net.william278.huskhomes.libraries' - relocate 'org.intellij', 'net.william278.huskhomes.libraries' - relocate 'com.zaxxer', 'net.william278.huskhomes.libraries' - relocate 'net.william278.annotaml', 'net.william278.huskhomes.libraries.annotaml' - relocate 'net.william278.paginedown', 'net.william278.huskhomes.libraries.paginedown' - relocate 'net.william278.desertwell', 'net.william278.huskhomes.libraries.desertwell' - relocate 'dev.dejvokep.boostedyaml', 'net.william278.huskhomes.libraries.boostedyaml' - relocate 'org.yaml.snakeyaml', 'net.william278.huskhomes.libraries.snakeyaml' - relocate 'com.google.gson', 'net.william278.huskhomes.libraries.gson' - relocate 'net.kyori', 'net.william278.huskhomes.libraries' } \ No newline at end of file diff --git a/common/src/main/java/net/william278/huskhomes/HuskHomes.java b/common/src/main/java/net/william278/huskhomes/HuskHomes.java index 6665f83d..0ad18ba3 100644 --- a/common/src/main/java/net/william278/huskhomes/HuskHomes.java +++ b/common/src/main/java/net/william278/huskhomes/HuskHomes.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes; import com.google.gson.Gson; diff --git a/common/src/main/java/net/william278/huskhomes/api/BaseHuskHomesAPI.java b/common/src/main/java/net/william278/huskhomes/api/BaseHuskHomesAPI.java index d4de2921..f5df57be 100644 --- a/common/src/main/java/net/william278/huskhomes/api/BaseHuskHomesAPI.java +++ b/common/src/main/java/net/william278/huskhomes/api/BaseHuskHomesAPI.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.api; import de.themoep.minedown.adventure.MineDown; diff --git a/common/src/main/java/net/william278/huskhomes/command/BackCommand.java b/common/src/main/java/net/william278/huskhomes/command/BackCommand.java index f201cadf..7996a387 100644 --- a/common/src/main/java/net/william278/huskhomes/command/BackCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/BackCommand.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.command; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/command/Command.java b/common/src/main/java/net/william278/huskhomes/command/Command.java index a9e0a6b9..683df20e 100644 --- a/common/src/main/java/net/william278/huskhomes/command/Command.java +++ b/common/src/main/java/net/william278/huskhomes/command/Command.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.command; import net.william278.huskhomes.HuskHomes; @@ -33,14 +52,22 @@ public abstract class Command extends Node { @NotNull protected String[] removeFirstArg(@NotNull String[] args) { + if (args.length <= 1) { + return new String[0]; + } String[] newArgs = new String[args.length - 1]; System.arraycopy(args, 1, newArgs, 0, args.length - 1); return newArgs; } + @NotNull + public final String getRawUsage() { + return usage; + } + @NotNull public final String getUsage() { - return "/" + getName() + " " + usage; + return "/" + getName() + " " + getRawUsage(); } public final void addAdditionalPermissions(@NotNull Map additionalPermissions) { diff --git a/common/src/main/java/net/william278/huskhomes/command/DelHomeCommand.java b/common/src/main/java/net/william278/huskhomes/command/DelHomeCommand.java index f97ff04b..41f1bb3d 100644 --- a/common/src/main/java/net/william278/huskhomes/command/DelHomeCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/DelHomeCommand.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.command; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/command/DelWarpCommand.java b/common/src/main/java/net/william278/huskhomes/command/DelWarpCommand.java index b6e231ff..6a57814a 100644 --- a/common/src/main/java/net/william278/huskhomes/command/DelWarpCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/DelWarpCommand.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.command; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/command/DisabledCommand.java b/common/src/main/java/net/william278/huskhomes/command/DisabledCommand.java index 52e002b7..0709d9d6 100644 --- a/common/src/main/java/net/william278/huskhomes/command/DisabledCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/DisabledCommand.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.command; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/command/EditHomeCommand.java b/common/src/main/java/net/william278/huskhomes/command/EditHomeCommand.java index b4cda4a2..b9ac011e 100644 --- a/common/src/main/java/net/william278/huskhomes/command/EditHomeCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/EditHomeCommand.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.command; import de.themoep.minedown.adventure.MineDown; diff --git a/common/src/main/java/net/william278/huskhomes/command/EditWarpCommand.java b/common/src/main/java/net/william278/huskhomes/command/EditWarpCommand.java index 8ee2b644..041b273f 100644 --- a/common/src/main/java/net/william278/huskhomes/command/EditWarpCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/EditWarpCommand.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.command; import de.themoep.minedown.adventure.MineDown; diff --git a/common/src/main/java/net/william278/huskhomes/command/Executable.java b/common/src/main/java/net/william278/huskhomes/command/Executable.java index 963c6f4f..9cf5a0f8 100644 --- a/common/src/main/java/net/william278/huskhomes/command/Executable.java +++ b/common/src/main/java/net/william278/huskhomes/command/Executable.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.command; import net.william278.huskhomes.user.CommandUser; diff --git a/common/src/main/java/net/william278/huskhomes/command/HomeCommand.java b/common/src/main/java/net/william278/huskhomes/command/HomeCommand.java index 83ccdb7a..8e918e87 100644 --- a/common/src/main/java/net/william278/huskhomes/command/HomeCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/HomeCommand.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.command; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/command/HuskHomesCommand.java b/common/src/main/java/net/william278/huskhomes/command/HuskHomesCommand.java index d6f6dd78..4f30c146 100644 --- a/common/src/main/java/net/william278/huskhomes/command/HuskHomesCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/HuskHomesCommand.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.command; import de.themoep.minedown.adventure.MineDown; diff --git a/common/src/main/java/net/william278/huskhomes/command/InGameCommand.java b/common/src/main/java/net/william278/huskhomes/command/InGameCommand.java index f107a27a..aade5643 100644 --- a/common/src/main/java/net/william278/huskhomes/command/InGameCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/InGameCommand.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.command; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/command/ListCommand.java b/common/src/main/java/net/william278/huskhomes/command/ListCommand.java index 027fa892..186c7bc4 100644 --- a/common/src/main/java/net/william278/huskhomes/command/ListCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/ListCommand.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.command; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/command/Node.java b/common/src/main/java/net/william278/huskhomes/command/Node.java index dce5670e..0606a1e5 100644 --- a/common/src/main/java/net/william278/huskhomes/command/Node.java +++ b/common/src/main/java/net/william278/huskhomes/command/Node.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.command; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/command/PrivateHomeCommand.java b/common/src/main/java/net/william278/huskhomes/command/PrivateHomeCommand.java index 231e32b6..bc1c32f6 100644 --- a/common/src/main/java/net/william278/huskhomes/command/PrivateHomeCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/PrivateHomeCommand.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.command; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/command/PrivateHomeListCommand.java b/common/src/main/java/net/william278/huskhomes/command/PrivateHomeListCommand.java index 6afdc9c3..6a5d0458 100644 --- a/common/src/main/java/net/william278/huskhomes/command/PrivateHomeListCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/PrivateHomeListCommand.java @@ -1,9 +1,31 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.command; import net.william278.huskhomes.HuskHomes; import net.william278.huskhomes.config.Locales; import net.william278.huskhomes.position.Home; -import net.william278.huskhomes.user.*; +import net.william278.huskhomes.user.CommandUser; +import net.william278.huskhomes.user.OnlineUser; +import net.william278.huskhomes.user.SavedUser; +import net.william278.huskhomes.user.User; import net.william278.paginedown.PaginatedList; import org.jetbrains.annotations.NotNull; diff --git a/common/src/main/java/net/william278/huskhomes/command/PublicHomeCommand.java b/common/src/main/java/net/william278/huskhomes/command/PublicHomeCommand.java index 283eba80..2aa94b8d 100644 --- a/common/src/main/java/net/william278/huskhomes/command/PublicHomeCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/PublicHomeCommand.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.command; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/command/PublicHomeListCommand.java b/common/src/main/java/net/william278/huskhomes/command/PublicHomeListCommand.java index bc18f1e7..738a1e95 100644 --- a/common/src/main/java/net/william278/huskhomes/command/PublicHomeListCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/PublicHomeListCommand.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.command; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/command/RtpCommand.java b/common/src/main/java/net/william278/huskhomes/command/RtpCommand.java index 5ebf7bdf..87e019cf 100644 --- a/common/src/main/java/net/william278/huskhomes/command/RtpCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/RtpCommand.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.command; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/command/SavedPositionCommand.java b/common/src/main/java/net/william278/huskhomes/command/SavedPositionCommand.java index f5db7d1a..23cc8b44 100644 --- a/common/src/main/java/net/william278/huskhomes/command/SavedPositionCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/SavedPositionCommand.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.command; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/command/SetHomeCommand.java b/common/src/main/java/net/william278/huskhomes/command/SetHomeCommand.java index 7d776ff5..fa5d8d3b 100644 --- a/common/src/main/java/net/william278/huskhomes/command/SetHomeCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/SetHomeCommand.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.command; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/command/SetPositionCommand.java b/common/src/main/java/net/william278/huskhomes/command/SetPositionCommand.java index b7c84b5a..18895e31 100644 --- a/common/src/main/java/net/william278/huskhomes/command/SetPositionCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/SetPositionCommand.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.command; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/command/SetSpawnCommand.java b/common/src/main/java/net/william278/huskhomes/command/SetSpawnCommand.java index 9d47cbb6..5d85c5c3 100644 --- a/common/src/main/java/net/william278/huskhomes/command/SetSpawnCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/SetSpawnCommand.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.command; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/command/SetWarpCommand.java b/common/src/main/java/net/william278/huskhomes/command/SetWarpCommand.java index e7eaf2d0..a85e374f 100644 --- a/common/src/main/java/net/william278/huskhomes/command/SetWarpCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/SetWarpCommand.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.command; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/command/SpawnCommand.java b/common/src/main/java/net/william278/huskhomes/command/SpawnCommand.java index 32e3219c..13038197 100644 --- a/common/src/main/java/net/william278/huskhomes/command/SpawnCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/SpawnCommand.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.command; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/command/TabProvider.java b/common/src/main/java/net/william278/huskhomes/command/TabProvider.java index 3483763a..10cbf5a7 100644 --- a/common/src/main/java/net/william278/huskhomes/command/TabProvider.java +++ b/common/src/main/java/net/william278/huskhomes/command/TabProvider.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.command; import net.william278.huskhomes.user.CommandUser; diff --git a/common/src/main/java/net/william278/huskhomes/command/TeleportRequestCommand.java b/common/src/main/java/net/william278/huskhomes/command/TeleportRequestCommand.java index f5bff690..dcb7c110 100644 --- a/common/src/main/java/net/william278/huskhomes/command/TeleportRequestCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/TeleportRequestCommand.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.command; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/command/TpAllCommand.java b/common/src/main/java/net/william278/huskhomes/command/TpAllCommand.java index 49fafee3..815204be 100644 --- a/common/src/main/java/net/william278/huskhomes/command/TpAllCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/TpAllCommand.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.command; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/command/TpCommand.java b/common/src/main/java/net/william278/huskhomes/command/TpCommand.java index 2ab01d95..e0aea4e8 100644 --- a/common/src/main/java/net/william278/huskhomes/command/TpCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/TpCommand.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.command; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/command/TpHereCommand.java b/common/src/main/java/net/william278/huskhomes/command/TpHereCommand.java index ca8fb9e7..6fb66d75 100644 --- a/common/src/main/java/net/william278/huskhomes/command/TpHereCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/TpHereCommand.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.command; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/command/TpIgnoreCommand.java b/common/src/main/java/net/william278/huskhomes/command/TpIgnoreCommand.java index c5b9574d..d86bd77a 100644 --- a/common/src/main/java/net/william278/huskhomes/command/TpIgnoreCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/TpIgnoreCommand.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.command; import de.themoep.minedown.adventure.MineDown; diff --git a/common/src/main/java/net/william278/huskhomes/command/TpOfflineCommand.java b/common/src/main/java/net/william278/huskhomes/command/TpOfflineCommand.java index ab12038c..38bbe1fd 100644 --- a/common/src/main/java/net/william278/huskhomes/command/TpOfflineCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/TpOfflineCommand.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.command; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/command/TpRespondCommand.java b/common/src/main/java/net/william278/huskhomes/command/TpRespondCommand.java index 350e282b..9e7a405b 100644 --- a/common/src/main/java/net/william278/huskhomes/command/TpRespondCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/TpRespondCommand.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.command; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/command/TpaAllCommand.java b/common/src/main/java/net/william278/huskhomes/command/TpaAllCommand.java index 432816ac..9798b5c2 100644 --- a/common/src/main/java/net/william278/huskhomes/command/TpaAllCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/TpaAllCommand.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.command; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/command/UserListTabProvider.java b/common/src/main/java/net/william278/huskhomes/command/UserListTabProvider.java index 19da4c7c..0bb57d71 100644 --- a/common/src/main/java/net/william278/huskhomes/command/UserListTabProvider.java +++ b/common/src/main/java/net/william278/huskhomes/command/UserListTabProvider.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.command; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/command/WarpCommand.java b/common/src/main/java/net/william278/huskhomes/command/WarpCommand.java index 69923a61..8ff5fb91 100644 --- a/common/src/main/java/net/william278/huskhomes/command/WarpCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/WarpCommand.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.command; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/command/WarpListCommand.java b/common/src/main/java/net/william278/huskhomes/command/WarpListCommand.java index 63d227e9..4248a569 100644 --- a/common/src/main/java/net/william278/huskhomes/command/WarpListCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/WarpListCommand.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.command; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/config/Locales.java b/common/src/main/java/net/william278/huskhomes/config/Locales.java index eeef3f30..56e13eb9 100644 --- a/common/src/main/java/net/william278/huskhomes/config/Locales.java +++ b/common/src/main/java/net/william278/huskhomes/config/Locales.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.config; import de.themoep.minedown.adventure.MineDown; diff --git a/common/src/main/java/net/william278/huskhomes/config/Server.java b/common/src/main/java/net/william278/huskhomes/config/Server.java index 054a535e..803ccb2c 100644 --- a/common/src/main/java/net/william278/huskhomes/config/Server.java +++ b/common/src/main/java/net/william278/huskhomes/config/Server.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.config; import net.william278.annotaml.YamlFile; diff --git a/common/src/main/java/net/william278/huskhomes/config/Settings.java b/common/src/main/java/net/william278/huskhomes/config/Settings.java index 5f4282e0..a6e9111b 100644 --- a/common/src/main/java/net/william278/huskhomes/config/Settings.java +++ b/common/src/main/java/net/william278/huskhomes/config/Settings.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.config; import net.william278.annotaml.YamlComment; diff --git a/common/src/main/java/net/william278/huskhomes/config/Spawn.java b/common/src/main/java/net/william278/huskhomes/config/Spawn.java index 21adb202..48444254 100644 --- a/common/src/main/java/net/william278/huskhomes/config/Spawn.java +++ b/common/src/main/java/net/william278/huskhomes/config/Spawn.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.config; import net.william278.annotaml.YamlFile; diff --git a/common/src/main/java/net/william278/huskhomes/database/Database.java b/common/src/main/java/net/william278/huskhomes/database/Database.java index eda76a2e..ce9dea20 100644 --- a/common/src/main/java/net/william278/huskhomes/database/Database.java +++ b/common/src/main/java/net/william278/huskhomes/database/Database.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.database; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/database/MySqlDatabase.java b/common/src/main/java/net/william278/huskhomes/database/MySqlDatabase.java index bed45bbf..c4825c3b 100644 --- a/common/src/main/java/net/william278/huskhomes/database/MySqlDatabase.java +++ b/common/src/main/java/net/william278/huskhomes/database/MySqlDatabase.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.database; import com.zaxxer.hikari.HikariDataSource; diff --git a/common/src/main/java/net/william278/huskhomes/database/SqLiteDatabase.java b/common/src/main/java/net/william278/huskhomes/database/SqLiteDatabase.java index ac3c9f91..9642483e 100644 --- a/common/src/main/java/net/william278/huskhomes/database/SqLiteDatabase.java +++ b/common/src/main/java/net/william278/huskhomes/database/SqLiteDatabase.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.database; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/event/Cancellable.java b/common/src/main/java/net/william278/huskhomes/event/Cancellable.java index 68a671aa..0ebe0eeb 100644 --- a/common/src/main/java/net/william278/huskhomes/event/Cancellable.java +++ b/common/src/main/java/net/william278/huskhomes/event/Cancellable.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.event; /** diff --git a/common/src/main/java/net/william278/huskhomes/event/Event.java b/common/src/main/java/net/william278/huskhomes/event/Event.java index 88f3538e..15da15b9 100644 --- a/common/src/main/java/net/william278/huskhomes/event/Event.java +++ b/common/src/main/java/net/william278/huskhomes/event/Event.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.event; /** diff --git a/common/src/main/java/net/william278/huskhomes/event/EventDispatcher.java b/common/src/main/java/net/william278/huskhomes/event/EventDispatcher.java index e73befee..20a643a0 100644 --- a/common/src/main/java/net/william278/huskhomes/event/EventDispatcher.java +++ b/common/src/main/java/net/william278/huskhomes/event/EventDispatcher.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.event; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/event/IDeleteAllHomesEvent.java b/common/src/main/java/net/william278/huskhomes/event/IDeleteAllHomesEvent.java index 3a097a62..ec8890d8 100644 --- a/common/src/main/java/net/william278/huskhomes/event/IDeleteAllHomesEvent.java +++ b/common/src/main/java/net/william278/huskhomes/event/IDeleteAllHomesEvent.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.event; import net.william278.huskhomes.user.CommandUser; diff --git a/common/src/main/java/net/william278/huskhomes/event/IDeleteAllWarpsEvent.java b/common/src/main/java/net/william278/huskhomes/event/IDeleteAllWarpsEvent.java index 65a9d124..ccfdcbda 100644 --- a/common/src/main/java/net/william278/huskhomes/event/IDeleteAllWarpsEvent.java +++ b/common/src/main/java/net/william278/huskhomes/event/IDeleteAllWarpsEvent.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.event; import net.william278.huskhomes.user.CommandUser; diff --git a/common/src/main/java/net/william278/huskhomes/event/IHomeCreateEvent.java b/common/src/main/java/net/william278/huskhomes/event/IHomeCreateEvent.java index 464e17f3..2608295d 100644 --- a/common/src/main/java/net/william278/huskhomes/event/IHomeCreateEvent.java +++ b/common/src/main/java/net/william278/huskhomes/event/IHomeCreateEvent.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.event; import net.william278.huskhomes.position.Position; diff --git a/common/src/main/java/net/william278/huskhomes/event/IHomeDeleteEvent.java b/common/src/main/java/net/william278/huskhomes/event/IHomeDeleteEvent.java index 4c42177f..7b63df92 100644 --- a/common/src/main/java/net/william278/huskhomes/event/IHomeDeleteEvent.java +++ b/common/src/main/java/net/william278/huskhomes/event/IHomeDeleteEvent.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.event; import net.william278.huskhomes.position.Home; diff --git a/common/src/main/java/net/william278/huskhomes/event/IHomeEditEvent.java b/common/src/main/java/net/william278/huskhomes/event/IHomeEditEvent.java index 3290ab98..ef676cdb 100644 --- a/common/src/main/java/net/william278/huskhomes/event/IHomeEditEvent.java +++ b/common/src/main/java/net/william278/huskhomes/event/IHomeEditEvent.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.event; import net.william278.huskhomes.position.Home; diff --git a/common/src/main/java/net/william278/huskhomes/event/IHomeListEvent.java b/common/src/main/java/net/william278/huskhomes/event/IHomeListEvent.java index 26f69981..9d7e00ec 100644 --- a/common/src/main/java/net/william278/huskhomes/event/IHomeListEvent.java +++ b/common/src/main/java/net/william278/huskhomes/event/IHomeListEvent.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.event; import net.william278.huskhomes.position.Home; diff --git a/common/src/main/java/net/william278/huskhomes/event/IReceiveTeleportRequestEvent.java b/common/src/main/java/net/william278/huskhomes/event/IReceiveTeleportRequestEvent.java index 273a2442..f37b164f 100644 --- a/common/src/main/java/net/william278/huskhomes/event/IReceiveTeleportRequestEvent.java +++ b/common/src/main/java/net/william278/huskhomes/event/IReceiveTeleportRequestEvent.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.event; import net.william278.huskhomes.teleport.TeleportRequest; diff --git a/common/src/main/java/net/william278/huskhomes/event/IReplyTeleportRequestEvent.java b/common/src/main/java/net/william278/huskhomes/event/IReplyTeleportRequestEvent.java index 080bd3f3..93c33652 100644 --- a/common/src/main/java/net/william278/huskhomes/event/IReplyTeleportRequestEvent.java +++ b/common/src/main/java/net/william278/huskhomes/event/IReplyTeleportRequestEvent.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.event; import net.william278.huskhomes.teleport.TeleportRequest; diff --git a/common/src/main/java/net/william278/huskhomes/event/ISendTeleportRequestEvent.java b/common/src/main/java/net/william278/huskhomes/event/ISendTeleportRequestEvent.java index f16afb10..d321ee70 100644 --- a/common/src/main/java/net/william278/huskhomes/event/ISendTeleportRequestEvent.java +++ b/common/src/main/java/net/william278/huskhomes/event/ISendTeleportRequestEvent.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.event; import net.william278.huskhomes.user.OnlineUser; diff --git a/common/src/main/java/net/william278/huskhomes/event/ITeleportBackEvent.java b/common/src/main/java/net/william278/huskhomes/event/ITeleportBackEvent.java index 6e20695b..a3cdfcfe 100644 --- a/common/src/main/java/net/william278/huskhomes/event/ITeleportBackEvent.java +++ b/common/src/main/java/net/william278/huskhomes/event/ITeleportBackEvent.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.event; import net.william278.huskhomes.position.Position; diff --git a/common/src/main/java/net/william278/huskhomes/event/ITeleportEvent.java b/common/src/main/java/net/william278/huskhomes/event/ITeleportEvent.java index 621df49b..bf0f5316 100644 --- a/common/src/main/java/net/william278/huskhomes/event/ITeleportEvent.java +++ b/common/src/main/java/net/william278/huskhomes/event/ITeleportEvent.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.event; import net.william278.huskhomes.teleport.Teleport; diff --git a/common/src/main/java/net/william278/huskhomes/event/ITeleportRequestEvent.java b/common/src/main/java/net/william278/huskhomes/event/ITeleportRequestEvent.java index 91e0c9cc..6cc60cea 100644 --- a/common/src/main/java/net/william278/huskhomes/event/ITeleportRequestEvent.java +++ b/common/src/main/java/net/william278/huskhomes/event/ITeleportRequestEvent.java @@ -1,9 +1,28 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.event; import net.william278.huskhomes.teleport.TeleportRequest; import org.jetbrains.annotations.NotNull; -public interface ITeleportRequestEvent extends Event { +public interface ITeleportRequestEvent extends Cancellable { @NotNull TeleportRequest getRequest(); diff --git a/common/src/main/java/net/william278/huskhomes/event/ITeleportWarmupEvent.java b/common/src/main/java/net/william278/huskhomes/event/ITeleportWarmupEvent.java index 53e56f0e..3ad3c8d6 100644 --- a/common/src/main/java/net/william278/huskhomes/event/ITeleportWarmupEvent.java +++ b/common/src/main/java/net/william278/huskhomes/event/ITeleportWarmupEvent.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.event; import net.william278.huskhomes.teleport.TimedTeleport; diff --git a/common/src/main/java/net/william278/huskhomes/event/IWarpCreateEvent.java b/common/src/main/java/net/william278/huskhomes/event/IWarpCreateEvent.java index 05833200..c60cf152 100644 --- a/common/src/main/java/net/william278/huskhomes/event/IWarpCreateEvent.java +++ b/common/src/main/java/net/william278/huskhomes/event/IWarpCreateEvent.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.event; import net.william278.huskhomes.position.Position; diff --git a/common/src/main/java/net/william278/huskhomes/event/IWarpDeleteEvent.java b/common/src/main/java/net/william278/huskhomes/event/IWarpDeleteEvent.java index 1f1b584b..77142cef 100644 --- a/common/src/main/java/net/william278/huskhomes/event/IWarpDeleteEvent.java +++ b/common/src/main/java/net/william278/huskhomes/event/IWarpDeleteEvent.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.event; import net.william278.huskhomes.position.Warp; diff --git a/common/src/main/java/net/william278/huskhomes/event/IWarpEditEvent.java b/common/src/main/java/net/william278/huskhomes/event/IWarpEditEvent.java index 7f2fe036..fb3e741b 100644 --- a/common/src/main/java/net/william278/huskhomes/event/IWarpEditEvent.java +++ b/common/src/main/java/net/william278/huskhomes/event/IWarpEditEvent.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.event; import net.william278.huskhomes.position.Warp; diff --git a/common/src/main/java/net/william278/huskhomes/event/IWarpListEvent.java b/common/src/main/java/net/william278/huskhomes/event/IWarpListEvent.java index 684996b8..50710f2d 100644 --- a/common/src/main/java/net/william278/huskhomes/event/IWarpListEvent.java +++ b/common/src/main/java/net/william278/huskhomes/event/IWarpListEvent.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.event; import net.william278.huskhomes.position.Warp; diff --git a/common/src/main/java/net/william278/huskhomes/hook/BlueMapHook.java b/common/src/main/java/net/william278/huskhomes/hook/BlueMapHook.java index 2f225669..78345e99 100644 --- a/common/src/main/java/net/william278/huskhomes/hook/BlueMapHook.java +++ b/common/src/main/java/net/william278/huskhomes/hook/BlueMapHook.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.hook; import de.bluecolored.bluemap.api.BlueMapAPI; diff --git a/common/src/main/java/net/william278/huskhomes/hook/DynmapHook.java b/common/src/main/java/net/william278/huskhomes/hook/DynmapHook.java index 1100d363..df8f5d5b 100644 --- a/common/src/main/java/net/william278/huskhomes/hook/DynmapHook.java +++ b/common/src/main/java/net/william278/huskhomes/hook/DynmapHook.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.hook; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/hook/EconomyHook.java b/common/src/main/java/net/william278/huskhomes/hook/EconomyHook.java index 73155133..c272c82e 100644 --- a/common/src/main/java/net/william278/huskhomes/hook/EconomyHook.java +++ b/common/src/main/java/net/william278/huskhomes/hook/EconomyHook.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.hook; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/hook/Hook.java b/common/src/main/java/net/william278/huskhomes/hook/Hook.java index 58a2520f..298bc679 100644 --- a/common/src/main/java/net/william278/huskhomes/hook/Hook.java +++ b/common/src/main/java/net/william278/huskhomes/hook/Hook.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.hook; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/hook/MapHook.java b/common/src/main/java/net/william278/huskhomes/hook/MapHook.java index dfb2e1c4..24cb81bd 100644 --- a/common/src/main/java/net/william278/huskhomes/hook/MapHook.java +++ b/common/src/main/java/net/william278/huskhomes/hook/MapHook.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.hook; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/hook/PlanHook.java b/common/src/main/java/net/william278/huskhomes/hook/PlanHook.java index 64d2c34f..84a2715a 100644 --- a/common/src/main/java/net/william278/huskhomes/hook/PlanHook.java +++ b/common/src/main/java/net/william278/huskhomes/hook/PlanHook.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.hook; import com.djrapitops.plan.capability.CapabilityService; diff --git a/common/src/main/java/net/william278/huskhomes/listener/EventListener.java b/common/src/main/java/net/william278/huskhomes/listener/EventListener.java index 227f34bd..ca19543d 100644 --- a/common/src/main/java/net/william278/huskhomes/listener/EventListener.java +++ b/common/src/main/java/net/william278/huskhomes/listener/EventListener.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.listener; import de.themoep.minedown.adventure.MineDown; diff --git a/common/src/main/java/net/william278/huskhomes/manager/HomesManager.java b/common/src/main/java/net/william278/huskhomes/manager/HomesManager.java index 98c0c105..34df43aa 100644 --- a/common/src/main/java/net/william278/huskhomes/manager/HomesManager.java +++ b/common/src/main/java/net/william278/huskhomes/manager/HomesManager.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.manager; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/manager/Manager.java b/common/src/main/java/net/william278/huskhomes/manager/Manager.java index eefacdf5..dc9f6ffc 100644 --- a/common/src/main/java/net/william278/huskhomes/manager/Manager.java +++ b/common/src/main/java/net/william278/huskhomes/manager/Manager.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.manager; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/manager/RequestsManager.java b/common/src/main/java/net/william278/huskhomes/manager/RequestsManager.java index d00abaa4..8dbf07b7 100644 --- a/common/src/main/java/net/william278/huskhomes/manager/RequestsManager.java +++ b/common/src/main/java/net/william278/huskhomes/manager/RequestsManager.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.manager; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/manager/WarpsManager.java b/common/src/main/java/net/william278/huskhomes/manager/WarpsManager.java index c25ea069..50b25c35 100644 --- a/common/src/main/java/net/william278/huskhomes/manager/WarpsManager.java +++ b/common/src/main/java/net/william278/huskhomes/manager/WarpsManager.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.manager; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/network/Broker.java b/common/src/main/java/net/william278/huskhomes/network/Broker.java index 7fb048f1..196782b4 100644 --- a/common/src/main/java/net/william278/huskhomes/network/Broker.java +++ b/common/src/main/java/net/william278/huskhomes/network/Broker.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.network; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/network/Message.java b/common/src/main/java/net/william278/huskhomes/network/Message.java index 5a38ed40..7629303c 100644 --- a/common/src/main/java/net/william278/huskhomes/network/Message.java +++ b/common/src/main/java/net/william278/huskhomes/network/Message.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.network; import com.google.gson.annotations.Expose; diff --git a/common/src/main/java/net/william278/huskhomes/network/Payload.java b/common/src/main/java/net/william278/huskhomes/network/Payload.java index f3710f12..17d3dad0 100644 --- a/common/src/main/java/net/william278/huskhomes/network/Payload.java +++ b/common/src/main/java/net/william278/huskhomes/network/Payload.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.network; import com.google.gson.annotations.Expose; diff --git a/common/src/main/java/net/william278/huskhomes/network/PluginMessageBroker.java b/common/src/main/java/net/william278/huskhomes/network/PluginMessageBroker.java index e79936d9..79349574 100644 --- a/common/src/main/java/net/william278/huskhomes/network/PluginMessageBroker.java +++ b/common/src/main/java/net/william278/huskhomes/network/PluginMessageBroker.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.network; import com.google.common.io.ByteArrayDataInput; diff --git a/common/src/main/java/net/william278/huskhomes/network/RedisBroker.java b/common/src/main/java/net/william278/huskhomes/network/RedisBroker.java index 449f777d..55407401 100644 --- a/common/src/main/java/net/william278/huskhomes/network/RedisBroker.java +++ b/common/src/main/java/net/william278/huskhomes/network/RedisBroker.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.network; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/position/Home.java b/common/src/main/java/net/william278/huskhomes/position/Home.java index 143fd418..bb8453fb 100644 --- a/common/src/main/java/net/william278/huskhomes/position/Home.java +++ b/common/src/main/java/net/william278/huskhomes/position/Home.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.position; import net.william278.huskhomes.user.User; diff --git a/common/src/main/java/net/william278/huskhomes/position/Location.java b/common/src/main/java/net/william278/huskhomes/position/Location.java index 0a92c1fc..3f54a390 100644 --- a/common/src/main/java/net/william278/huskhomes/position/Location.java +++ b/common/src/main/java/net/william278/huskhomes/position/Location.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.position; import com.google.gson.annotations.Expose; diff --git a/common/src/main/java/net/william278/huskhomes/position/Position.java b/common/src/main/java/net/william278/huskhomes/position/Position.java index c2b7e2c8..e143cd86 100644 --- a/common/src/main/java/net/william278/huskhomes/position/Position.java +++ b/common/src/main/java/net/william278/huskhomes/position/Position.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.position; import com.google.gson.annotations.Expose; diff --git a/common/src/main/java/net/william278/huskhomes/position/PositionMeta.java b/common/src/main/java/net/william278/huskhomes/position/PositionMeta.java index 1d6559c4..47363b2b 100644 --- a/common/src/main/java/net/william278/huskhomes/position/PositionMeta.java +++ b/common/src/main/java/net/william278/huskhomes/position/PositionMeta.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.position; import com.google.common.reflect.TypeToken; diff --git a/common/src/main/java/net/william278/huskhomes/position/SavedPosition.java b/common/src/main/java/net/william278/huskhomes/position/SavedPosition.java index 4736ba79..ef0567be 100644 --- a/common/src/main/java/net/william278/huskhomes/position/SavedPosition.java +++ b/common/src/main/java/net/william278/huskhomes/position/SavedPosition.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.position; import org.jetbrains.annotations.NotNull; diff --git a/common/src/main/java/net/william278/huskhomes/position/Warp.java b/common/src/main/java/net/william278/huskhomes/position/Warp.java index d5c2eee4..dcbbac0c 100644 --- a/common/src/main/java/net/william278/huskhomes/position/Warp.java +++ b/common/src/main/java/net/william278/huskhomes/position/Warp.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.position; import org.jetbrains.annotations.NotNull; diff --git a/common/src/main/java/net/william278/huskhomes/position/World.java b/common/src/main/java/net/william278/huskhomes/position/World.java index de215855..fd5db2bc 100644 --- a/common/src/main/java/net/william278/huskhomes/position/World.java +++ b/common/src/main/java/net/william278/huskhomes/position/World.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.position; import org.jetbrains.annotations.NotNull; diff --git a/common/src/main/java/net/william278/huskhomes/random/NormalDistributionEngine.java b/common/src/main/java/net/william278/huskhomes/random/NormalDistributionEngine.java index ddaea2ee..956b8879 100644 --- a/common/src/main/java/net/william278/huskhomes/random/NormalDistributionEngine.java +++ b/common/src/main/java/net/william278/huskhomes/random/NormalDistributionEngine.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.random; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/random/RandomTeleportEngine.java b/common/src/main/java/net/william278/huskhomes/random/RandomTeleportEngine.java index 35048f88..d281505d 100644 --- a/common/src/main/java/net/william278/huskhomes/random/RandomTeleportEngine.java +++ b/common/src/main/java/net/william278/huskhomes/random/RandomTeleportEngine.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.random; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/teleport/Target.java b/common/src/main/java/net/william278/huskhomes/teleport/Target.java index f9ce8279..a5eda39b 100644 --- a/common/src/main/java/net/william278/huskhomes/teleport/Target.java +++ b/common/src/main/java/net/william278/huskhomes/teleport/Target.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.teleport; import org.jetbrains.annotations.NotNull; diff --git a/common/src/main/java/net/william278/huskhomes/teleport/Teleport.java b/common/src/main/java/net/william278/huskhomes/teleport/Teleport.java index b45a133e..ac9cb755 100644 --- a/common/src/main/java/net/william278/huskhomes/teleport/Teleport.java +++ b/common/src/main/java/net/william278/huskhomes/teleport/Teleport.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.teleport; import net.william278.huskhomes.HuskHomes; @@ -9,12 +28,12 @@ import net.william278.huskhomes.network.Message; import net.william278.huskhomes.network.Payload; import net.william278.huskhomes.position.Position; import net.william278.huskhomes.user.OnlineUser; +import net.william278.huskhomes.util.ThrowingConsumer; import org.jetbrains.annotations.NotNull; import java.util.Arrays; import java.util.List; import java.util.Optional; -import java.util.function.Consumer; public class Teleport { @@ -146,7 +165,7 @@ public class Teleport { } // Fire the teleport event - private void fireEvent(@NotNull Consumer afterFired) { + private void fireEvent(@NotNull ThrowingConsumer afterFired) { plugin.fireEvent(plugin.getTeleportEvent(this), afterFired); } diff --git a/common/src/main/java/net/william278/huskhomes/teleport/TeleportBuilder.java b/common/src/main/java/net/william278/huskhomes/teleport/TeleportBuilder.java index 441cb674..fe1a9b6f 100644 --- a/common/src/main/java/net/william278/huskhomes/teleport/TeleportBuilder.java +++ b/common/src/main/java/net/william278/huskhomes/teleport/TeleportBuilder.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.teleport; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/teleport/TeleportRequest.java b/common/src/main/java/net/william278/huskhomes/teleport/TeleportRequest.java index e5efd864..b379cad5 100644 --- a/common/src/main/java/net/william278/huskhomes/teleport/TeleportRequest.java +++ b/common/src/main/java/net/william278/huskhomes/teleport/TeleportRequest.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.teleport; import com.google.gson.annotations.Expose; diff --git a/common/src/main/java/net/william278/huskhomes/teleport/Teleportable.java b/common/src/main/java/net/william278/huskhomes/teleport/Teleportable.java index ed641a3c..759b38bb 100644 --- a/common/src/main/java/net/william278/huskhomes/teleport/Teleportable.java +++ b/common/src/main/java/net/william278/huskhomes/teleport/Teleportable.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.teleport; import org.jetbrains.annotations.NotNull; diff --git a/common/src/main/java/net/william278/huskhomes/teleport/TeleportationException.java b/common/src/main/java/net/william278/huskhomes/teleport/TeleportationException.java index b6667fe4..8ed14812 100644 --- a/common/src/main/java/net/william278/huskhomes/teleport/TeleportationException.java +++ b/common/src/main/java/net/william278/huskhomes/teleport/TeleportationException.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.teleport; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/teleport/TimedTeleport.java b/common/src/main/java/net/william278/huskhomes/teleport/TimedTeleport.java index 8a3ec721..cedf12b9 100644 --- a/common/src/main/java/net/william278/huskhomes/teleport/TimedTeleport.java +++ b/common/src/main/java/net/william278/huskhomes/teleport/TimedTeleport.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.teleport; import de.themoep.minedown.adventure.MineDown; diff --git a/common/src/main/java/net/william278/huskhomes/teleport/Username.java b/common/src/main/java/net/william278/huskhomes/teleport/Username.java index 5a1abcdc..646e61e5 100644 --- a/common/src/main/java/net/william278/huskhomes/teleport/Username.java +++ b/common/src/main/java/net/william278/huskhomes/teleport/Username.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.teleport; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/user/CommandUser.java b/common/src/main/java/net/william278/huskhomes/user/CommandUser.java index f647889f..499b1f8b 100644 --- a/common/src/main/java/net/william278/huskhomes/user/CommandUser.java +++ b/common/src/main/java/net/william278/huskhomes/user/CommandUser.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.user; import de.themoep.minedown.adventure.MineDown; diff --git a/common/src/main/java/net/william278/huskhomes/user/ConsoleUser.java b/common/src/main/java/net/william278/huskhomes/user/ConsoleUser.java index 6c89f2d2..f7fbf389 100644 --- a/common/src/main/java/net/william278/huskhomes/user/ConsoleUser.java +++ b/common/src/main/java/net/william278/huskhomes/user/ConsoleUser.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.user; import net.kyori.adventure.audience.Audience; diff --git a/common/src/main/java/net/william278/huskhomes/user/OnlineUser.java b/common/src/main/java/net/william278/huskhomes/user/OnlineUser.java index be456189..7c017c99 100644 --- a/common/src/main/java/net/william278/huskhomes/user/OnlineUser.java +++ b/common/src/main/java/net/william278/huskhomes/user/OnlineUser.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.user; import de.themoep.minedown.adventure.MineDown; @@ -247,7 +266,8 @@ public abstract class OnlineUser extends User implements Teleportable, CommandUs * @param nodePrefix the prefix of the permission nodes to get * @return a list of numbers from the prefixed permission nodes, sorted by size */ - private List getNumericalPermissions(@NotNull String nodePrefix) { + @NotNull + protected List getNumericalPermissions(@NotNull String nodePrefix) { return getPermissions().entrySet().stream() .filter(Map.Entry::getValue) .filter(permission -> permission.getKey().startsWith(nodePrefix)) diff --git a/common/src/main/java/net/william278/huskhomes/user/SavedUser.java b/common/src/main/java/net/william278/huskhomes/user/SavedUser.java index d02d8b78..d480393b 100644 --- a/common/src/main/java/net/william278/huskhomes/user/SavedUser.java +++ b/common/src/main/java/net/william278/huskhomes/user/SavedUser.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.user; import org.jetbrains.annotations.NotNull; diff --git a/common/src/main/java/net/william278/huskhomes/user/User.java b/common/src/main/java/net/william278/huskhomes/user/User.java index 74fb27bf..75f30d54 100644 --- a/common/src/main/java/net/william278/huskhomes/user/User.java +++ b/common/src/main/java/net/william278/huskhomes/user/User.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.user; import org.jetbrains.annotations.NotNull; diff --git a/common/src/main/java/net/william278/huskhomes/util/TaskRunner.java b/common/src/main/java/net/william278/huskhomes/util/TaskRunner.java index 6ed6871c..07998827 100644 --- a/common/src/main/java/net/william278/huskhomes/util/TaskRunner.java +++ b/common/src/main/java/net/william278/huskhomes/util/TaskRunner.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.util; import net.william278.huskhomes.HuskHomes; @@ -9,9 +28,9 @@ import java.util.function.Supplier; public interface TaskRunner { int runAsync(@NotNull Runnable runnable); CompletableFuture supplyAsync(@NotNull Supplier supplier); - int runSync(@NotNull Runnable runnable); + void runSync(@NotNull Runnable runnable); int runAsyncRepeating(@NotNull Runnable runnable, long delay); - int runLater(@NotNull Runnable runnable, long delay); + void runLater(@NotNull Runnable runnable, long delay); void cancelTask(int taskId); void cancelAllTasks(); @NotNull diff --git a/common/src/main/java/net/william278/huskhomes/util/ThrowingConsumer.java b/common/src/main/java/net/william278/huskhomes/util/ThrowingConsumer.java index fd3084d1..6bf00eb7 100644 --- a/common/src/main/java/net/william278/huskhomes/util/ThrowingConsumer.java +++ b/common/src/main/java/net/william278/huskhomes/util/ThrowingConsumer.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.util; import java.util.function.Consumer; diff --git a/common/src/main/java/net/william278/huskhomes/util/UnsafeBlocks.java b/common/src/main/java/net/william278/huskhomes/util/UnsafeBlocks.java index d7049908..3bad9182 100644 --- a/common/src/main/java/net/william278/huskhomes/util/UnsafeBlocks.java +++ b/common/src/main/java/net/william278/huskhomes/util/UnsafeBlocks.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.util; import net.kyori.adventure.key.Key; diff --git a/common/src/main/java/net/william278/huskhomes/util/ValidationException.java b/common/src/main/java/net/william278/huskhomes/util/ValidationException.java index cea9f389..9cbf422c 100644 --- a/common/src/main/java/net/william278/huskhomes/util/ValidationException.java +++ b/common/src/main/java/net/william278/huskhomes/util/ValidationException.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.util; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/main/java/net/william278/huskhomes/util/Validator.java b/common/src/main/java/net/william278/huskhomes/util/Validator.java index e3aea16f..17163cdd 100644 --- a/common/src/main/java/net/william278/huskhomes/util/Validator.java +++ b/common/src/main/java/net/william278/huskhomes/util/Validator.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.util; import net.william278.huskhomes.HuskHomes; diff --git a/common/src/test/java/net/william278/huskhomes/config/LocalesTests.java b/common/src/test/java/net/william278/huskhomes/config/LocalesTests.java index 87436770..e181547e 100644 --- a/common/src/test/java/net/william278/huskhomes/config/LocalesTests.java +++ b/common/src/test/java/net/william278/huskhomes/config/LocalesTests.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.config; import net.william278.annotaml.Annotaml; diff --git a/common/src/test/java/net/william278/huskhomes/hook/PlanDataExtensionTests.java b/common/src/test/java/net/william278/huskhomes/hook/PlanDataExtensionTests.java index 2cfef0bf..0e4d915d 100644 --- a/common/src/test/java/net/william278/huskhomes/hook/PlanDataExtensionTests.java +++ b/common/src/test/java/net/william278/huskhomes/hook/PlanDataExtensionTests.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.hook; import com.djrapitops.plan.extension.extractor.ExtensionExtractor; diff --git a/common/src/test/java/net/william278/huskhomes/network/MessageSerializationTests.java b/common/src/test/java/net/william278/huskhomes/network/MessageSerializationTests.java index 5dfdaaa5..aa307a57 100644 --- a/common/src/test/java/net/william278/huskhomes/network/MessageSerializationTests.java +++ b/common/src/test/java/net/william278/huskhomes/network/MessageSerializationTests.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.network; import com.google.gson.Gson; diff --git a/common/src/test/java/net/william278/huskhomes/random/NormalDistributionTests.java b/common/src/test/java/net/william278/huskhomes/random/NormalDistributionTests.java index 475bec7b..115edf8b 100644 --- a/common/src/test/java/net/william278/huskhomes/random/NormalDistributionTests.java +++ b/common/src/test/java/net/william278/huskhomes/random/NormalDistributionTests.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.random; import com.github.plot.Plot; diff --git a/fabric/build.gradle b/fabric/build.gradle new file mode 100644 index 00000000..78b3a7b9 --- /dev/null +++ b/fabric/build.gradle @@ -0,0 +1,69 @@ +plugins { + id 'fabric-loom' version '1.1-SNAPSHOT' +} + +apply plugin: 'fabric-loom' +loom.serverOnlyMinecraftJar() + +dependencies { + minecraft 'com.mojang:minecraft:1.19.4' + mappings 'net.fabricmc:yarn:1.19.4+build.2' + modImplementation 'net.fabricmc:fabric-loader:0.14.19' + + // Fabric API modules + Set fabricApiModules = [ + 'fabric-api-base', + 'fabric-lifecycle-events-v1', + 'fabric-entity-events-v1', + 'fabric-command-api-v2', + 'fabric-networking-api-v1' + ] + fabricApiModules.forEach { + modImplementation(fabricApi.module(it, '0.77.0+1.19.4')) + } + modImplementation include('net.kyori:adventure-platform-fabric:5.8.0') + modImplementation include('me.lucko:fabric-permissions-api:0.2-SNAPSHOT') + + implementation include('redis.clients:jedis:' + jedis_version) + implementation include('com.mysql:mysql-connector-j:' + mysql_driver_version) + implementation include('org.xerial:sqlite-jdbc:' + sqlite_driver_version) + + compileOnly 'org.jetbrains:annotations:24.0.1' + + shadow project(path: ":common") +} + +shadowJar { + configurations = [project.configurations.shadow] + destinationDirectory.set(file("$projectDir/build/libs")) + + exclude('net.fabricmc:.*') + exclude('net.kyori:.*') + exclude '/mappings/*' + + relocate 'org.apache.commons.io', 'net.william278.huskhomes.libraries.commons.io' + relocate 'org.apache.commons.text', 'net.william278.huskhomes.libraries.commons.text' + relocate 'org.apache.commons.lang3', 'net.william278.huskhomes.libraries.commons.lang3' + relocate 'de.themoep', 'net.william278.huskhomes.libraries' + relocate 'org.jetbrains', 'net.william278.huskhomes.libraries' + relocate 'org.intellij', 'net.william278.huskhomes.libraries' + relocate 'com.zaxxer', 'net.william278.huskhomes.libraries' + relocate 'net.william278.annotaml', 'net.william278.huskhomes.libraries.annotaml' + relocate 'net.william278.paginedown', 'net.william278.huskhomes.libraries.paginedown' + relocate 'net.william278.desertwell', 'net.william278.huskhomes.libraries.desertwell' + relocate 'dev.dejvokep.boostedyaml', 'net.william278.huskhomes.libraries.boostedyaml' + relocate 'org.yaml.snakeyaml', 'net.william278.huskhomes.libraries.snakeyaml' + relocate 'com.google.gson', 'net.william278.huskhomes.libraries.gson' +} + +remapJar { + dependsOn tasks.shadowJar + mustRunAfter tasks.shadowJar + inputFile = shadowJar.archiveFile.get() + addNestedDependencies = true + + destinationDirectory.set(file("$rootDir/target/")) + archiveClassifier.set('') +} + +shadowJar.finalizedBy(remapJar) \ No newline at end of file diff --git a/fabric/src/main/java/net/william278/huskhomes/FabricHuskHomes.java b/fabric/src/main/java/net/william278/huskhomes/FabricHuskHomes.java new file mode 100644 index 00000000..7a6b42a6 --- /dev/null +++ b/fabric/src/main/java/net/william278/huskhomes/FabricHuskHomes.java @@ -0,0 +1,479 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.william278.huskhomes; + +import net.fabricmc.api.DedicatedServerModInitializer; +import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback; +import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; +import net.fabricmc.fabric.api.networking.v1.PacketSender; +import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking; +import net.fabricmc.loader.api.FabricLoader; +import net.fabricmc.loader.api.ModContainer; +import net.kyori.adventure.platform.fabric.FabricServerAudiences; +import net.minecraft.network.PacketByteBuf; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.network.ServerPlayNetworkHandler; +import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; +import net.william278.annotaml.Annotaml; +import net.william278.desertwell.Version; +import net.william278.huskhomes.command.Command; +import net.william278.huskhomes.command.FabricCommand; +import net.william278.huskhomes.config.Locales; +import net.william278.huskhomes.config.Server; +import net.william278.huskhomes.config.Settings; +import net.william278.huskhomes.config.Spawn; +import net.william278.huskhomes.database.Database; +import net.william278.huskhomes.database.MySqlDatabase; +import net.william278.huskhomes.database.SqLiteDatabase; +import net.william278.huskhomes.event.FabricEventDispatcher; +import net.william278.huskhomes.hook.Hook; +import net.william278.huskhomes.listener.EventListener; +import net.william278.huskhomes.listener.FabricEventListener; +import net.william278.huskhomes.manager.Manager; +import net.william278.huskhomes.network.Broker; +import net.william278.huskhomes.network.PluginMessageBroker; +import net.william278.huskhomes.network.RedisBroker; +import net.william278.huskhomes.position.Location; +import net.william278.huskhomes.position.World; +import net.william278.huskhomes.random.NormalDistributionEngine; +import net.william278.huskhomes.random.RandomTeleportEngine; +import net.william278.huskhomes.user.ConsoleUser; +import net.william278.huskhomes.user.FabricUser; +import net.william278.huskhomes.user.OnlineUser; +import net.william278.huskhomes.user.SavedUser; +import net.william278.huskhomes.util.FabricTaskRunner; +import net.william278.huskhomes.util.UnsafeBlocks; +import net.william278.huskhomes.util.Validator; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.spi.LoggingEventBuilder; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.InvocationTargetException; +import java.nio.file.Files; +import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.logging.Level; +import java.util.stream.Collectors; + +public class FabricHuskHomes implements DedicatedServerModInitializer, HuskHomes, + FabricTaskRunner, FabricEventDispatcher, ServerPlayNetworking.PlayChannelHandler { + + public static final Logger LOGGER = LoggerFactory.getLogger("HuskHomes"); + private static FabricHuskHomes instance; + + @NotNull + public static FabricHuskHomes getInstance() { + return instance; + } + + private final ModContainer modContainer = FabricLoader.getInstance() + .getModContainer("huskhomes").orElseThrow(() -> new RuntimeException("Failed to get Mod Container")); + private MinecraftServer minecraftServer; + private Map permissions; + private Set savedUsers; + private Settings settings; + private Locales locales; + private Database database; + private Validator validator; + private Manager manager; + private EventListener eventListener; + private RandomTeleportEngine randomTeleportEngine; + private Spawn serverSpawn; + private UnsafeBlocks unsafeBlocks; + private List hooks; + private List commands; + private Map> globalPlayerList; + private Set currentlyOnWarmup; + private Server server; + @Nullable + private Broker broker; + private FabricServerAudiences audiences; + + @Override + public void onInitializeServer() { + // Set instance + instance = this; + + // Get plugin version from mod container + this.permissions = new HashMap<>(); + this.savedUsers = new HashSet<>(); + this.globalPlayerList = new HashMap<>(); + this.currentlyOnWarmup = new HashSet<>(); + this.validator = new Validator(this); + + // Load settings and locales + initialize("plugin config & locale files", (plugin) -> { + if (!loadConfigs()) { + throw new IllegalStateException("Failed to load config files. Please check the console for errors"); + } + }); + + // Pre-register commands + initialize("commands", (plugin) -> this.commands = registerCommands()); + + ServerLifecycleEvents.SERVER_STARTING.register(server -> { + this.minecraftServer = server; + this.onEnable(); + }); + ServerLifecycleEvents.SERVER_STOPPING.register(server -> this.onDisable()); + } + + private void onEnable() { + // Create adventure audience + this.audiences = FabricServerAudiences.of(minecraftServer); + + // Initialize the database + initialize(getSettings().getDatabaseType().getDisplayName() + " database connection", (plugin) -> { + this.database = switch (getSettings().getDatabaseType()) { + case MYSQL -> new MySqlDatabase(this); + case SQLITE -> new SqLiteDatabase(this); + }; + + database.initialize(); + }); + + // Initialize the manager + this.manager = new Manager(this); + + // Initialize the network messenger if proxy mode is enabled + if (getSettings().doCrossServer()) { + initialize(settings.getBrokerType().getDisplayName() + " message broker", (plugin) -> { + broker = switch (settings.getBrokerType()) { + case PLUGIN_MESSAGE -> new PluginMessageBroker(this); + case REDIS -> new RedisBroker(this); + }; + broker.initialize(); + }); + } + + setRandomTeleportEngine(new NormalDistributionEngine(this)); + + // Register plugin hooks (Economy, Maps, Plan) + initialize("hooks", (plugin) -> { + this.registerHooks(); + + if (hooks.size() > 0) { + hooks.forEach(Hook::initialize); + log(Level.INFO, "Registered " + hooks.size() + " mod hooks: " + hooks.stream() + .map(Hook::getName) + .collect(Collectors.joining(", "))); + } + }); + + // Register events + initialize("events", (plugin) -> this.eventListener = new FabricEventListener(this)); + + this.checkForUpdates(); + } + + private void onDisable() { + if (this.eventListener != null) { + this.eventListener.handlePluginDisable(); + } + if (database != null) { + database.terminate(); + } + if (broker != null) { + broker.close(); + } + if (audiences != null) { + audiences.close(); + audiences = null; + } + cancelAllTasks(); + } + + @Override + @NotNull + public ConsoleUser getConsole() { + return new ConsoleUser(audiences.console()); + } + + @Override + @NotNull + public List getOnlineUsers() { + return minecraftServer.getPlayerManager().getPlayerList() + .stream().map(user -> (OnlineUser) FabricUser.adapt(this, user)) + .toList(); + } + + @Override + @NotNull + public Set getSavedUsers() { + return savedUsers; + } + + @Override + @NotNull + public Settings getSettings() { + return settings; + } + + @Override + public void setSettings(@NotNull Settings settings) { + this.settings = settings; + } + + @Override + @NotNull + public Locales getLocales() { + return locales; + } + + @Override + public void setLocales(@NotNull Locales locales) { + this.locales = locales; + } + + @Override + public Optional getServerSpawn() { + return Optional.ofNullable(serverSpawn); + } + + @Override + public void setServerSpawn(@NotNull Spawn spawn) { + this.serverSpawn = spawn; + } + + @Override + @NotNull + public String getServerName() { + return server.getName(); + } + + @Override + public void setServer(@NotNull Server server) { + this.server = server; + } + + @Override + public void setUnsafeBlocks(@NotNull UnsafeBlocks unsafeBlocks) { + this.unsafeBlocks = unsafeBlocks; + } + + @Override + @NotNull + public Database getDatabase() { + return database; + } + + @Override + @NotNull + public Validator getValidator() { + return validator; + } + + @Override + @NotNull + public Manager getManager() { + return manager; + } + + @Override + @NotNull + public Broker getMessenger() { + if (broker == null) { + throw new IllegalStateException("Attempted to access message broker when it was not initialized"); + } + return broker; + } + + @Override + @NotNull + public RandomTeleportEngine getRandomTeleportEngine() { + return randomTeleportEngine; + } + + @Override + public void setRandomTeleportEngine(@NotNull RandomTeleportEngine randomTeleportEngine) { + this.randomTeleportEngine = randomTeleportEngine; + } + + @Override + public void setServerSpawn(@NotNull Location location) { + try { + this.serverSpawn = Annotaml.create(new File(getDataFolder(), "spawn.yml"), new Spawn(location)).get(); + + // Update the world spawn location, too + minecraftServer.getWorlds().forEach(world -> { + if (world.getRegistryKey().getValue().asString().equals(location.getWorld().getName())) { + world.setSpawnPos(BlockPos.ofFloored(location.getX(), location.getY(), location.getZ()), 0); + } + }); + } catch (IOException | InvocationTargetException | InstantiationException | IllegalAccessException e) { + log(Level.WARNING, "Failed to save the server spawn.yml file", e); + } + } + + @Override + @NotNull + public List getHooks() { + return hooks; + } + + @Override + public void setHooks(@NotNull List hooks) { + this.hooks = hooks; + } + + @Override + public CompletableFuture> findSafeGroundLocation(@NotNull Location location) { + return CompletableFuture.completedFuture(Optional.of(location)); //todo + } + + @Override + @Nullable + public InputStream getResource(@NotNull String name) { + return this.modContainer.findPath(name) + .map(path -> { + try { + return Files.newInputStream(path); + } catch (IOException e) { + log(Level.WARNING, "Failed to load resource: " + name, e); + } + return null; + }) + .orElse(this.getClass().getClassLoader().getResourceAsStream(name)); + } + + @Override + @NotNull + public File getDataFolder() { + return FabricLoader.getInstance().getConfigDir().resolve("huskhomes").toFile(); + } + + @Override + @NotNull + public List getWorlds() { + final List worlds = new ArrayList<>(); + minecraftServer.getWorlds().forEach(world -> worlds.add(World.from( + world.getRegistryKey().getValue().asString(), + UUID.nameUUIDFromBytes(world.getRegistryKey().getValue().asString().getBytes()) + ))); + return worlds; + } + + @Override + @NotNull + public Version getVersion() { + return Version.fromString(modContainer.getMetadata().getVersion().getFriendlyString(), "-"); + } + + @Override + @NotNull + public List getCommands() { + return commands; + } + + @Override + @NotNull + public List registerCommands() { + final List commands = Arrays.stream(FabricCommand.Type.values()) + .map(FabricCommand.Type::getCommand) + .filter(command -> !settings.isCommandDisabled(command)) + .toList(); + + CommandRegistrationCallback.EVENT.register((dispatcher, ignored, ignored2) -> + commands.forEach(command -> new FabricCommand(command, this).register(dispatcher))); + + return commands; + } + + @Override + public boolean isDependencyLoaded(@NotNull String name) { + return FabricLoader.getInstance().isModLoaded(name); + } + + @Override + @NotNull + public Map> getGlobalPlayerList() { + return globalPlayerList; + } + + @Override + @NotNull + public Set getCurrentlyOnWarmup() { + return currentlyOnWarmup; + } + + @Override + public boolean isBlockUnsafe(@NotNull String blockId) { + return unsafeBlocks.isUnsafe(blockId); + } + + @Override + public void registerMetrics(int metricsId) { + // No metrics for Fabric + } + + @Override + public void initializePluginChannels() { + ServerPlayNetworking.registerGlobalReceiver(new Identifier("bungeecord", "main"), this); + } + + // When a plugin message is received by the server + @Override + public void receive(@NotNull MinecraftServer server, @NotNull ServerPlayerEntity player, + @NotNull ServerPlayNetworkHandler handler, @NotNull PacketByteBuf buf, @NotNull PacketSender responseSender) { + if (broker != null && broker instanceof PluginMessageBroker pluginMessenger + && getSettings().getBrokerType() == Broker.Type.PLUGIN_MESSAGE) { + pluginMessenger.onReceive(PluginMessageBroker.BUNGEE_CHANNEL_ID, FabricUser.adapt(this, player), buf.readByteArray()); + } + } + + @Override + public void log(@NotNull Level level, @NotNull String message, @NotNull Throwable... exceptions) { + LoggingEventBuilder logEvent = LOGGER.makeLoggingEventBuilder( + switch (level.getName()) { + case "WARNING" -> org.slf4j.event.Level.WARN; + case "SEVERE" -> org.slf4j.event.Level.ERROR; + default -> org.slf4j.event.Level.INFO; + } + ); + if (exceptions.length >= 1) { + logEvent = logEvent.setCause(exceptions[0]); + } + logEvent.log(message); + } + + @NotNull + public Map getPermissions() { + return permissions; + } + + @NotNull + public MinecraftServer getMinecraftServer() { + return minecraftServer; + } + + @Override + @NotNull + public FabricHuskHomes getPlugin() { + return this; + } + +} diff --git a/fabric/src/main/java/net/william278/huskhomes/command/FabricCommand.java b/fabric/src/main/java/net/william278/huskhomes/command/FabricCommand.java new file mode 100644 index 00000000..9987cfea --- /dev/null +++ b/fabric/src/main/java/net/william278/huskhomes/command/FabricCommand.java @@ -0,0 +1,162 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.william278.huskhomes.command; + +import com.mojang.brigadier.CommandDispatcher; +import com.mojang.brigadier.builder.LiteralArgumentBuilder; +import com.mojang.brigadier.tree.LiteralCommandNode; +import me.lucko.fabric.api.permissions.v0.PermissionCheckEvent; +import me.lucko.fabric.api.permissions.v0.Permissions; +import net.fabricmc.fabric.api.util.TriState; +import net.minecraft.server.command.ServerCommandSource; +import net.minecraft.server.network.ServerPlayerEntity; +import net.william278.huskhomes.FabricHuskHomes; +import net.william278.huskhomes.teleport.TeleportRequest; +import net.william278.huskhomes.user.CommandUser; +import net.william278.huskhomes.user.FabricUser; +import org.jetbrains.annotations.NotNull; + +import java.util.Map; + +import static com.mojang.brigadier.arguments.StringArgumentType.greedyString; +import static net.minecraft.server.command.CommandManager.argument; +import static net.minecraft.server.command.CommandManager.literal; + +public class FabricCommand { + + private final FabricHuskHomes plugin; + private final Command command; + + public FabricCommand(@NotNull Command command, @NotNull FabricHuskHomes plugin) { + this.command = command; + this.plugin = plugin; + } + + public void register(@NotNull CommandDispatcher dispatcher) { + // Register brigadier command + final LiteralArgumentBuilder builder = literal(command.getName()) + .requires(Permissions.require(command.getPermission(), command.isOperatorCommand() ? 3 : 0)) + .executes(getBrigadierExecutor()); + plugin.getPermissions().put(command.getPermission(), command.isOperatorCommand()); + if (!command.getRawUsage().isBlank()) { + builder.then(argument(command.getRawUsage().replaceAll("[<>\\[\\]]", ""), greedyString()) + .executes(getBrigadierExecutor()) + .suggests(getBrigadierSuggester())); + } + + // Register additional permissions + final Map permissions = command.getAdditionalPermissions(); + permissions.forEach((permission, isOp) -> plugin.getPermissions().put(permission, isOp)); + PermissionCheckEvent.EVENT.register((player, node) -> { + if (permissions.containsKey(node) && permissions.get(node) && player.hasPermissionLevel(3)) { + return TriState.TRUE; + } + return TriState.DEFAULT; + }); + + // Register aliases + final LiteralCommandNode node = dispatcher.register(builder); + dispatcher.register(literal("huskhomes:" + command.getName()).executes(getBrigadierExecutor()).redirect(node)); + command.getAliases().forEach(alias -> dispatcher.register(literal(alias).executes(getBrigadierExecutor()).redirect(node))); + } + + private com.mojang.brigadier.Command getBrigadierExecutor() { + return (context) -> { + command.onExecuted( + resolveExecutor(context.getSource()), + command.removeFirstArg(context.getInput().split(" ")) + ); + return 1; + }; + } + + private com.mojang.brigadier.suggestion.SuggestionProvider getBrigadierSuggester() { + if (!(command instanceof TabProvider provider)) { + return (context, builder) -> com.mojang.brigadier.suggestion.Suggestions.empty(); + } + return (context, builder) -> { + final String[] args = command.removeFirstArg(context.getInput().split(" ")); + provider.getSuggestions(resolveExecutor(context.getSource()), args).stream() + .map(suggestion -> { + final String completedArgs = String.join(" ", args); + int lastIndex = completedArgs.lastIndexOf(" "); + if (lastIndex == -1) { + return suggestion; + } + return completedArgs.substring(0, lastIndex + 1) + suggestion; + }) + .forEach(builder::suggest); + return builder.buildFuture(); + }; + } + + private CommandUser resolveExecutor(@NotNull ServerCommandSource source) { + if (source.getEntity() instanceof ServerPlayerEntity player) { + return FabricUser.adapt(plugin, player); + } + return plugin.getConsole(); + } + + + /** + * Commands available on the Fabric HuskHomes implementation + */ + public enum Type { + HOME_COMMAND(new PrivateHomeCommand(FabricHuskHomes.getInstance())), + SET_HOME_COMMAND(new SetHomeCommand(FabricHuskHomes.getInstance())), + HOME_LIST_COMMAND(new PrivateHomeListCommand(FabricHuskHomes.getInstance())), + DEL_HOME_COMMAND(new DelHomeCommand(FabricHuskHomes.getInstance())), + EDIT_HOME_COMMAND(new EditHomeCommand(FabricHuskHomes.getInstance())), + PUBLIC_HOME_COMMAND(new PublicHomeCommand(FabricHuskHomes.getInstance())), + PUBLIC_HOME_LIST_COMMAND(new PublicHomeListCommand(FabricHuskHomes.getInstance())), + WARP_COMMAND(new WarpCommand(FabricHuskHomes.getInstance())), + SET_WARP_COMMAND(new SetWarpCommand(FabricHuskHomes.getInstance())), + WARP_LIST_COMMAND(new WarpListCommand(FabricHuskHomes.getInstance())), + DEL_WARP_COMMAND(new DelWarpCommand(FabricHuskHomes.getInstance())), + EDIT_WARP_COMMAND(new EditWarpCommand(FabricHuskHomes.getInstance())), + TP_COMMAND(new TpCommand(FabricHuskHomes.getInstance())), + TP_HERE_COMMAND(new TpHereCommand(FabricHuskHomes.getInstance())), + TPA_COMMAND(new TeleportRequestCommand(FabricHuskHomes.getInstance(), TeleportRequest.Type.TPA)), + TPA_HERE_COMMAND(new TeleportRequestCommand(FabricHuskHomes.getInstance(), TeleportRequest.Type.TPA_HERE)), + TPACCEPT_COMMAND(new TpRespondCommand(FabricHuskHomes.getInstance(), true)), + TPDECLINE_COMMAND(new TpRespondCommand(FabricHuskHomes.getInstance(), false)), + RTP_COMMAND(new RtpCommand(FabricHuskHomes.getInstance())), + TP_IGNORE_COMMAND(new TpIgnoreCommand(FabricHuskHomes.getInstance())), + TP_OFFLINE_COMMAND(new TpOfflineCommand(FabricHuskHomes.getInstance())), + TP_ALL_COMMAND(new TpAllCommand(FabricHuskHomes.getInstance())), + TPA_ALL_COMMAND(new TpaAllCommand(FabricHuskHomes.getInstance())), + SPAWN_COMMAND(new SpawnCommand(FabricHuskHomes.getInstance())), + SET_SPAWN_COMMAND(new SetSpawnCommand(FabricHuskHomes.getInstance())), + BACK_COMMAND(new BackCommand(FabricHuskHomes.getInstance())), + HUSKHOMES_COMMAND(new HuskHomesCommand(FabricHuskHomes.getInstance())); + + private final Command command; + + Type(@NotNull Command command) { + this.command = command; + } + + @NotNull + public Command getCommand() { + return command; + } + } + +} diff --git a/fabric/src/main/java/net/william278/huskhomes/event/DeleteAllHomesCallback.java b/fabric/src/main/java/net/william278/huskhomes/event/DeleteAllHomesCallback.java new file mode 100644 index 00000000..f84f238d --- /dev/null +++ b/fabric/src/main/java/net/william278/huskhomes/event/DeleteAllHomesCallback.java @@ -0,0 +1,82 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.william278.huskhomes.event; + +import net.fabricmc.fabric.api.event.Event; +import net.fabricmc.fabric.api.event.EventFactory; +import net.minecraft.util.ActionResult; +import net.william278.huskhomes.user.CommandUser; +import net.william278.huskhomes.user.User; +import org.jetbrains.annotations.NotNull; + +import java.util.function.BiFunction; + +public interface DeleteAllHomesCallback extends FabricEventCallback { + + @NotNull + Event EVENT = EventFactory.createArrayBacked(DeleteAllHomesCallback.class, + (listeners) -> (event) -> { + for (DeleteAllHomesCallback listener : listeners) { + final ActionResult result = listener.invoke(event); + if (event.isCancelled()) { + return ActionResult.CONSUME; + } else if (result != ActionResult.PASS) { + event.setCancelled(true); + return result; + } + } + + return ActionResult.PASS; + }); + + @NotNull + BiFunction SUPPLIER = (owner, deleter) -> + new IDeleteAllHomesEvent() { + private boolean cancelled = false; + + @Override + @NotNull + public User getHomeOwner() { + return owner; + } + + @Override + @NotNull + public CommandUser getDeleter() { + return deleter; + } + + @Override + public void setCancelled(boolean cancelled) { + this.cancelled = cancelled; + } + + @Override + public boolean isCancelled() { + return cancelled; + } + + @NotNull + public Event getEvent() { + return EVENT; + } + }; + +} diff --git a/fabric/src/main/java/net/william278/huskhomes/event/DeleteAllWarpsCallback.java b/fabric/src/main/java/net/william278/huskhomes/event/DeleteAllWarpsCallback.java new file mode 100644 index 00000000..78945be9 --- /dev/null +++ b/fabric/src/main/java/net/william278/huskhomes/event/DeleteAllWarpsCallback.java @@ -0,0 +1,75 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.william278.huskhomes.event; + +import net.fabricmc.fabric.api.event.Event; +import net.fabricmc.fabric.api.event.EventFactory; +import net.minecraft.util.ActionResult; +import net.william278.huskhomes.user.CommandUser; +import org.jetbrains.annotations.NotNull; + +import java.util.function.Function; + +public interface DeleteAllWarpsCallback extends FabricEventCallback { + + @NotNull + Event EVENT = EventFactory.createArrayBacked(DeleteAllWarpsCallback.class, + (listeners) -> (event) -> { + for (DeleteAllWarpsCallback listener : listeners) { + final ActionResult result = listener.invoke(event); + if (event.isCancelled()) { + return ActionResult.CONSUME; + } else if (result != ActionResult.PASS) { + event.setCancelled(true); + return result; + } + } + + return ActionResult.PASS; + }); + + @NotNull + Function SUPPLIER = (deleter) -> + new IDeleteAllWarpsEvent() { + private boolean cancelled = false; + + @Override + @NotNull + public CommandUser getDeleter() { + return deleter; + } + + @Override + public void setCancelled(boolean cancelled) { + this.cancelled = cancelled; + } + + @Override + public boolean isCancelled() { + return cancelled; + } + + @NotNull + public Event getEvent() { + return EVENT; + } + }; + +} diff --git a/fabric/src/main/java/net/william278/huskhomes/event/FabricEventCallback.java b/fabric/src/main/java/net/william278/huskhomes/event/FabricEventCallback.java new file mode 100644 index 00000000..ef0c3a7f --- /dev/null +++ b/fabric/src/main/java/net/william278/huskhomes/event/FabricEventCallback.java @@ -0,0 +1,31 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.william278.huskhomes.event; + +import net.minecraft.util.ActionResult; +import org.jetbrains.annotations.NotNull; + +public interface FabricEventCallback { + + @NotNull + ActionResult invoke(@NotNull E event); + + +} diff --git a/fabric/src/main/java/net/william278/huskhomes/event/FabricEventDispatcher.java b/fabric/src/main/java/net/william278/huskhomes/event/FabricEventDispatcher.java new file mode 100644 index 00000000..f377bb03 --- /dev/null +++ b/fabric/src/main/java/net/william278/huskhomes/event/FabricEventDispatcher.java @@ -0,0 +1,138 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.william278.huskhomes.event; + +import net.minecraft.util.ActionResult; +import net.william278.huskhomes.FabricHuskHomes; +import net.william278.huskhomes.position.Home; +import net.william278.huskhomes.position.Position; +import net.william278.huskhomes.position.Warp; +import net.william278.huskhomes.teleport.Teleport; +import net.william278.huskhomes.teleport.TeleportRequest; +import net.william278.huskhomes.teleport.TimedTeleport; +import net.william278.huskhomes.user.CommandUser; +import net.william278.huskhomes.user.OnlineUser; +import net.william278.huskhomes.user.User; +import org.jetbrains.annotations.NotNull; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.List; +import java.util.logging.Level; + +public interface FabricEventDispatcher extends EventDispatcher { + + @SuppressWarnings("unchecked") + @Override + default boolean fireIsCancelled(@NotNull T event) { + try { + final Method field = event.getClass().getDeclaredMethod("getEvent"); + field.setAccessible(true); + + net.fabricmc.fabric.api.event.Event fabricEvent = (net.fabricmc.fabric.api.event.Event) field.invoke(event); + + final FabricEventCallback invoker = (FabricEventCallback) fabricEvent.invoker(); + return invoker.invoke(event) == ActionResult.FAIL; + } catch (InvocationTargetException | NoSuchMethodException | IllegalAccessException e) { + getPlugin().log(Level.WARNING, "Failed to fire event (" + event.getClass().getName() + ")", e); + return false; + } + } + + @Override + default ITeleportEvent getTeleportEvent(@NotNull Teleport teleport) { + return TeleportCallback.SUPPLIER.apply(teleport); + } + + @Override + default ITeleportWarmupEvent getTeleportWarmupEvent(@NotNull TimedTeleport teleport, int duration) { + return TeleportWarmupCallback.SUPPLIER.apply(teleport, duration); + } + + @Override + default ISendTeleportRequestEvent getSendTeleportRequestEvent(@NotNull OnlineUser sender, @NotNull TeleportRequest request) { + return SendTeleportRequestCallback.SUPPLIER.apply(sender, request); + } + + @Override + default IReceiveTeleportRequestEvent getReceiveTeleportRequestEvent(@NotNull OnlineUser recipient, @NotNull TeleportRequest request) { + return ReceiveTeleportRequestCallback.SUPPLIER.apply(recipient, request); + } + + @Override + default IReplyTeleportRequestEvent getReplyTeleportRequestEvent(@NotNull OnlineUser recipient, @NotNull TeleportRequest request) { + return ReplyTeleportRequestCallback.SUPPLIER.apply(recipient, request); + } + + @Override + default IHomeCreateEvent getHomeCreateEvent(@NotNull User owner, @NotNull String name, @NotNull Position position, @NotNull CommandUser creator) { + return HomeCreateCallback.SUPPLIER.apply(owner, name, position, creator); + } + + @Override + default IHomeEditEvent getHomeEditEvent(@NotNull Home home, @NotNull CommandUser editor) { + return HomeEditCallback.SUPPLIER.apply(home, editor); + } + + @Override + default IHomeDeleteEvent getHomeDeleteEvent(@NotNull Home home, @NotNull CommandUser deleter) { + return HomeDeleteCallback.SUPPLIER.apply(home, deleter); + } + + @Override + default IWarpCreateEvent getWarpCreateEvent(@NotNull String name, @NotNull Position position, @NotNull CommandUser creator) { + return WarpCreateCallback.SUPPLIER.apply(name, position, creator); + } + + @Override + default IWarpEditEvent getWarpEditEvent(@NotNull Warp warp, @NotNull CommandUser editor) { + return WarpEditCallback.SUPPLIER.apply(warp, editor); + } + + @Override + default IWarpDeleteEvent getWarpDeleteEvent(@NotNull Warp warp, @NotNull CommandUser deleter) { + return WarpDeleteCallback.SUPPLIER.apply(warp, deleter); + } + + @Override + default IHomeListEvent getViewHomeListEvent(@NotNull List homes, @NotNull CommandUser listViewer, boolean publicHomeList) { + return HomeListCallback.SUPPLIER.apply(homes, listViewer, publicHomeList); + } + + @Override + default IWarpListEvent getViewWarpListEvent(@NotNull List homes, @NotNull CommandUser listViewer) { + return WarpListCallback.SUPPLIER.apply(homes, listViewer); + } + + @Override + default IDeleteAllHomesEvent getDeleteAllHomesEvent(@NotNull User user, @NotNull CommandUser deleter) { + return DeleteAllHomesCallback.SUPPLIER.apply(user, deleter); + } + + @Override + default IDeleteAllWarpsEvent getDeleteAllWarpsEvent(@NotNull CommandUser deleter) { + return DeleteAllWarpsCallback.SUPPLIER.apply(deleter); + } + + @Override + @NotNull + FabricHuskHomes getPlugin(); + +} diff --git a/fabric/src/main/java/net/william278/huskhomes/event/HomeCreateCallback.java b/fabric/src/main/java/net/william278/huskhomes/event/HomeCreateCallback.java new file mode 100644 index 00000000..026ad4b3 --- /dev/null +++ b/fabric/src/main/java/net/william278/huskhomes/event/HomeCreateCallback.java @@ -0,0 +1,103 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.william278.huskhomes.event; + +import net.fabricmc.fabric.api.event.Event; +import net.fabricmc.fabric.api.event.EventFactory; +import net.minecraft.data.client.BlockStateVariantMap.QuadFunction; +import net.minecraft.util.ActionResult; +import net.william278.huskhomes.position.Position; +import net.william278.huskhomes.user.CommandUser; +import net.william278.huskhomes.user.User; +import org.jetbrains.annotations.NotNull; + +public interface HomeCreateCallback extends FabricEventCallback { + + @NotNull + Event EVENT = EventFactory.createArrayBacked(HomeCreateCallback.class, + (listeners) -> (event) -> { + for (HomeCreateCallback listener : listeners) { + final ActionResult result = listener.invoke(event); + if (event.isCancelled()) { + return ActionResult.CONSUME; + } else if (result != ActionResult.PASS) { + event.setCancelled(true); + return result; + } + } + + return ActionResult.PASS; + }); + + @NotNull + QuadFunction SUPPLIER = (user, name, position, creator) -> + new IHomeCreateEvent() { + private boolean cancelled = false; + private String homeName = name; + + @Override + @NotNull + public User getOwner() { + return user; + } + + @Override + @NotNull + public String getName() { + return homeName; + } + + @Override + public void setName(@NotNull String name) { + this.homeName = name; + } + + @Override + @NotNull + public Position getPosition() { + return position; + } + + @Override + public void setPosition(@NotNull Position position) { + } + + @Override + public @NotNull CommandUser getCreator() { + return creator; + } + + @Override + public void setCancelled(boolean cancelled) { + this.cancelled = cancelled; + } + + @Override + public boolean isCancelled() { + return cancelled; + } + + @NotNull + public Event getEvent() { + return EVENT; + } + }; + +} diff --git a/fabric/src/main/java/net/william278/huskhomes/event/HomeDeleteCallback.java b/fabric/src/main/java/net/william278/huskhomes/event/HomeDeleteCallback.java new file mode 100644 index 00000000..0f479589 --- /dev/null +++ b/fabric/src/main/java/net/william278/huskhomes/event/HomeDeleteCallback.java @@ -0,0 +1,83 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.william278.huskhomes.event; + +import net.fabricmc.fabric.api.event.Event; +import net.fabricmc.fabric.api.event.EventFactory; +import net.minecraft.util.ActionResult; +import net.william278.huskhomes.position.Home; +import net.william278.huskhomes.user.CommandUser; +import org.jetbrains.annotations.NotNull; + +import java.util.function.BiFunction; + +public interface HomeDeleteCallback extends FabricEventCallback { + + @NotNull + Event EVENT = EventFactory.createArrayBacked(HomeDeleteCallback.class, + (listeners) -> (event) -> { + for (HomeDeleteCallback listener : listeners) { + final ActionResult result = listener.invoke(event); + if (event.isCancelled()) { + return ActionResult.CONSUME; + } else if (result != ActionResult.PASS) { + event.setCancelled(true); + return result; + } + } + + return ActionResult.PASS; + }); + + @NotNull + BiFunction SUPPLIER = (home, deleter) -> + new IHomeDeleteEvent() { + private boolean cancelled = false; + + @Override + @NotNull + public Home getHome() { + return home; + } + + @Override + @NotNull + public CommandUser getDeleter() { + return deleter; + } + + @Override + public void setCancelled(boolean cancelled) { + this.cancelled = cancelled; + } + + @Override + public boolean isCancelled() { + return cancelled; + } + + @NotNull + public Event getEvent() { + return EVENT; + } + + }; + +} diff --git a/fabric/src/main/java/net/william278/huskhomes/event/HomeEditCallback.java b/fabric/src/main/java/net/william278/huskhomes/event/HomeEditCallback.java new file mode 100644 index 00000000..3b28f749 --- /dev/null +++ b/fabric/src/main/java/net/william278/huskhomes/event/HomeEditCallback.java @@ -0,0 +1,83 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.william278.huskhomes.event; + +import net.fabricmc.fabric.api.event.Event; +import net.fabricmc.fabric.api.event.EventFactory; +import net.minecraft.util.ActionResult; +import net.william278.huskhomes.position.Home; +import net.william278.huskhomes.user.CommandUser; +import org.jetbrains.annotations.NotNull; + +import java.util.function.BiFunction; + +public interface HomeEditCallback extends FabricEventCallback { + + @NotNull + Event EVENT = EventFactory.createArrayBacked(HomeEditCallback.class, + (listeners) -> (event) -> { + for (HomeEditCallback listener : listeners) { + final ActionResult result = listener.invoke(event); + if (event.isCancelled()) { + return ActionResult.CONSUME; + } else if (result != ActionResult.PASS) { + event.setCancelled(true); + return result; + } + } + + return ActionResult.PASS; + }); + + @NotNull + BiFunction SUPPLIER = (home, editor) -> + new IHomeEditEvent() { + private boolean cancelled = false; + + @Override + @NotNull + public Home getHome() { + return home; + } + + @Override + @NotNull + public CommandUser getEditor() { + return editor; + } + + @Override + public void setCancelled(boolean cancelled) { + this.cancelled = cancelled; + } + + @Override + public boolean isCancelled() { + return cancelled; + } + + @NotNull + public Event getEvent() { + return EVENT; + } + + }; + +} diff --git a/fabric/src/main/java/net/william278/huskhomes/event/HomeListCallback.java b/fabric/src/main/java/net/william278/huskhomes/event/HomeListCallback.java new file mode 100644 index 00000000..e89d5cb6 --- /dev/null +++ b/fabric/src/main/java/net/william278/huskhomes/event/HomeListCallback.java @@ -0,0 +1,95 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.william278.huskhomes.event; + +import net.fabricmc.fabric.api.event.Event; +import net.fabricmc.fabric.api.event.EventFactory; +import net.minecraft.util.ActionResult; +import net.william278.huskhomes.position.Home; +import net.william278.huskhomes.user.CommandUser; +import org.apache.commons.lang3.function.TriFunction; +import org.jetbrains.annotations.NotNull; + +import java.util.List; + +public interface HomeListCallback extends FabricEventCallback { + + @NotNull + Event EVENT = EventFactory.createArrayBacked(HomeListCallback.class, + (listeners) -> (event) -> { + for (HomeListCallback listener : listeners) { + final ActionResult result = listener.invoke(event); + if (event.isCancelled()) { + return ActionResult.CONSUME; + } else if (result != ActionResult.PASS) { + event.setCancelled(true); + return result; + } + } + + return ActionResult.PASS; + }); + + @NotNull + TriFunction, CommandUser, Boolean, IHomeListEvent> SUPPLIER = (homes, viewer, publicHomes) -> + new IHomeListEvent() { + private boolean cancelled = false; + private List listHomes = homes; + + @Override + @NotNull + public List getHomes() { + return listHomes; + } + + @Override + public void setHomes(@NotNull List homes) { + this.listHomes = homes; + } + + @Override + @NotNull + public CommandUser getListViewer() { + return viewer; + } + + @Override + public boolean getIsPublicHomeList() { + return publicHomes; + } + + @Override + public void setCancelled(boolean cancelled) { + this.cancelled = cancelled; + } + + @Override + public boolean isCancelled() { + return cancelled; + } + + @NotNull + public Event getEvent() { + return EVENT; + } + + }; + +} diff --git a/fabric/src/main/java/net/william278/huskhomes/event/ReceiveTeleportRequestCallback.java b/fabric/src/main/java/net/william278/huskhomes/event/ReceiveTeleportRequestCallback.java new file mode 100644 index 00000000..a0b4da5a --- /dev/null +++ b/fabric/src/main/java/net/william278/huskhomes/event/ReceiveTeleportRequestCallback.java @@ -0,0 +1,83 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.william278.huskhomes.event; + +import net.fabricmc.fabric.api.event.Event; +import net.fabricmc.fabric.api.event.EventFactory; +import net.minecraft.util.ActionResult; +import net.william278.huskhomes.teleport.TeleportRequest; +import net.william278.huskhomes.user.OnlineUser; +import org.jetbrains.annotations.NotNull; + +import java.util.function.BiFunction; + +public interface ReceiveTeleportRequestCallback extends FabricEventCallback { + + @NotNull + Event EVENT = EventFactory.createArrayBacked(ReceiveTeleportRequestCallback.class, + (listeners) -> (event) -> { + for (ReceiveTeleportRequestCallback listener : listeners) { + final ActionResult result = listener.invoke(event); + if (event.isCancelled()) { + return ActionResult.CONSUME; + } else if (result != ActionResult.PASS) { + event.setCancelled(true); + return result; + } + } + + return ActionResult.PASS; + }); + + @NotNull + BiFunction SUPPLIER = (recipient, request) -> + new IReceiveTeleportRequestEvent() { + private boolean cancelled = false; + + @Override + @NotNull + public OnlineUser getRecipient() { + return recipient; + } + + @Override + @NotNull + public TeleportRequest getRequest() { + return request; + } + + @Override + public void setCancelled(boolean cancelled) { + this.cancelled = cancelled; + } + + @Override + public boolean isCancelled() { + return cancelled; + } + + @NotNull + public Event getEvent() { + return EVENT; + } + + }; + +} diff --git a/fabric/src/main/java/net/william278/huskhomes/event/ReplyTeleportRequestCallback.java b/fabric/src/main/java/net/william278/huskhomes/event/ReplyTeleportRequestCallback.java new file mode 100644 index 00000000..85dcddb8 --- /dev/null +++ b/fabric/src/main/java/net/william278/huskhomes/event/ReplyTeleportRequestCallback.java @@ -0,0 +1,83 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.william278.huskhomes.event; + +import net.fabricmc.fabric.api.event.Event; +import net.fabricmc.fabric.api.event.EventFactory; +import net.minecraft.util.ActionResult; +import net.william278.huskhomes.teleport.TeleportRequest; +import net.william278.huskhomes.user.OnlineUser; +import org.jetbrains.annotations.NotNull; + +import java.util.function.BiFunction; + +public interface ReplyTeleportRequestCallback extends FabricEventCallback { + + @NotNull + Event EVENT = EventFactory.createArrayBacked(ReplyTeleportRequestCallback.class, + (listeners) -> (event) -> { + for (ReplyTeleportRequestCallback listener : listeners) { + final ActionResult result = listener.invoke(event); + if (event.isCancelled()) { + return ActionResult.CONSUME; + } else if (result != ActionResult.PASS) { + event.setCancelled(true); + return result; + } + } + + return ActionResult.PASS; + }); + + @NotNull + BiFunction SUPPLIER = (recipient, request) -> + new IReplyTeleportRequestEvent() { + private boolean cancelled = false; + + @Override + @NotNull + public OnlineUser getRecipient() { + return recipient; + } + + @Override + @NotNull + public TeleportRequest getRequest() { + return request; + } + + @Override + public void setCancelled(boolean cancelled) { + this.cancelled = cancelled; + } + + @Override + public boolean isCancelled() { + return cancelled; + } + + @NotNull + public Event getEvent() { + return EVENT; + } + + }; + +} diff --git a/fabric/src/main/java/net/william278/huskhomes/event/SendTeleportRequestCallback.java b/fabric/src/main/java/net/william278/huskhomes/event/SendTeleportRequestCallback.java new file mode 100644 index 00000000..d7fd6505 --- /dev/null +++ b/fabric/src/main/java/net/william278/huskhomes/event/SendTeleportRequestCallback.java @@ -0,0 +1,83 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.william278.huskhomes.event; + +import net.fabricmc.fabric.api.event.Event; +import net.fabricmc.fabric.api.event.EventFactory; +import net.minecraft.util.ActionResult; +import net.william278.huskhomes.teleport.TeleportRequest; +import net.william278.huskhomes.user.OnlineUser; +import org.jetbrains.annotations.NotNull; + +import java.util.function.BiFunction; + +public interface SendTeleportRequestCallback extends FabricEventCallback { + + @NotNull + Event EVENT = EventFactory.createArrayBacked(SendTeleportRequestCallback.class, + (listeners) -> (event) -> { + for (SendTeleportRequestCallback listener : listeners) { + final ActionResult result = listener.invoke(event); + if (event.isCancelled()) { + return ActionResult.CONSUME; + } else if (result != ActionResult.PASS) { + event.setCancelled(true); + return result; + } + } + + return ActionResult.PASS; + }); + + @NotNull + BiFunction SUPPLIER = (sender, request) -> + new ISendTeleportRequestEvent() { + private boolean cancelled = false; + + @Override + @NotNull + public OnlineUser getSender() { + return sender; + } + + @Override + @NotNull + public TeleportRequest getRequest() { + return request; + } + + @Override + public void setCancelled(boolean cancelled) { + this.cancelled = cancelled; + } + + @Override + public boolean isCancelled() { + return cancelled; + } + + @NotNull + public Event getEvent() { + return EVENT; + } + + }; + +} diff --git a/fabric/src/main/java/net/william278/huskhomes/event/TeleportBackCallback.java b/fabric/src/main/java/net/william278/huskhomes/event/TeleportBackCallback.java new file mode 100644 index 00000000..90a153c6 --- /dev/null +++ b/fabric/src/main/java/net/william278/huskhomes/event/TeleportBackCallback.java @@ -0,0 +1,83 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.william278.huskhomes.event; + +import net.fabricmc.fabric.api.event.Event; +import net.fabricmc.fabric.api.event.EventFactory; +import net.minecraft.util.ActionResult; +import net.william278.huskhomes.position.Position; +import net.william278.huskhomes.teleport.Teleport; +import org.jetbrains.annotations.NotNull; + +import java.util.function.Function; + +public interface TeleportBackCallback extends FabricEventCallback { + + @NotNull + Event EVENT = EventFactory.createArrayBacked(TeleportBackCallback.class, + (listeners) -> (event) -> { + for (TeleportBackCallback listener : listeners) { + final ActionResult result = listener.invoke(event); + if (event.isCancelled()) { + return ActionResult.FAIL; + } else if (result == ActionResult.FAIL) { + event.setCancelled(true); + return result; + } + } + + return ActionResult.PASS; + }); + + @NotNull + Function SUPPLIER = (teleport) -> + new ITeleportBackEvent() { + private boolean cancelled = false; + + @Override + @NotNull + public Position getLastPosition() { + return (Position) getTeleport().getTarget(); + } + + @Override + @NotNull + public Teleport getTeleport() { + return teleport; + } + + @Override + public void setCancelled(boolean cancelled) { + this.cancelled = cancelled; + } + + @Override + public boolean isCancelled() { + return cancelled; + } + + @NotNull + public Event getEvent() { + return EVENT; + } + + }; + +} diff --git a/fabric/src/main/java/net/william278/huskhomes/event/TeleportCallback.java b/fabric/src/main/java/net/william278/huskhomes/event/TeleportCallback.java new file mode 100644 index 00000000..99a7cc6b --- /dev/null +++ b/fabric/src/main/java/net/william278/huskhomes/event/TeleportCallback.java @@ -0,0 +1,76 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.william278.huskhomes.event; + +import net.fabricmc.fabric.api.event.Event; +import net.fabricmc.fabric.api.event.EventFactory; +import net.minecraft.util.ActionResult; +import net.william278.huskhomes.teleport.Teleport; +import org.jetbrains.annotations.NotNull; + +import java.util.function.Function; + +public interface TeleportCallback extends FabricEventCallback { + + @NotNull + Event EVENT = EventFactory.createArrayBacked(TeleportCallback.class, + (listeners) -> (event) -> { + for (TeleportCallback listener : listeners) { + final ActionResult result = listener.invoke(event); + if (event.isCancelled()) { + return ActionResult.FAIL; + } else if (result == ActionResult.FAIL) { + event.setCancelled(true); + return result; + } + } + + return ActionResult.PASS; + }); + + @NotNull + Function SUPPLIER = (teleport) -> + new ITeleportEvent() { + private boolean cancelled = false; + + @Override + @NotNull + public Teleport getTeleport() { + return teleport; + } + + @Override + public void setCancelled(boolean cancelled) { + this.cancelled = cancelled; + } + + @Override + public boolean isCancelled() { + return cancelled; + } + + @NotNull + public Event getEvent() { + return EVENT; + } + + }; + +} diff --git a/fabric/src/main/java/net/william278/huskhomes/event/TeleportWarmupCallback.java b/fabric/src/main/java/net/william278/huskhomes/event/TeleportWarmupCallback.java new file mode 100644 index 00000000..c9d6961c --- /dev/null +++ b/fabric/src/main/java/net/william278/huskhomes/event/TeleportWarmupCallback.java @@ -0,0 +1,79 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.william278.huskhomes.event; + +import net.fabricmc.fabric.api.event.Event; +import net.fabricmc.fabric.api.event.EventFactory; +import net.minecraft.util.ActionResult; +import net.william278.huskhomes.teleport.TimedTeleport; +import org.jetbrains.annotations.NotNull; + +import java.util.function.BiFunction; + +public interface TeleportWarmupCallback extends FabricEventCallback { + @NotNull + Event EVENT = EventFactory.createArrayBacked(TeleportWarmupCallback.class, + (listeners) -> (event) -> { + for (TeleportWarmupCallback listener : listeners) { + final ActionResult result = listener.invoke(event); + if (event.isCancelled()) { + return ActionResult.FAIL; + } else if (result == ActionResult.FAIL) { + event.setCancelled(true); + return result; + } + } + + return ActionResult.PASS; + }); + + @NotNull + BiFunction SUPPLIER = (timedTeleport, duration) -> + new ITeleportWarmupEvent() { + private boolean cancelled = false; + + @Override + @NotNull + public TimedTeleport getTimedTeleport() { + return timedTeleport; + } + + @Override + public int getWarmupDuration() { + return duration; + } + + @Override + public void setCancelled(boolean cancelled) { + this.cancelled = cancelled; + } + + @Override + public boolean isCancelled() { + return cancelled; + } + + @NotNull + public Event getEvent() { + return EVENT; + } + + }; +} diff --git a/fabric/src/main/java/net/william278/huskhomes/event/WarpCreateCallback.java b/fabric/src/main/java/net/william278/huskhomes/event/WarpCreateCallback.java new file mode 100644 index 00000000..78b69dc9 --- /dev/null +++ b/fabric/src/main/java/net/william278/huskhomes/event/WarpCreateCallback.java @@ -0,0 +1,98 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.william278.huskhomes.event; + +import net.fabricmc.fabric.api.event.Event; +import net.fabricmc.fabric.api.event.EventFactory; +import net.minecraft.util.ActionResult; +import net.william278.huskhomes.position.Position; +import net.william278.huskhomes.user.CommandUser; +import org.apache.commons.lang3.function.TriFunction; +import org.jetbrains.annotations.NotNull; + +public interface WarpCreateCallback extends FabricEventCallback { + + @NotNull + Event EVENT = EventFactory.createArrayBacked(WarpCreateCallback.class, + (listeners) -> (event) -> { + for (WarpCreateCallback listener : listeners) { + final ActionResult result = listener.invoke(event); + if (event.isCancelled()) { + return ActionResult.CONSUME; + } else if (result != ActionResult.PASS) { + event.setCancelled(true); + return result; + } + } + + return ActionResult.PASS; + }); + + @NotNull + TriFunction SUPPLIER = (name, position, creator) -> + new IWarpCreateEvent() { + private boolean cancelled = false; + private String homeName = name; + + @Override + @NotNull + public String getName() { + return homeName; + } + + @Override + public void setName(@NotNull String name) { + this.homeName = name; + } + + @Override + @NotNull + public Position getPosition() { + return position; + } + + @Override + public void setPosition(@NotNull Position position) { + } + + @Override + @NotNull + public CommandUser getCreator() { + return creator; + } + + @Override + public void setCancelled(boolean cancelled) { + this.cancelled = cancelled; + } + + @Override + public boolean isCancelled() { + return cancelled; + } + + @NotNull + public Event getEvent() { + return EVENT; + } + + }; + +} diff --git a/fabric/src/main/java/net/william278/huskhomes/event/WarpDeleteCallback.java b/fabric/src/main/java/net/william278/huskhomes/event/WarpDeleteCallback.java new file mode 100644 index 00000000..cbba72ea --- /dev/null +++ b/fabric/src/main/java/net/william278/huskhomes/event/WarpDeleteCallback.java @@ -0,0 +1,83 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.william278.huskhomes.event; + +import net.fabricmc.fabric.api.event.Event; +import net.fabricmc.fabric.api.event.EventFactory; +import net.minecraft.util.ActionResult; +import net.william278.huskhomes.position.Warp; +import net.william278.huskhomes.user.CommandUser; +import org.jetbrains.annotations.NotNull; + +import java.util.function.BiFunction; + +public interface WarpDeleteCallback extends FabricEventCallback { + + @NotNull + Event EVENT = EventFactory.createArrayBacked(WarpDeleteCallback.class, + (listeners) -> (event) -> { + for (WarpDeleteCallback listener : listeners) { + final ActionResult result = listener.invoke(event); + if (event.isCancelled()) { + return ActionResult.CONSUME; + } else if (result != ActionResult.PASS) { + event.setCancelled(true); + return result; + } + } + + return ActionResult.PASS; + }); + + @NotNull + BiFunction SUPPLIER = (warp, deleter) -> + new IWarpDeleteEvent() { + private boolean cancelled = false; + + @Override + @NotNull + public Warp getWarp() { + return warp; + } + + @Override + @NotNull + public CommandUser getDeleter() { + return deleter; + } + + @Override + public void setCancelled(boolean cancelled) { + this.cancelled = cancelled; + } + + @Override + public boolean isCancelled() { + return cancelled; + } + + @NotNull + public Event getEvent() { + return EVENT; + } + + }; + +} diff --git a/fabric/src/main/java/net/william278/huskhomes/event/WarpEditCallback.java b/fabric/src/main/java/net/william278/huskhomes/event/WarpEditCallback.java new file mode 100644 index 00000000..d3291d91 --- /dev/null +++ b/fabric/src/main/java/net/william278/huskhomes/event/WarpEditCallback.java @@ -0,0 +1,83 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.william278.huskhomes.event; + +import net.fabricmc.fabric.api.event.Event; +import net.fabricmc.fabric.api.event.EventFactory; +import net.minecraft.util.ActionResult; +import net.william278.huskhomes.position.Warp; +import net.william278.huskhomes.user.CommandUser; +import org.jetbrains.annotations.NotNull; + +import java.util.function.BiFunction; + +public interface WarpEditCallback extends FabricEventCallback { + + @NotNull + Event EVENT = EventFactory.createArrayBacked(WarpEditCallback.class, + (listeners) -> (event) -> { + for (WarpEditCallback listener : listeners) { + final ActionResult result = listener.invoke(event); + if (event.isCancelled()) { + return ActionResult.CONSUME; + } else if (result != ActionResult.PASS) { + event.setCancelled(true); + return result; + } + } + + return ActionResult.PASS; + }); + + @NotNull + BiFunction SUPPLIER = (warp, editor) -> + new IWarpEditEvent() { + private boolean cancelled = false; + + @Override + @NotNull + public Warp getWarp() { + return warp; + } + + @Override + @NotNull + public CommandUser getEditor() { + return editor; + } + + @Override + public void setCancelled(boolean cancelled) { + this.cancelled = cancelled; + } + + @Override + public boolean isCancelled() { + return cancelled; + } + + @NotNull + public Event getEvent() { + return EVENT; + } + + }; + +} diff --git a/fabric/src/main/java/net/william278/huskhomes/event/WarpListCallback.java b/fabric/src/main/java/net/william278/huskhomes/event/WarpListCallback.java new file mode 100644 index 00000000..21f2a55f --- /dev/null +++ b/fabric/src/main/java/net/william278/huskhomes/event/WarpListCallback.java @@ -0,0 +1,90 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.william278.huskhomes.event; + +import net.fabricmc.fabric.api.event.Event; +import net.fabricmc.fabric.api.event.EventFactory; +import net.minecraft.util.ActionResult; +import net.william278.huskhomes.position.Warp; +import net.william278.huskhomes.user.CommandUser; +import org.jetbrains.annotations.NotNull; + +import java.util.List; +import java.util.function.BiFunction; + +public interface WarpListCallback extends FabricEventCallback { + + @NotNull + Event EVENT = EventFactory.createArrayBacked(WarpListCallback.class, + (listeners) -> (event) -> { + for (WarpListCallback listener : listeners) { + final ActionResult result = listener.invoke(event); + if (event.isCancelled()) { + return ActionResult.CONSUME; + } else if (result != ActionResult.PASS) { + event.setCancelled(true); + return result; + } + } + + return ActionResult.PASS; + }); + + @NotNull + BiFunction, CommandUser, IWarpListEvent> SUPPLIER = (warps, viewer) -> + new IWarpListEvent() { + private boolean cancelled = false; + private List listWarps = warps; + + @Override + @NotNull + public List getWarps() { + return listWarps; + } + + @Override + public void setWarps(@NotNull List homes) { + this.listWarps = homes; + } + + @Override + @NotNull + public CommandUser getListViewer() { + return viewer; + } + + @Override + public void setCancelled(boolean cancelled) { + this.cancelled = cancelled; + } + + @Override + public boolean isCancelled() { + return cancelled; + } + + @NotNull + public Event getEvent() { + return EVENT; + } + + }; + +} diff --git a/fabric/src/main/java/net/william278/huskhomes/listener/FabricEventListener.java b/fabric/src/main/java/net/william278/huskhomes/listener/FabricEventListener.java new file mode 100644 index 00000000..969d9d82 --- /dev/null +++ b/fabric/src/main/java/net/william278/huskhomes/listener/FabricEventListener.java @@ -0,0 +1,64 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.william278.huskhomes.listener; + +import net.fabricmc.fabric.api.entity.event.v1.ServerLivingEntityEvents; +import net.fabricmc.fabric.api.entity.event.v1.ServerPlayerEvents; +import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents; +import net.minecraft.server.network.ServerPlayerEntity; +import net.william278.huskhomes.FabricHuskHomes; +import net.william278.huskhomes.user.FabricUser; +import org.jetbrains.annotations.NotNull; + +// Note that the teleport event and update player respawn position events are not handled on Fabric. +// The "update last position on teleport event" and "global respawn" features are not supported on Fabric. +public class FabricEventListener extends EventListener { + + public FabricEventListener(@NotNull FabricHuskHomes plugin) { + super(plugin); + this.registerEvents(plugin); + } + + // Register fabric event callback listeners to internal handlers + private void registerEvents(@NotNull FabricHuskHomes plugin) { + // Join event + ServerPlayConnectionEvents.JOIN.register((handler, sender, server) -> handlePlayerJoin( + FabricUser.adapt(plugin, handler.player) + )); + + // Quit event + ServerPlayConnectionEvents.DISCONNECT.register((handler, server) -> handlePlayerLeave( + FabricUser.adapt(plugin, handler.player) + )); + + // Death event + ServerLivingEntityEvents.AFTER_DEATH.register((entity, source) -> { + if (entity instanceof ServerPlayerEntity player) { + handlePlayerDeath(FabricUser.adapt(plugin, player)); + } + }); + + // Respawn event + ServerPlayerEvents.AFTER_RESPAWN.register((oldPlayer, newPlayer, alive) -> handlePlayerRespawn( + FabricUser.adapt(plugin, newPlayer) + )); + } + +} diff --git a/fabric/src/main/java/net/william278/huskhomes/user/FabricUser.java b/fabric/src/main/java/net/william278/huskhomes/user/FabricUser.java new file mode 100644 index 00000000..f77fa69f --- /dev/null +++ b/fabric/src/main/java/net/william278/huskhomes/user/FabricUser.java @@ -0,0 +1,155 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.william278.huskhomes.user; + +import me.lucko.fabric.api.permissions.v0.Permissions; +import net.fabricmc.fabric.api.networking.v1.PacketByteBufs; +import net.kyori.adventure.audience.Audience; +import net.minecraft.network.PacketByteBuf; +import net.minecraft.network.packet.s2c.play.CustomPayloadS2CPacket; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; +import net.william278.huskhomes.FabricHuskHomes; +import net.william278.huskhomes.position.Location; +import net.william278.huskhomes.position.Position; +import net.william278.huskhomes.position.World; +import net.william278.huskhomes.teleport.TeleportationException; +import org.jetbrains.annotations.NotNull; + +import java.util.*; + +public class FabricUser extends OnlineUser { + private final FabricHuskHomes plugin; + private final ServerPlayerEntity player; + + private FabricUser(@NotNull FabricHuskHomes plugin, @NotNull ServerPlayerEntity player) { + super(player.getUuid(), player.getEntityName()); + this.plugin = plugin; + this.player = player; + } + + @NotNull + public static FabricUser adapt(@NotNull FabricHuskHomes plugin, @NotNull ServerPlayerEntity player) { + return new FabricUser(plugin, player); + } + + @Override + public Position getPosition() { + return Position.at( + player.getX(), player.getY(), player.getZ(), + player.getYaw(), player.getPitch(), + World.from( + player.getWorld().getRegistryKey().getValue().asString(), + UUID.nameUUIDFromBytes(player.getWorld().getRegistryKey().getValue().asString().getBytes()) + ), + plugin.getServerName() + ); + } + + @Override + public Optional getBedSpawnPosition() { + final BlockPos spawn = player.getSpawnPointPosition(); + if (spawn == null) { + return Optional.empty(); + } + + return Optional.of(Position.at( + spawn.getX(), spawn.getY(), spawn.getZ(), + player.getSpawnAngle(), 0, + World.from( + player.getSpawnPointDimension().getValue().asString(), + UUID.nameUUIDFromBytes(player.getSpawnPointDimension().getValue().asString().getBytes()) + ), + plugin.getServerName() + )); + } + + @Override + public double getHealth() { + return player.getHealth(); + } + + @Override + public boolean hasPermission(@NotNull String node) { + final boolean requiresOp = Boolean.TRUE.equals(plugin.getPermissions().computeIfPresent(node, (key, isOp) -> isOp)); + return Permissions.check(player, node, !requiresOp || player.hasPermissionLevel(3)); + } + + @Override + @NotNull + public Map getPermissions() { + return plugin.getPermissions().entrySet().stream() + .filter(entry -> Permissions.check(player, entry.getKey(), entry.getValue())) + .collect(HashMap::new, (map, entry) -> map.put(entry.getKey(), entry.getValue()), HashMap::putAll); + } + + @Override + @NotNull + protected List getNumericalPermissions(@NotNull String nodePrefix) { + final List permissions = new ArrayList<>(); + for (int i = 0; i < 100; i++) { + if (hasPermission(nodePrefix + i)) { + permissions.add(i); + } + } + return permissions.stream().sorted(Collections.reverseOrder()).toList(); + } + + @Override + @NotNull + public Audience getAudience() { + return player; + } + + @Override + public void teleportLocally(@NotNull Location location, boolean asynchronous) throws TeleportationException { + final MinecraftServer server = player.getWorld().getServer(); + final Identifier worldId = Identifier.tryParse(location.getWorld().getName()); + player.teleport( + server.getWorld(server.getWorldRegistryKeys().stream() + .filter(key -> key.getValue().equals(worldId)).findFirst() + .orElseThrow(() -> new TeleportationException(TeleportationException.Type.WORLD_NOT_FOUND)) + ), + location.getX(), location.getY(), location.getZ(), + location.getYaw(), location.getPitch() + ); + } + + @Override + public void sendPluginMessage(@NotNull String channel, byte[] message) { + final PacketByteBuf buf = PacketByteBufs.create(); + buf.writeBytes(message); + final CustomPayloadS2CPacket packet = new CustomPayloadS2CPacket(Identifier.tryParse(channel), buf); + player.networkHandler.sendPacket(packet); + } + + @Override + public boolean isMoving() { + return player.isTouchingWater() || player.isFallFlying() || player.isSprinting() || player.isSneaking(); + } + + @Override + public boolean isVanished() { + return false; + } + +} diff --git a/fabric/src/main/java/net/william278/huskhomes/util/FabricTaskRunner.java b/fabric/src/main/java/net/william278/huskhomes/util/FabricTaskRunner.java new file mode 100644 index 00000000..7c0ac2dd --- /dev/null +++ b/fabric/src/main/java/net/william278/huskhomes/util/FabricTaskRunner.java @@ -0,0 +1,93 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.william278.huskhomes.util; + +import net.william278.huskhomes.FabricHuskHomes; +import org.jetbrains.annotations.NotNull; + +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Supplier; + +public interface FabricTaskRunner extends TaskRunner { + + ConcurrentHashMap> tasks = new ConcurrentHashMap<>(); + + @Override + default int runAsync(@NotNull Runnable runnable) { + tasks.put(tasks.size(), CompletableFuture.runAsync(runnable, getPlugin().getMinecraftServer())); + return tasks.size(); + } + + @Override + default CompletableFuture supplyAsync(@NotNull Supplier supplier) { + return CompletableFuture.supplyAsync(supplier, getPlugin().getMinecraftServer()); + } + + @Override + default void runSync(@NotNull Runnable runnable) { + getPlugin().getMinecraftServer().executeSync(runnable); + } + + @Override + default int runAsyncRepeating(@NotNull Runnable runnable, long delay) { + tasks.put(tasks.size(), CompletableFuture.runAsync(() -> { + while (true) { + try { + Thread.sleep(delay * 50); + } catch (InterruptedException e) { + e.printStackTrace(); + return; + } + runnable.run(); + } + }, getPlugin().getMinecraftServer())); + return tasks.size(); + } + + @Override + default void runLater(@NotNull Runnable runnable, long delay) { + CompletableFuture.runAsync(() -> { + try { + Thread.sleep(delay * 50); + } catch (InterruptedException e) { + e.printStackTrace(); + return; + } + runnable.run(); + }, getPlugin().getMinecraftServer()); + } + + @Override + default void cancelTask(int taskId) { + tasks.get(taskId).cancel(true); + } + + @Override + default void cancelAllTasks() { + tasks.forEach((taskId, future) -> future.cancel(true)); + tasks.clear(); + } + + @Override + @NotNull + FabricHuskHomes getPlugin(); + +} diff --git a/fabric/src/main/resources/assets/huskhomes/icon.png b/fabric/src/main/resources/assets/huskhomes/icon.png new file mode 100644 index 00000000..7c79c219 Binary files /dev/null and b/fabric/src/main/resources/assets/huskhomes/icon.png differ diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json new file mode 100644 index 00000000..86647b29 --- /dev/null +++ b/fabric/src/main/resources/fabric.mod.json @@ -0,0 +1,37 @@ +{ + "schemaVersion": 1, + "id": "huskhomes", + "version": "${version}", + "name": "HuskHomes", + "icon": "assets/huskhomes/icon.png", + "description": "A powerful, intuitive and flexible teleportation suite", + "authors": [ + { + "name": "William278", + "contact": { + "sources": "https://github.com/WiIIiam278/", + "homepage": "https://william278.net/" + } + } + ], + "license": "Apache-2.0", + "contact": { + "homepage": "https://william278.net/project/huskhomes/", + "repo": "https://github.com/WiIIiam278/HuskHomes2", + "issues": "https://github.com/WiIIiam278/HuskHomes2/issues" + }, + "environment": "server", + "entrypoints": { + "server": [ + "net.william278.huskhomes.FabricHuskHomes" + ] + }, + "depends": { + "fabricloader": ">=0.14.19", + "minecraft": ">=1.19.4", + "fabric-api": "*" + }, + "custom": { + "modmenu:api": true + } +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index e61def2e..a147f318 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,9 +1,9 @@ -org.gradle.jvmargs='-Dfile.encoding=UTF-8' - -org.gradle.daemon=true javaVersion=16 -plugin_version=4.1.1 +org.gradle.jvmargs='-Dfile.encoding=UTF-8' +org.gradle.daemon=true + +plugin_version=4.2 plugin_archive=huskhomes jedis_version=4.3.1 diff --git a/paper/build.gradle b/paper/build.gradle index f0ee85cb..ae860387 100644 --- a/paper/build.gradle +++ b/paper/build.gradle @@ -3,8 +3,8 @@ plugins { } dependencies { - compileOnly project(path: ':common') - implementation project(path: ':bukkit') + implementation project(':bukkit') + compileOnly project(':common') compileOnly 'io.papermc.paper:paper-api:1.19.3-R0.1-SNAPSHOT' compileOnly 'maven.modrinth:pl3xmap:1.19.3-321' diff --git a/paper/src/main/java/net/william278/huskhomes/PaperHuskHomes.java b/paper/src/main/java/net/william278/huskhomes/PaperHuskHomes.java index f3013678..c0471c2e 100644 --- a/paper/src/main/java/net/william278/huskhomes/PaperHuskHomes.java +++ b/paper/src/main/java/net/william278/huskhomes/PaperHuskHomes.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes; import net.william278.huskhomes.command.BukkitCommand; diff --git a/paper/src/main/java/net/william278/huskhomes/PaperHuskHomesLoader.java b/paper/src/main/java/net/william278/huskhomes/PaperHuskHomesLoader.java index 7ec4c13b..94b9557c 100644 --- a/paper/src/main/java/net/william278/huskhomes/PaperHuskHomesLoader.java +++ b/paper/src/main/java/net/william278/huskhomes/PaperHuskHomesLoader.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes; import io.papermc.paper.plugin.loader.PluginClasspathBuilder; diff --git a/paper/src/main/java/net/william278/huskhomes/command/PaperCommand.java b/paper/src/main/java/net/william278/huskhomes/command/PaperCommand.java index 2aef2652..e7006f98 100644 --- a/paper/src/main/java/net/william278/huskhomes/command/PaperCommand.java +++ b/paper/src/main/java/net/william278/huskhomes/command/PaperCommand.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.command; import me.lucko.commodore.CommodoreProvider; diff --git a/paper/src/main/java/net/william278/huskhomes/hook/Pl3xMapHook.java b/paper/src/main/java/net/william278/huskhomes/hook/Pl3xMapHook.java index 94211c0a..afcd609f 100644 --- a/paper/src/main/java/net/william278/huskhomes/hook/Pl3xMapHook.java +++ b/paper/src/main/java/net/william278/huskhomes/hook/Pl3xMapHook.java @@ -1,3 +1,22 @@ +/* + * This file is part of HuskHomes, licensed under the Apache License 2.0. + * + * Copyright (c) William278 + * Copyright (c) contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.william278.huskhomes.hook; import net.pl3x.map.Key; diff --git a/settings.gradle b/settings.gradle index 5cc36d7b..077deffa 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,12 +1,15 @@ pluginManagement { repositories { gradlePluginPortal() + maven { url 'https://maven.fabricmc.net/' } } } rootProject.name = 'HuskHomes' - -include 'common' -include 'bukkit' -include 'paper' -include 'plugin' \ No newline at end of file +include( + 'common', + 'bukkit', + 'paper', + 'plugin', + 'fabric' +) \ No newline at end of file