mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-01 22:16:08 +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
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user