mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 06:28:49 +00:00
refactor: Fabric 1.20.4, Sponge API v10, Java 17, Platform APIs (#562)
* deps: bump dependencies * refactor: bukkit 1.17.1, Sponge v10, fabric 1.20.4 * refactor: release platform-specific API modules * fix: checkstyle javadoc comment * docs: update API docs * docs: mention API platforms in events api docs
This commit is contained in:
1 parent
c0e079c46c
commit
f8ad215b76
24 files changed
+227
-159
No files matched your search
@@ -57,7 +57,7 @@ jobs:
|
||||
hangar-id: William278/HuskHomes
|
||||
hangar-token: ${{ secrets.HANGAR_API_KEY }}
|
||||
hangar-version-type: Alpha
|
||||
files-primary: target/HuskHomes-Plugin-*.jar
|
||||
files-primary: target/HuskHomes-Paper-*.jar
|
||||
name: HuskHomes (Spigot) v${{ env.version_name }}
|
||||
version: ${{ env.version_name }}
|
||||
version-type: alpha
|
||||
@@ -67,12 +67,11 @@ jobs:
|
||||
paper
|
||||
folia
|
||||
game-versions: |
|
||||
1.16.5
|
||||
1.17.1
|
||||
1.18.2
|
||||
1.19.4
|
||||
1.20.2
|
||||
java: 16
|
||||
1.20.4
|
||||
java: 17
|
||||
- name: 'Sponge: Publish to Modrinth 🧽'
|
||||
uses: WiIIiam278/mc-publish@hangar
|
||||
if: success() || failure()
|
||||
@@ -91,8 +90,8 @@ jobs:
|
||||
loaders: |
|
||||
sponge
|
||||
game-versions: |
|
||||
1.16.5
|
||||
java: 16
|
||||
1.19.4
|
||||
java: 17
|
||||
- name: 'Fabric: Publish to Modrinth & CurseForge 🧵'
|
||||
uses: WiIIiam278/mc-publish@hangar
|
||||
if: success() || failure()
|
||||
@@ -117,7 +116,7 @@ jobs:
|
||||
loaders: |
|
||||
fabric
|
||||
game-versions: |
|
||||
1.20.2
|
||||
1.20.4
|
||||
java: 17
|
||||
- name: 'Upload GitHub Artifacts 📦'
|
||||
uses: actions/upload-artifact@v4
|
||||
@@ -125,6 +124,6 @@ jobs:
|
||||
with:
|
||||
name: HuskHomes
|
||||
path: |
|
||||
target/HuskHomes-Plugin-*.jar
|
||||
target/HuskHomes-Paper-*.jar
|
||||
target/HuskHomes-Sponge-*.jar
|
||||
target/HuskHomes-Fabric-*.jar
|
||||
@@ -45,7 +45,7 @@ jobs:
|
||||
plan | suggests | *
|
||||
hangar-id: William278/HuskHomes
|
||||
hangar-token: ${{ secrets.HANGAR_API_KEY }}
|
||||
files-primary: target/HuskHomes-Plugin-*.jar
|
||||
files-primary: target/HuskHomes-Paper-*.jar
|
||||
name: HuskHomes (Spigot) v${{ github.event.release.tag_name }}
|
||||
version: ${{ github.event.release.tag_name }}
|
||||
version-type: release
|
||||
@@ -55,12 +55,11 @@ jobs:
|
||||
paper
|
||||
folia
|
||||
game-versions: |
|
||||
1.16.5
|
||||
1.17.1
|
||||
1.18.2
|
||||
1.19.4
|
||||
1.20.2
|
||||
java: 16
|
||||
1.20.4
|
||||
java: 17
|
||||
- name: 'Sponge: Publish to Modrinth 🧽'
|
||||
uses: WiIIiam278/mc-publish@hangar
|
||||
with:
|
||||
@@ -78,8 +77,8 @@ jobs:
|
||||
loaders: |
|
||||
sponge
|
||||
game-versions: |
|
||||
1.16.5
|
||||
java: 16
|
||||
1.19.4
|
||||
java: 17
|
||||
- name: 'Fabric: Publish to Modrinth & CurseForge 🧵'
|
||||
uses: WiIIiam278/mc-publish@hangar
|
||||
with:
|
||||
@@ -103,13 +102,13 @@ jobs:
|
||||
loaders: |
|
||||
fabric
|
||||
game-versions: |
|
||||
1.20.2
|
||||
1.20.4
|
||||
java: 17
|
||||
- name: 'Upload GitHub Artifacts 📦'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: HuskHomes
|
||||
path: |
|
||||
target/HuskHomes-Plugin-*.jar
|
||||
target/HuskHomes-Paper-*.jar
|
||||
target/HuskHomes-Sponge-*.jar
|
||||
target/HuskHomes-Fabric-*.jar
|
||||
@@ -5,7 +5,7 @@
|
||||
<img src="https://img.shields.io/github/actions/workflow/status/WiIIiam278/HuskHomes/ci.yml?branch=master&logo=github"/>
|
||||
</a>
|
||||
<a href="https://repo.william278.net/#/releases/net/william278/huskhomes/">
|
||||
<img src="https://repo.william278.net/api/badge/latest/releases/net/william278/huskhomes?color=00fb9a&name=Maven&prefix=v" />
|
||||
<img src="https://repo.william278.net/api/badge/latest/releases/net/william278/huskhomes/huskhomes-common?color=00fb9a&name=Maven&prefix=v" />
|
||||
</a>
|
||||
<a href="https://discord.gg/tVYhJfyDWG">
|
||||
<img src="https://img.shields.io/discord/818135932103557162.svg?label=&logo=discord&logoColor=fff&color=7389D8&labelColor=6A7EC2" />
|
||||
|
||||
+103
-68
@@ -24,6 +24,37 @@ ext {
|
||||
set 'mariadb_driver_version', mariadb_driver_version.toString()
|
||||
}
|
||||
|
||||
publishing {
|
||||
repositories {
|
||||
if (System.getenv("RELEASES_MAVEN_USERNAME") != null) {
|
||||
maven {
|
||||
name = "william278-releases"
|
||||
url = "https://repo.william278.net/releases"
|
||||
credentials {
|
||||
username = System.getenv("RELEASES_MAVEN_USERNAME")
|
||||
password = System.getenv("RELEASES_MAVEN_PASSWORD")
|
||||
}
|
||||
authentication {
|
||||
basic(BasicAuthentication)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (System.getenv("SNAPSHOTS_MAVEN_USERNAME") != null) {
|
||||
maven {
|
||||
name = "william278-snapshots"
|
||||
url = "https://repo.william278.net/snapshots"
|
||||
credentials {
|
||||
username = System.getenv("SNAPSHOTS_MAVEN_USERNAME")
|
||||
password = System.getenv("SNAPSHOTS_MAVEN_PASSWORD")
|
||||
}
|
||||
authentication {
|
||||
basic(BasicAuthentication)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
apply plugin: 'com.github.johnrengelman.shadow'
|
||||
apply plugin: 'org.cadixdev.licenser'
|
||||
@@ -31,7 +62,7 @@ allprojects {
|
||||
apply plugin: 'java'
|
||||
|
||||
compileJava.options.encoding = 'UTF-8'
|
||||
compileJava.options.release.set 16
|
||||
compileJava.options.release.set 17
|
||||
javadoc.options.encoding = 'UTF-8'
|
||||
javadoc.options.addStringOption('Xdoclint:none', '-quiet')
|
||||
|
||||
@@ -59,9 +90,9 @@ allprojects {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.1'
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.10.1'
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.10.1'
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.2'
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.10.2'
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.10.2'
|
||||
}
|
||||
|
||||
license {
|
||||
@@ -74,97 +105,102 @@ allprojects {
|
||||
toolVersion = '10.12.0'
|
||||
}
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
processResources {
|
||||
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'
|
||||
|
||||
jar {
|
||||
from '../LICENSE'
|
||||
}
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
shadowJar {
|
||||
destinationDirectory.set(file("$rootDir/target"))
|
||||
archiveClassifier.set('')
|
||||
}
|
||||
|
||||
if (['paper', 'fabric'].contains(project.name)) {
|
||||
compileJava.options.release.set 17
|
||||
}
|
||||
|
||||
if (['bukkit', 'paper', 'plugin', 'fabric', 'sponge'].contains(project.name)) {
|
||||
shadowJar {
|
||||
destinationDirectory.set(file("$rootDir/target"))
|
||||
archiveClassifier.set('')
|
||||
// API publishing
|
||||
if (['common', 'bukkit', 'fabric', 'sponge'].contains(project.name)) {
|
||||
java {
|
||||
withSourcesJar()
|
||||
withJavadocJar()
|
||||
}
|
||||
sourcesJar {
|
||||
destinationDirectory.set(file("$rootDir/target"))
|
||||
}
|
||||
javadocJar {
|
||||
destinationDirectory.set(file("$rootDir/target"))
|
||||
}
|
||||
shadowJar.dependsOn(sourcesJar, javadocJar)
|
||||
|
||||
if (['bukkit'].contains(project.name)) {
|
||||
java {
|
||||
withSourcesJar()
|
||||
withJavadocJar()
|
||||
}
|
||||
sourcesJar {
|
||||
destinationDirectory.set(file("$rootDir/target"))
|
||||
}
|
||||
javadocJar {
|
||||
destinationDirectory.set(file("$rootDir/target"))
|
||||
}
|
||||
shadowJar.dependsOn(sourcesJar, javadocJar)
|
||||
|
||||
publishing {
|
||||
repositories {
|
||||
if (System.getenv("RELEASES_MAVEN_USERNAME") != null) {
|
||||
maven {
|
||||
name = "william278-releases"
|
||||
url = "https://repo.william278.net/releases"
|
||||
credentials {
|
||||
username = System.getenv("RELEASES_MAVEN_USERNAME")
|
||||
password = System.getenv("RELEASES_MAVEN_PASSWORD")
|
||||
}
|
||||
authentication {
|
||||
basic(BasicAuthentication)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (System.getenv("SNAPSHOTS_MAVEN_USERNAME") != null) {
|
||||
maven {
|
||||
name = "william278-snapshots"
|
||||
url = "https://repo.william278.net/snapshots"
|
||||
credentials {
|
||||
username = System.getenv("SNAPSHOTS_MAVEN_USERNAME")
|
||||
password = System.getenv("SNAPSHOTS_MAVEN_PASSWORD")
|
||||
}
|
||||
authentication {
|
||||
basic(BasicAuthentication)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
publishing {
|
||||
if (['common'].contains(project.name)) {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
groupId = 'net.william278'
|
||||
artifactId = 'huskhomes'
|
||||
mavenJavaCommon(MavenPublication) {
|
||||
groupId = 'net.william278.huskhomes'
|
||||
artifactId = 'huskhomes-common'
|
||||
version = "$rootProject.version"
|
||||
artifact shadowJar
|
||||
artifact javadocJar
|
||||
artifact sourcesJar
|
||||
artifact javadocJar
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (['bukkit'].contains(project.name)) {
|
||||
publications {
|
||||
mavenJavaBukkit(MavenPublication) {
|
||||
groupId = 'net.william278.huskhomes'
|
||||
artifactId = 'huskhomes-bukkit'
|
||||
version = "$rootProject.version"
|
||||
artifact shadowJar
|
||||
artifact sourcesJar
|
||||
artifact javadocJar
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (['fabric'].contains(project.name)) {
|
||||
publications {
|
||||
mavenJavaBukkit(MavenPublication) {
|
||||
groupId = 'net.william278.huskhomes'
|
||||
artifactId = 'huskhomes-fabric'
|
||||
version = "$rootProject.version"
|
||||
artifact shadowJar
|
||||
artifact sourcesJar
|
||||
artifact javadocJar
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (['sponge'].contains(project.name)) {
|
||||
publications {
|
||||
mavenJavaBukkit(MavenPublication) {
|
||||
groupId = 'net.william278.huskhomes'
|
||||
artifactId = 'huskhomes-sponge'
|
||||
version = "$rootProject.version"
|
||||
artifact shadowJar
|
||||
artifact sourcesJar
|
||||
artifact javadocJar
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
jar.dependsOn shadowJar
|
||||
clean.delete "$rootDir/target"
|
||||
}
|
||||
|
||||
jar.dependsOn shadowJar
|
||||
clean.delete "$rootDir/target"
|
||||
}
|
||||
|
||||
logger.lifecycle("Building HuskHomes ${version} by William278")
|
||||
@@ -182,5 +218,4 @@ def versionMetadata() {
|
||||
return '-' + System.getenv("GITHUB_RUN_NUMBER") ? 'build.' + System.getenv("GITHUB_RUN_NUMBER") : 'unknown'
|
||||
}
|
||||
return '-' + grgit.head().abbreviatedId + (grgit.status().clean ? '' : '-indev')
|
||||
}
|
||||
|
||||
}
|
||||
+7
-5
@@ -7,7 +7,7 @@ dependencies {
|
||||
implementation 'me.lucko:commodore:2.2'
|
||||
implementation 'net.kyori:adventure-platform-bukkit:4.3.2'
|
||||
|
||||
compileOnly 'org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT'
|
||||
compileOnly 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT'
|
||||
compileOnly 'org.jetbrains:annotations:24.1.0'
|
||||
compileOnly 'de.themoep:minedown-adventure:1.7.2-SNAPSHOT'
|
||||
compileOnly 'net.william278:annotaml:2.0.5'
|
||||
@@ -18,13 +18,13 @@ dependencies {
|
||||
exclude group: 'org.spigotmc', module: 'spigot-api'
|
||||
}
|
||||
|
||||
testImplementation 'com.github.seeseemelk:MockBukkit-v1.16:1.5.2'
|
||||
testImplementation 'com.github.seeseemelk:MockBukkit-v1.17:1.13.0'
|
||||
testImplementation 'de.themoep:minedown-adventure:1.7.2-SNAPSHOT'
|
||||
testImplementation 'net.kyori:adventure-platform-bukkit:4.3.2'
|
||||
testImplementation 'org.apache.commons:commons-text:1.11.0'
|
||||
testImplementation 'redis.clients:jedis:' + jedis_version
|
||||
testImplementation 'org.xerial:sqlite-jdbc:' + sqlite_driver_version
|
||||
testImplementation 'com.mysql:mysql-connector-j:' + mysql_driver_version
|
||||
testImplementation "redis.clients:jedis:${jedis_version}"
|
||||
testImplementation "org.xerial:sqlite-jdbc:${sqlite_driver_version}"
|
||||
testImplementation "com.mysql:mysql-connector-j:${mysql_driver_version}"
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
@@ -50,4 +50,6 @@ shadowJar {
|
||||
relocate 'io.papermc.lib', 'net.william278.huskhomes.libraries.paperlib'
|
||||
relocate 'space.arim.morepaperlib', 'net.william278.huskhomes.libraries.paperlib'
|
||||
relocate 'me.lucko.commodore', 'net.william278.huskhomes.libraries.commodore'
|
||||
|
||||
minimize()
|
||||
}
|
||||
@@ -230,6 +230,7 @@ public class BukkitHuskHomes extends JavaPlugin implements HuskHomes, BukkitTask
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
HuskHomesAPI.unregister();
|
||||
if (this.eventListener != null) {
|
||||
this.eventListener.handlePluginDisable();
|
||||
}
|
||||
@@ -483,11 +484,6 @@ public class BukkitHuskHomes extends JavaPlugin implements HuskHomes, BukkitTask
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public AudienceProvider getAudiences() {
|
||||
return audiences;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public GracefulScheduling getScheduler() {
|
||||
return paperLib.scheduling();
|
||||
|
||||
@@ -43,9 +43,6 @@ import java.util.Objects;
|
||||
@SuppressWarnings("unused")
|
||||
public class HuskHomesAPI extends BaseHuskHomesAPI {
|
||||
|
||||
// Instance of the plugin
|
||||
private static HuskHomesAPI instance;
|
||||
|
||||
/**
|
||||
* <b>(Internal use only)</b> - Constructor, instantiating the API.
|
||||
*/
|
||||
@@ -62,10 +59,7 @@ public class HuskHomesAPI extends BaseHuskHomesAPI {
|
||||
*/
|
||||
@NotNull
|
||||
public static HuskHomesAPI getInstance() throws NotRegisteredException {
|
||||
if (instance == null) {
|
||||
throw new NotRegisteredException();
|
||||
}
|
||||
return instance;
|
||||
return (HuskHomesAPI) BaseHuskHomesAPI.getInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,14 +72,6 @@ public class HuskHomesAPI extends BaseHuskHomesAPI {
|
||||
instance = new HuskHomesAPI(plugin);
|
||||
}
|
||||
|
||||
/**
|
||||
* <b>(Internal use only)</b> - Unregister the API for this platform.
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
public static void unregister() {
|
||||
instance = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an {@link OnlineUser} instance for the given bukkit {@link Player}.
|
||||
*
|
||||
|
||||
@@ -4,7 +4,7 @@ author: 'William278'
|
||||
website: 'https://william278.net/'
|
||||
main: 'net.william278.huskhomes.BukkitHuskHomes'
|
||||
version: '${version}'
|
||||
api-version: '1.16'
|
||||
api-version: '1.17'
|
||||
softdepend:
|
||||
- Vault
|
||||
- PlaceholderAPI
|
||||
|
||||
@@ -48,9 +48,9 @@ import java.util.Optional;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* Uses MockBukkit to test the plugin on a mock Paper server implementing the Bukkit 1.16 API.
|
||||
* Uses MockBukkit to test the plugin on a mock Paper server implementing the Bukkit 1.17 API.
|
||||
*/
|
||||
@DisplayName("Bukkit Plugin Tests (1.16.5)")
|
||||
@DisplayName("Bukkit Plugin Tests (1.17.1)")
|
||||
public class BukkitPluginTests {
|
||||
|
||||
private static ServerMock server;
|
||||
|
||||
@@ -52,8 +52,12 @@ import java.util.stream.Collectors;
|
||||
* This class should not be used directly, but rather through platform-specific extending API classes.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public abstract class BaseHuskHomesAPI {
|
||||
public class BaseHuskHomesAPI {
|
||||
|
||||
/**
|
||||
* <b>(Internal use only)</b> - API instance.
|
||||
*/
|
||||
protected static BaseHuskHomesAPI instance;
|
||||
/**
|
||||
* <b>(Internal use only)</b> - Instance of the implementing plugin.
|
||||
*/
|
||||
@@ -834,10 +838,35 @@ public abstract class BaseHuskHomesAPI {
|
||||
return plugin.getLocales().getRawLocale(localeKey, replacements);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an instance of the HuskHomes API.
|
||||
*
|
||||
* @return instance of the HuskHomes API
|
||||
* @throws NotRegisteredException if the API has not yet been registered.
|
||||
* @since 1.0
|
||||
*/
|
||||
@NotNull
|
||||
public static BaseHuskHomesAPI getInstance() throws NotRegisteredException {
|
||||
if (instance == null) {
|
||||
throw new NotRegisteredException();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* <b>(Internal use only)</b> - Unregister the API instance.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
public static void unregister() {
|
||||
instance = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* An exception indicating the plugin has been accessed before it has been registered.
|
||||
*/
|
||||
static final class NotRegisteredException extends IllegalStateException {
|
||||
public static final class NotRegisteredException extends IllegalStateException {
|
||||
|
||||
private static final String MESSAGE = """
|
||||
Could not access the HuskHomes API as it has not yet been registered. This could be because:
|
||||
|
||||
@@ -24,6 +24,8 @@ HuskHomes provides a number of API events your plugin can listen to when certain
|
||||
‡ Called on the server the player *is teleported from*; not necessarily where the executor of the teleport is.
|
||||
|
||||
## Events on Sponge & Fabric
|
||||
> **Note:** Check the [[API]] introduction for details on targeting platforms
|
||||
|
||||
Sponge, which has a similar Event api as Bukkit, has equivalent events for all of the above, prefixed with `Sponge` (so HomeCreateEvent on Bukkit is SpongeHomeCreateEvent on Sponge).
|
||||
|
||||
Fabric uses callbacks for handling events. HuskHomes provides callback equivalents for all the above events. For instance, to handle what to do when someone creates a home, you can register a callback to handle what to do as follows:
|
||||
|
||||
+24
-9
@@ -3,7 +3,7 @@ The HuskHomes API provides methods for getting, editing and updating user homes
|
||||
The API is distributed on Maven through [repo.william278.net](https://repo.william278.net/#/releases/net/william278/huskhomes/) and can be included in any Maven, Gradle, etc. project. JavaDocs are [available here](https://repo.william278.net/javadoc/releases/net/william278/huskhomes/latest).
|
||||
|
||||
## Compatibility
|
||||
[](https://repo.william278.net/#/releases/net/william278/huskhomes/)
|
||||
[](https://repo.william278.net/#/releases/net/william278/huskhomes/)
|
||||
|
||||
The HuskHomes API shares version numbering with the plugin itself for consistency and convenience. Please note minor and patch plugin releases may make API additions and deprecations, but will not introduce breaking changes without notice.
|
||||
|
||||
@@ -14,18 +14,33 @@ The HuskHomes API shares version numbering with the plugin itself for consistenc
|
||||
| v2.x | _v2.0—v2.11.2_ | ❌ |
|
||||
| v1.x | _v1.5—v1.5.11_ | ❌ |
|
||||
|
||||
### Platforms
|
||||
> **Note:** For versions older than `v4.6`, the HuskHomes API was only distributed for the Bukkit platform (as `net.william278:huskhomes`)
|
||||
|
||||
The HuskHomes API is available for the following platforms:
|
||||
|
||||
* `bukkit` - Bukkit, Spigot, Paper, etc. Provides Bukkit API events and extends `BaseHuskHomesAPI` with `org.bukkit` adapters.
|
||||
* `fabric` - Fabric, Quilt, etc. Provides Fabric callback-style listeners
|
||||
* `sponge` - Sponge. Provides Sponge API events.
|
||||
* `common` - Common API for all platforms.
|
||||
|
||||
<details>
|
||||
<summary>Targeting older versions</summary>
|
||||
|
||||
HuskHomes versions prior to `v4.3.1` are distributed on [JitPack](https://jitpack.io/#net.william278/HuskHomes2), and you will need to use the `https://jitpack.io` repository instead.
|
||||
* The HuskHomes API was only distributed for the Bukkit module prior to `v4.6`; the artifact ID was `net.william278:huskhomes` instead of `net.william278.huskhomes:huskhomes-PLATFORM`.
|
||||
* HuskHomes versions prior to `v4.3.1` are distributed on [JitPack](https://jitpack.io/#net.william278/HuskHomes2), and you will need to use the `https://jitpack.io` repository instead.
|
||||
</details>
|
||||
|
||||
## Table of contents
|
||||
1. Adding the API to your project
|
||||
2. Adding HuskHomes as a dependency
|
||||
3. Next steps
|
||||
1. [API Introduction](#1-api-introduction)
|
||||
1. [Setup with Maven](#11-setup-with-maven)
|
||||
2. [Setup with Gradle](#12-setup-with-gradle)
|
||||
3. [Next steps](#3-next-steps)
|
||||
2. [Adding HuskHomes as a dependency](#2-adding-huskhomes-as-a-dependency)
|
||||
3. [Next steps](#3-next-steps)
|
||||
|
||||
## 1 API Introduction
|
||||
|
||||
## API Introduction
|
||||
### 1.1 Setup with Maven
|
||||
<details>
|
||||
<summary>Maven setup information</summary>
|
||||
@@ -42,8 +57,8 @@ Add the repository to your `pom.xml` as per below. You can alternatively specify
|
||||
Add the dependency to your `pom.xml` as per below. Replace `VERSION` with the latest version of HuskHomes (without the v): 
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>net.william278</groupId>
|
||||
<artifactId>huskhomes</artifactId>
|
||||
<groupId>net.william278.huskhomes</groupId>
|
||||
<artifactId>huskhomes-PLATFORM</artifactId>
|
||||
<version>VERSION</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
@@ -66,7 +81,7 @@ Add the dependency as per below. Replace `VERSION` with the latest version of Hu
|
||||
|
||||
```groovy
|
||||
dependencies {
|
||||
compileOnly 'net.william278:huskhomes:VERSION'
|
||||
compileOnly 'net.william278.huskhomes:huskhomes-PLATFORM:VERSION'
|
||||
}
|
||||
```
|
||||
</details>
|
||||
|
||||
+2
-2
@@ -3,13 +3,13 @@ This will walk you through installing HuskHomes on your Spigot, Fabric or Sponge
|
||||
## Requirements
|
||||
> **Note:** If the plugin fails to load, please check that you are not running an [incompatible version combination](Unsupported-Versions)
|
||||
|
||||
* A Spigot (1.16.5+), Fabric (latest Minecraft version), or Sponge (Implementing API v8) _Minecraft: Java Edition_ server running on Java 16+
|
||||
* A Spigot (1.17.1+), Fabric (latest Minecraft version), or Sponge (Implementing API v10) _Minecraft: Java Edition_ server running on Java 17+
|
||||
* (For proxy network support) A proxy server (Velocity, BungeeCord) and MySQL (v8.0+)/MariaDB database
|
||||
* (For optional [[Redis support]]) A Redis database (v5.0+)
|
||||
|
||||
## Download HuskHomes for your server
|
||||
Download the correct jar file for your server from the [latest release page](https://github.com/WiIIiam278/HuskHomes/releases/latest):
|
||||
* the `HuskHomes-Plugin` jar for Spigot or Paper servers
|
||||
* the `HuskHomes-Paper` jar for Spigot or Paper servers
|
||||
* the `HuskHomes-Fabric` jar for Fabric servers
|
||||
* or the `HuskHomes-Sponge` jar for Sponge servers
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ This plugin does not support the following software-Minecraft version combinatio
|
||||
|--------------------|-------------------------------------------|----------------------------------------|
|
||||
| 1.19.4 | Only: `Purpur, Pufferfish`† | Older Paper builds also not supported. |
|
||||
| 1.19.3 | Only: `Paper, Purpur, Pufferfish`† | Upgrade to 1.19.4 or use Spigot |
|
||||
| 1.16.5 | _All_ | Use HuskHomes 4.5.5 |
|
||||
| below 1.16.5 | _All_ | Upgrade to 1.16.5 |
|
||||
|
||||
†Further downstream forks of this server software are also affected.
|
||||
@@ -45,7 +45,7 @@ public class FabricUser extends OnlineUser {
|
||||
private final ServerPlayerEntity player;
|
||||
|
||||
private FabricUser(@NotNull ServerPlayerEntity player, @NotNull FabricHuskHomes plugin) {
|
||||
super(player.getUuid(), player.getEntityName(), plugin);
|
||||
super(player.getUuid(), player.getGameProfile().getName(), plugin);
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
|
||||
+13
-14
@@ -1,27 +1,26 @@
|
||||
javaVersion=16
|
||||
javaVersion=17
|
||||
|
||||
org.gradle.jvmargs='-Dfile.encoding=UTF-8'
|
||||
org.gradle.daemon=true
|
||||
|
||||
plugin_version=4.5.5
|
||||
# Plugin metadata
|
||||
plugin_version=4.6
|
||||
plugin_archive=huskhomes
|
||||
plugin_description=The powerful and intuitive homes, warps, and teleports plugin/mod
|
||||
|
||||
# General settings
|
||||
jedis_version=5.1.0
|
||||
commons_pool_version=2.12.0
|
||||
sqlite_driver_version=3.44.0.0
|
||||
mysql_driver_version=8.3.0
|
||||
mariadb_driver_version=3.3.2
|
||||
sqlite_driver_version=3.45.0.0
|
||||
h2_driver_version=2.2.220
|
||||
mysql_driver_version=8.2.0
|
||||
mariadb_driver_version=3.3.0
|
||||
commons_pool_version=2.12.0
|
||||
|
||||
# Fabric settings
|
||||
fabric_loom_version=1.3-SNAPSHOT
|
||||
|
||||
fabric_minecraft_version=1.20.2
|
||||
fabric_loader_version=0.14.23
|
||||
fabric_yarn_mappings=1.20.2+build.4
|
||||
fabric_api_version=0.90.0+1.20.2
|
||||
|
||||
fabric_loom_version=1.5-SNAPSHOT
|
||||
fabric_minecraft_version=1.20.4
|
||||
fabric_loader_version=0.15.6
|
||||
fabric_yarn_mappings=1.20.4+build.3
|
||||
fabric_api_version=0.95.4+1.20.4
|
||||
fabric_permissions_api_version=0.2-SNAPSHOT
|
||||
adventure_platform_fabric_version=5.10.0
|
||||
adventure_platform_fabric_version=5.11.0
|
||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
|
||||
networkTimeout=10000
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -85,9 +85,6 @@ done
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
@@ -197,6 +194,10 @@ if "$cygwin" || "$msys" ; then
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
|
||||
+3
-1
@@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
id 'xyz.jpenilla.run-paper' version '2.2.2'
|
||||
id 'xyz.jpenilla.run-paper' version '2.2.3'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -41,6 +41,8 @@ shadowJar {
|
||||
relocate 'io.papermc.lib', 'net.william278.huskhomes.libraries.paperlib'
|
||||
relocate 'space.arim.morepaperlib', 'net.william278.huskhomes.libraries.paperlib'
|
||||
relocate 'me.lucko.commodore', 'net.william278.huskhomes.libraries.commodore'
|
||||
|
||||
minimize()
|
||||
}
|
||||
|
||||
tasks {
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
dependencies {
|
||||
implementation project(path: ':bukkit', configuration: 'shadow')
|
||||
runtimeOnly project(path: ':paper')
|
||||
}
|
||||
@@ -12,7 +12,6 @@ include(
|
||||
// Paper/Spigot
|
||||
'bukkit',
|
||||
'paper',
|
||||
'plugin',
|
||||
|
||||
// Fabric
|
||||
'fabric',
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ dependencies {
|
||||
}
|
||||
|
||||
sponge {
|
||||
apiVersion("8.1.0")
|
||||
apiVersion("10.0.0")
|
||||
loader {
|
||||
name(PluginLoaders.JAVA_PLAIN)
|
||||
version("1.0")
|
||||
|
||||
@@ -25,7 +25,9 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.spongepowered.api.ResourceKey;
|
||||
import org.spongepowered.api.Sponge;
|
||||
import org.spongepowered.api.world.WorldTypeTemplate;
|
||||
import org.spongepowered.api.registry.DefaultedRegistryType;
|
||||
import org.spongepowered.api.world.WorldType;
|
||||
import org.spongepowered.api.world.WorldTypes;
|
||||
import org.spongepowered.api.world.server.ServerLocation;
|
||||
import org.spongepowered.api.world.server.ServerWorld;
|
||||
import org.spongepowered.api.world.server.WorldManager;
|
||||
@@ -75,13 +77,18 @@ public final class SpongeAdapter {
|
||||
if (world == null) {
|
||||
return Optional.empty();
|
||||
}
|
||||
final String worldType = world.properties().worldType().asTemplate().key().asString();
|
||||
|
||||
// Get the world type from the world properties
|
||||
final DefaultedRegistryType<WorldType> registry = WorldTypes.registry().type().asDefaultedType(world::engine);
|
||||
return Optional.of(World.from(
|
||||
world.key().toString(), world.uniqueId(),
|
||||
(worldType.equals(WorldTypeTemplate.theNether().key().toString()) ? World.Environment.NETHER
|
||||
: worldType.equals(WorldTypeTemplate.theEnd().key().toString()) ? World.Environment.THE_END
|
||||
: worldType.equals(WorldTypeTemplate.overworld().key().toString()) ? World.Environment.OVERWORLD
|
||||
: World.Environment.CUSTOM)
|
||||
world.key().toString(),
|
||||
world.uniqueId(),
|
||||
switch (world.properties().worldType().key(registry).asString()) {
|
||||
case "minecraft:overworld" -> World.Environment.OVERWORLD;
|
||||
case "minecraft:the_nether" -> World.Environment.NETHER;
|
||||
case "minecraft:the_end" -> World.Environment.THE_END;
|
||||
default -> World.Environment.CUSTOM;
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user