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:
William authored and GitHub committed 2024-02-12 11:18:50 +00:00
1 parent c0e079c46c
commit f8ad215b76
24 files changed
+261 -193

No files matched your search

+7 -8
View File
@@ -57,7 +57,7 @@ jobs:
hangar-id: William278/HuskHomes hangar-id: William278/HuskHomes
hangar-token: ${{ secrets.HANGAR_API_KEY }} hangar-token: ${{ secrets.HANGAR_API_KEY }}
hangar-version-type: Alpha hangar-version-type: Alpha
files-primary: target/HuskHomes-Plugin-*.jar files-primary: target/HuskHomes-Paper-*.jar
name: HuskHomes (Spigot) v${{ env.version_name }} name: HuskHomes (Spigot) v${{ env.version_name }}
version: ${{ env.version_name }} version: ${{ env.version_name }}
version-type: alpha version-type: alpha
@@ -67,12 +67,11 @@ jobs:
paper paper
folia folia
game-versions: | game-versions: |
1.16.5
1.17.1 1.17.1
1.18.2 1.18.2
1.19.4 1.19.4
1.20.2 1.20.4
java: 16 java: 17
- name: 'Sponge: Publish to Modrinth 🧽' - name: 'Sponge: Publish to Modrinth 🧽'
uses: WiIIiam278/mc-publish@hangar uses: WiIIiam278/mc-publish@hangar
if: success() || failure() if: success() || failure()
@@ -91,8 +90,8 @@ jobs:
loaders: | loaders: |
sponge sponge
game-versions: | game-versions: |
1.16.5 1.19.4
java: 16 java: 17
- name: 'Fabric: Publish to Modrinth & CurseForge 🧵' - name: 'Fabric: Publish to Modrinth & CurseForge 🧵'
uses: WiIIiam278/mc-publish@hangar uses: WiIIiam278/mc-publish@hangar
if: success() || failure() if: success() || failure()
@@ -117,7 +116,7 @@ jobs:
loaders: | loaders: |
fabric fabric
game-versions: | game-versions: |
1.20.2 1.20.4
java: 17 java: 17
- name: 'Upload GitHub Artifacts 📦' - name: 'Upload GitHub Artifacts 📦'
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
@@ -125,6 +124,6 @@ jobs:
with: with:
name: HuskHomes name: HuskHomes
path: | path: |
target/HuskHomes-Plugin-*.jar target/HuskHomes-Paper-*.jar
target/HuskHomes-Sponge-*.jar target/HuskHomes-Sponge-*.jar
target/HuskHomes-Fabric-*.jar target/HuskHomes-Fabric-*.jar
+7 -8
View File
@@ -45,7 +45,7 @@ jobs:
plan | suggests | * plan | suggests | *
hangar-id: William278/HuskHomes hangar-id: William278/HuskHomes
hangar-token: ${{ secrets.HANGAR_API_KEY }} 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 }} name: HuskHomes (Spigot) v${{ github.event.release.tag_name }}
version: ${{ github.event.release.tag_name }} version: ${{ github.event.release.tag_name }}
version-type: release version-type: release
@@ -55,12 +55,11 @@ jobs:
paper paper
folia folia
game-versions: | game-versions: |
1.16.5
1.17.1 1.17.1
1.18.2 1.18.2
1.19.4 1.19.4
1.20.2 1.20.4
java: 16 java: 17
- name: 'Sponge: Publish to Modrinth 🧽' - name: 'Sponge: Publish to Modrinth 🧽'
uses: WiIIiam278/mc-publish@hangar uses: WiIIiam278/mc-publish@hangar
with: with:
@@ -78,8 +77,8 @@ jobs:
loaders: | loaders: |
sponge sponge
game-versions: | game-versions: |
1.16.5 1.19.4
java: 16 java: 17
- name: 'Fabric: Publish to Modrinth & CurseForge 🧵' - name: 'Fabric: Publish to Modrinth & CurseForge 🧵'
uses: WiIIiam278/mc-publish@hangar uses: WiIIiam278/mc-publish@hangar
with: with:
@@ -103,13 +102,13 @@ jobs:
loaders: | loaders: |
fabric fabric
game-versions: | game-versions: |
1.20.2 1.20.4
java: 17 java: 17
- name: 'Upload GitHub Artifacts 📦' - name: 'Upload GitHub Artifacts 📦'
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: HuskHomes name: HuskHomes
path: | path: |
target/HuskHomes-Plugin-*.jar target/HuskHomes-Paper-*.jar
target/HuskHomes-Sponge-*.jar target/HuskHomes-Sponge-*.jar
target/HuskHomes-Fabric-*.jar target/HuskHomes-Fabric-*.jar
+1 -1
View File
@@ -5,7 +5,7 @@
<img src="https://img.shields.io/github/actions/workflow/status/WiIIiam278/HuskHomes/ci.yml?branch=master&logo=github"/> <img src="https://img.shields.io/github/actions/workflow/status/WiIIiam278/HuskHomes/ci.yml?branch=master&logo=github"/>
</a> </a>
<a href="https://repo.william278.net/#/releases/net/william278/huskhomes/"> <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>
<a href="https://discord.gg/tVYhJfyDWG"> <a href="https://discord.gg/tVYhJfyDWG">
<img src="https://img.shields.io/discord/818135932103557162.svg?label=&logo=discord&logoColor=fff&color=7389D8&labelColor=6A7EC2" /> <img src="https://img.shields.io/discord/818135932103557162.svg?label=&logo=discord&logoColor=fff&color=7389D8&labelColor=6A7EC2" />
+137 -102
View File
@@ -24,102 +24,7 @@ ext {
set 'mariadb_driver_version', mariadb_driver_version.toString() set 'mariadb_driver_version', mariadb_driver_version.toString()
} }
allprojects { publishing {
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'org.cadixdev.licenser'
apply plugin: 'checkstyle'
apply plugin: 'java'
compileJava.options.encoding = 'UTF-8'
compileJava.options.release.set 16
javadoc.options.encoding = 'UTF-8'
javadoc.options.addStringOption('Xdoclint:none', '-quiet')
repositories {
mavenLocal()
mavenCentral()
maven {
url 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
mavenContent { snapshotsOnly() }
}
maven { url 'https://repo.william278.net/releases/' }
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/' }
maven { url 'https://mvn-repo.arim.space/lesser-gpl3/' }
maven { url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }
maven { url 'https://repo.spongepowered.org/repository/maven-public/' }
maven { url 'https://repo.extendedclip.com/content/repositories/placeholderapi/' }
maven { url 'https://repo.minebench.de/' }
maven { url 'https://repo.alessiodp.com/releases/' }
maven { url 'https://repo.essentialsx.net/releases/' }
maven { url 'https://repo.mikeprimm.com/' }
maven { url 'https://jitpack.io' }
}
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'
}
license {
header = rootProject.file('HEADER')
include '**/*.java'
newLine = true
}
checkstyle {
toolVersion = '10.12.0'
}
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()
}
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('')
}
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 { repositories {
if (System.getenv("RELEASES_MAVEN_USERNAME") != null) { if (System.getenv("RELEASES_MAVEN_USERNAME") != null) {
maven { maven {
@@ -148,15 +53,147 @@ subprojects {
} }
} }
} }
}
allprojects {
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'org.cadixdev.licenser'
apply plugin: 'checkstyle'
apply plugin: 'java'
compileJava.options.encoding = 'UTF-8'
compileJava.options.release.set 17
javadoc.options.encoding = 'UTF-8'
javadoc.options.addStringOption('Xdoclint:none', '-quiet')
repositories {
mavenLocal()
mavenCentral()
maven {
url 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
mavenContent { snapshotsOnly() }
}
maven { url 'https://repo.william278.net/releases/' }
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/' }
maven { url 'https://mvn-repo.arim.space/lesser-gpl3/' }
maven { url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }
maven { url 'https://repo.spongepowered.org/repository/maven-public/' }
maven { url 'https://repo.extendedclip.com/content/repositories/placeholderapi/' }
maven { url 'https://repo.minebench.de/' }
maven { url 'https://repo.alessiodp.com/releases/' }
maven { url 'https://repo.essentialsx.net/releases/' }
maven { url 'https://repo.mikeprimm.com/' }
maven { url 'https://jitpack.io' }
}
dependencies {
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 {
header = rootProject.file('HEADER')
include '**/*.java'
newLine = true
}
checkstyle {
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()}"
jar {
from '../LICENSE'
}
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)
publishing {
if (['common'].contains(project.name)) {
publications { publications {
mavenJava(MavenPublication) { mavenJavaCommon(MavenPublication) {
groupId = 'net.william278' groupId = 'net.william278.huskhomes'
artifactId = 'huskhomes' artifactId = 'huskhomes-common'
version = "$rootProject.version" version = "$rootProject.version"
artifact shadowJar artifact shadowJar
artifact javadocJar
artifact sourcesJar 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
}
} }
} }
} }
@@ -164,7 +201,6 @@ subprojects {
jar.dependsOn shadowJar jar.dependsOn shadowJar
clean.delete "$rootDir/target" clean.delete "$rootDir/target"
}
} }
logger.lifecycle("Building HuskHomes ${version} by William278") logger.lifecycle("Building HuskHomes ${version} by William278")
@@ -183,4 +219,3 @@ def versionMetadata() {
} }
return '-' + grgit.head().abbreviatedId + (grgit.status().clean ? '' : '-indev') return '-' + grgit.head().abbreviatedId + (grgit.status().clean ? '' : '-indev')
} }
+7 -5
View File
@@ -7,7 +7,7 @@ dependencies {
implementation 'me.lucko:commodore:2.2' implementation 'me.lucko:commodore:2.2'
implementation 'net.kyori:adventure-platform-bukkit:4.3.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 'org.jetbrains:annotations:24.1.0'
compileOnly 'de.themoep:minedown-adventure:1.7.2-SNAPSHOT' compileOnly 'de.themoep:minedown-adventure:1.7.2-SNAPSHOT'
compileOnly 'net.william278:annotaml:2.0.5' compileOnly 'net.william278:annotaml:2.0.5'
@@ -18,13 +18,13 @@ dependencies {
exclude group: 'org.spigotmc', module: 'spigot-api' 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 'de.themoep:minedown-adventure:1.7.2-SNAPSHOT'
testImplementation 'net.kyori:adventure-platform-bukkit:4.3.2' testImplementation 'net.kyori:adventure-platform-bukkit:4.3.2'
testImplementation 'org.apache.commons:commons-text:1.11.0' testImplementation 'org.apache.commons:commons-text:1.11.0'
testImplementation 'redis.clients:jedis:' + jedis_version testImplementation "redis.clients:jedis:${jedis_version}"
testImplementation 'org.xerial:sqlite-jdbc:' + sqlite_driver_version testImplementation "org.xerial:sqlite-jdbc:${sqlite_driver_version}"
testImplementation 'com.mysql:mysql-connector-j:' + mysql_driver_version testImplementation "com.mysql:mysql-connector-j:${mysql_driver_version}"
} }
shadowJar { shadowJar {
@@ -50,4 +50,6 @@ shadowJar {
relocate 'io.papermc.lib', 'net.william278.huskhomes.libraries.paperlib' relocate 'io.papermc.lib', 'net.william278.huskhomes.libraries.paperlib'
relocate 'space.arim.morepaperlib', 'net.william278.huskhomes.libraries.paperlib' relocate 'space.arim.morepaperlib', 'net.william278.huskhomes.libraries.paperlib'
relocate 'me.lucko.commodore', 'net.william278.huskhomes.libraries.commodore' relocate 'me.lucko.commodore', 'net.william278.huskhomes.libraries.commodore'
minimize()
} }
@@ -230,6 +230,7 @@ public class BukkitHuskHomes extends JavaPlugin implements HuskHomes, BukkitTask
@Override @Override
public void onDisable() { public void onDisable() {
HuskHomesAPI.unregister();
if (this.eventListener != null) { if (this.eventListener != null) {
this.eventListener.handlePluginDisable(); this.eventListener.handlePluginDisable();
} }
@@ -483,11 +484,6 @@ public class BukkitHuskHomes extends JavaPlugin implements HuskHomes, BukkitTask
} }
} }
@NotNull
public AudienceProvider getAudiences() {
return audiences;
}
@NotNull @NotNull
public GracefulScheduling getScheduler() { public GracefulScheduling getScheduler() {
return paperLib.scheduling(); return paperLib.scheduling();
@@ -43,9 +43,6 @@ import java.util.Objects;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public class HuskHomesAPI extends BaseHuskHomesAPI { public class HuskHomesAPI extends BaseHuskHomesAPI {
// Instance of the plugin
private static HuskHomesAPI instance;
/** /**
* <b>(Internal use only)</b> - Constructor, instantiating the API. * <b>(Internal use only)</b> - Constructor, instantiating the API.
*/ */
@@ -62,10 +59,7 @@ public class HuskHomesAPI extends BaseHuskHomesAPI {
*/ */
@NotNull @NotNull
public static HuskHomesAPI getInstance() throws NotRegisteredException { public static HuskHomesAPI getInstance() throws NotRegisteredException {
if (instance == null) { return (HuskHomesAPI) BaseHuskHomesAPI.getInstance();
throw new NotRegisteredException();
}
return instance;
} }
/** /**
@@ -78,14 +72,6 @@ public class HuskHomesAPI extends BaseHuskHomesAPI {
instance = new HuskHomesAPI(plugin); 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}. * Returns an {@link OnlineUser} instance for the given bukkit {@link Player}.
* *
+1 -1
View File
@@ -4,7 +4,7 @@ author: 'William278'
website: 'https://william278.net/' website: 'https://william278.net/'
main: 'net.william278.huskhomes.BukkitHuskHomes' main: 'net.william278.huskhomes.BukkitHuskHomes'
version: '${version}' version: '${version}'
api-version: '1.16' api-version: '1.17'
softdepend: softdepend:
- Vault - Vault
- PlaceholderAPI - PlaceholderAPI
@@ -48,9 +48,9 @@ import java.util.Optional;
import java.util.stream.Stream; 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 { public class BukkitPluginTests {
private static ServerMock server; 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. * This class should not be used directly, but rather through platform-specific extending API classes.
*/ */
@SuppressWarnings("unused") @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. * <b>(Internal use only)</b> - Instance of the implementing plugin.
*/ */
@@ -834,10 +838,35 @@ public abstract class BaseHuskHomesAPI {
return plugin.getLocales().getRawLocale(localeKey, replacements); 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. * 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 = """ private static final String MESSAGE = """
Could not access the HuskHomes API as it has not yet been registered. This could be because: Could not access the HuskHomes API as it has not yet been registered. This could be because:
+2
View File
@@ -24,6 +24,8 @@ HuskHomes provides a number of API events your plugin can listen to when certain
&ddagger; Called on the server the player *is teleported from*; not necessarily where the executor of the teleport is. &ddagger; Called on the server the player *is teleported from*; not necessarily where the executor of the teleport is.
## Events on Sponge & Fabric ## 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). 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: 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
View File
@@ -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). 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 ## Compatibility
[![Maven](https://repo.william278.net/api/badge/latest/releases/net/william278/huskhomes?color=00fb9a&name=Maven&prefix=v)](https://repo.william278.net/#/releases/net/william278/huskhomes/) [![Maven](https://repo.william278.net/api/badge/latest/releases/net/william278/huskhomes/huskhomes-common?color=00fb9a&name=Maven&prefix=v)](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. 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&mdash;v2.11.2_ | ❌ | | v2.x | _v2.0&mdash;v2.11.2_ | ❌ |
| v1.x | _v1.5&mdash;v1.5.11_ | ❌ | | v1.x | _v1.5&mdash;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> <details>
<summary>Targeting older versions</summary> <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> </details>
## Table of contents ## Table of contents
1. Adding the API to your project 1. [API Introduction](#1-api-introduction)
2. Adding HuskHomes as a dependency 1. [Setup with Maven](#11-setup-with-maven)
3. Next steps 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 ### 1.1 Setup with Maven
<details> <details>
<summary>Maven setup information</summary> <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): ![Latest version](https://img.shields.io/github/v/tag/WiIIiam278/HuskHomes?color=%23282828&label=%20&style=flat-square) Add the dependency to your `pom.xml` as per below. Replace `VERSION` with the latest version of HuskHomes (without the v): ![Latest version](https://img.shields.io/github/v/tag/WiIIiam278/HuskHomes?color=%23282828&label=%20&style=flat-square)
```xml ```xml
<dependency> <dependency>
<groupId>net.william278</groupId> <groupId>net.william278.huskhomes</groupId>
<artifactId>huskhomes</artifactId> <artifactId>huskhomes-PLATFORM</artifactId>
<version>VERSION</version> <version>VERSION</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
@@ -66,7 +81,7 @@ Add the dependency as per below. Replace `VERSION` with the latest version of Hu
```groovy ```groovy
dependencies { dependencies {
compileOnly 'net.william278:huskhomes:VERSION' compileOnly 'net.william278.huskhomes:huskhomes-PLATFORM:VERSION'
} }
``` ```
</details> </details>
+2 -2
View File
@@ -3,13 +3,13 @@ This will walk you through installing HuskHomes on your Spigot, Fabric or Sponge
## Requirements ## Requirements
> **Note:** If the plugin fails to load, please check that you are not running an [incompatible version combination](Unsupported-Versions) > **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 proxy network support) A proxy server (Velocity, BungeeCord) and MySQL (v8.0+)/MariaDB database
* (For optional [[Redis support]]) A Redis database (v5.0+) * (For optional [[Redis support]]) A Redis database (v5.0+)
## Download HuskHomes for your server ## 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): 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 * the `HuskHomes-Fabric` jar for Fabric servers
* or the `HuskHomes-Sponge` jar for Sponge servers * or the `HuskHomes-Sponge` jar for Sponge servers
+1
View File
@@ -5,6 +5,7 @@ This plugin does not support the following software-Minecraft version combinatio
|--------------------|-------------------------------------------|----------------------------------------| |--------------------|-------------------------------------------|----------------------------------------|
| 1.19.4 | Only: `Purpur, Pufferfish`&dagger; | Older Paper builds also not supported. | | 1.19.4 | Only: `Purpur, Pufferfish`&dagger; | Older Paper builds also not supported. |
| 1.19.3 | Only: `Paper, Purpur, Pufferfish`&dagger; | Upgrade to 1.19.4 or use Spigot | | 1.19.3 | Only: `Paper, Purpur, Pufferfish`&dagger; | 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 | | below 1.16.5 | _All_ | Upgrade to 1.16.5 |
&dagger;Further downstream forks of this server software are also affected. &dagger;Further downstream forks of this server software are also affected.
@@ -45,7 +45,7 @@ public class FabricUser extends OnlineUser {
private final ServerPlayerEntity player; private final ServerPlayerEntity player;
private FabricUser(@NotNull ServerPlayerEntity player, @NotNull FabricHuskHomes plugin) { private FabricUser(@NotNull ServerPlayerEntity player, @NotNull FabricHuskHomes plugin) {
super(player.getUuid(), player.getEntityName(), plugin); super(player.getUuid(), player.getGameProfile().getName(), plugin);
this.player = player; this.player = player;
} }
+13 -14
View File
@@ -1,27 +1,26 @@
javaVersion=16 javaVersion=17
org.gradle.jvmargs='-Dfile.encoding=UTF-8' org.gradle.jvmargs='-Dfile.encoding=UTF-8'
org.gradle.daemon=true org.gradle.daemon=true
plugin_version=4.5.5 # Plugin metadata
plugin_version=4.6
plugin_archive=huskhomes plugin_archive=huskhomes
plugin_description=The powerful and intuitive homes, warps, and teleports plugin/mod plugin_description=The powerful and intuitive homes, warps, and teleports plugin/mod
# General settings # General settings
jedis_version=5.1.0 jedis_version=5.1.0
commons_pool_version=2.12.0 mysql_driver_version=8.3.0
sqlite_driver_version=3.44.0.0 mariadb_driver_version=3.3.2
sqlite_driver_version=3.45.0.0
h2_driver_version=2.2.220 h2_driver_version=2.2.220
mysql_driver_version=8.2.0 commons_pool_version=2.12.0
mariadb_driver_version=3.3.0
# Fabric settings # Fabric settings
fabric_loom_version=1.3-SNAPSHOT fabric_loom_version=1.5-SNAPSHOT
fabric_minecraft_version=1.20.4
fabric_minecraft_version=1.20.2 fabric_loader_version=0.15.6
fabric_loader_version=0.14.23 fabric_yarn_mappings=1.20.4+build.3
fabric_yarn_mappings=1.20.2+build.4 fabric_api_version=0.95.4+1.20.4
fabric_api_version=0.90.0+1.20.2
fabric_permissions_api_version=0.2-SNAPSHOT fabric_permissions_api_version=0.2-SNAPSHOT
adventure_platform_fabric_version=5.10.0 adventure_platform_fabric_version=5.11.0
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists 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 networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
Vendored
+4 -3
View File
@@ -85,9 +85,6 @@ done
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit 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. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum
@@ -197,6 +194,10 @@ if "$cygwin" || "$msys" ; then
done done
fi 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; # Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in # shell script including quotes and variable substitutions, so put them in
+3 -1
View File
@@ -1,5 +1,5 @@
plugins { plugins {
id 'xyz.jpenilla.run-paper' version '2.2.2' id 'xyz.jpenilla.run-paper' version '2.2.3'
} }
dependencies { dependencies {
@@ -41,6 +41,8 @@ shadowJar {
relocate 'io.papermc.lib', 'net.william278.huskhomes.libraries.paperlib' relocate 'io.papermc.lib', 'net.william278.huskhomes.libraries.paperlib'
relocate 'space.arim.morepaperlib', 'net.william278.huskhomes.libraries.paperlib' relocate 'space.arim.morepaperlib', 'net.william278.huskhomes.libraries.paperlib'
relocate 'me.lucko.commodore', 'net.william278.huskhomes.libraries.commodore' relocate 'me.lucko.commodore', 'net.william278.huskhomes.libraries.commodore'
minimize()
} }
tasks { tasks {
-4
View File
@@ -1,4 +0,0 @@
dependencies {
implementation project(path: ':bukkit', configuration: 'shadow')
runtimeOnly project(path: ':paper')
}
-1
View File
@@ -12,7 +12,6 @@ include(
// Paper/Spigot // Paper/Spigot
'bukkit', 'bukkit',
'paper', 'paper',
'plugin',
// Fabric // Fabric
'fabric', 'fabric',
+1 -1
View File
@@ -17,7 +17,7 @@ dependencies {
} }
sponge { sponge {
apiVersion("8.1.0") apiVersion("10.0.0")
loader { loader {
name(PluginLoaders.JAVA_PLAIN) name(PluginLoaders.JAVA_PLAIN)
version("1.0") version("1.0")
@@ -25,7 +25,9 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.spongepowered.api.ResourceKey; import org.spongepowered.api.ResourceKey;
import org.spongepowered.api.Sponge; 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.ServerLocation;
import org.spongepowered.api.world.server.ServerWorld; import org.spongepowered.api.world.server.ServerWorld;
import org.spongepowered.api.world.server.WorldManager; import org.spongepowered.api.world.server.WorldManager;
@@ -75,13 +77,18 @@ public final class SpongeAdapter {
if (world == null) { if (world == null) {
return Optional.empty(); 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( return Optional.of(World.from(
world.key().toString(), world.uniqueId(), world.key().toString(),
(worldType.equals(WorldTypeTemplate.theNether().key().toString()) ? World.Environment.NETHER world.uniqueId(),
: worldType.equals(WorldTypeTemplate.theEnd().key().toString()) ? World.Environment.THE_END switch (world.properties().worldType().key(registry).asString()) {
: worldType.equals(WorldTypeTemplate.overworld().key().toString()) ? World.Environment.OVERWORLD case "minecraft:overworld" -> World.Environment.OVERWORLD;
: World.Environment.CUSTOM) case "minecraft:the_nether" -> World.Environment.NETHER;
case "minecraft:the_end" -> World.Environment.THE_END;
default -> World.Environment.CUSTOM;
}
)); ));
} }