Further javadoc improvements

This commit is contained in:
Luck 2021-03-04 00:25:11 +00:00
parent 0884dd7e97
commit 2c636c5ac6
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
9 changed files with 55 additions and 13 deletions

View File

@ -13,6 +13,7 @@ if (project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePass
javadoc {
title = 'LuckPerms API (v' + project.ext.apiVersion + ')'
options.overview = 'javadoc/overview.html'
options.encoding = 'UTF-8'
options.charSet = 'UTF-8'
options.links(

19
api/javadoc/overview.html Normal file
View File

@ -0,0 +1,19 @@
<body>
<p>
LuckPerms is a permissions plugin for Minecraft servers. It allows server admins to control what
features players can use by creating groups and assigning permissions.
</p>
<h4>Useful Links</h4>
<ul>
<li><a target="_top" href="https://luckperms.net">Project Website</a></li>
<li><a target="_top" href="https://luckperms.net/wiki/Developer-API">Wiki - API Introduction</a></li>
<li><a target="_top" href="https://luckperms.net/wiki/Developer-API-Usage">Wiki - API Usage</a></li>
</ul>
<h4>Maven</h4>
<p>
The API artifact is deployed to Maven Central under
<a target="_top" href="https://search.maven.org/artifact/net.luckperms/api">
group id: <b><code>net.luckperms</code></b>, artifact id: <b><code>api</code></b>.
</a>
</p>
</body>

View File

@ -27,41 +27,62 @@ package net.luckperms.api;
import org.checkerframework.checker.nullness.qual.NonNull;
import static org.jetbrains.annotations.ApiStatus.Internal;
/**
* Provides static access to the {@link LuckPerms} service.
* Provides static access to the {@link LuckPerms} API.
*
* <p>Ideally, the ServiceManager for the platform should be used to obtain an
* instance, however, this provider can be used if you need static access.</p>
* instance, however, this provider can be used if this is not viable.</p>
*/
public final class LuckPermsProvider {
private static LuckPerms instance = null;
/**
* Gets an instance of the {@link LuckPerms} service,
* throwing {@link IllegalStateException} if an instance is not yet loaded.
* Gets an instance of the {@link LuckPerms} API,
* throwing {@link IllegalStateException} if the API is not loaded yet.
*
* <p>Will never return null.</p>
* <p>This method will never return null.</p>
*
* @return an api instance
* @throws IllegalStateException if the api is not loaded
* @return an instance of the LuckPerms API
* @throws IllegalStateException if the API is not loaded yet
*/
public static @NonNull LuckPerms get() {
if (instance == null) {
throw new IllegalStateException("The LuckPerms API is not loaded.");
throw new NotLoadedException();
}
return instance;
}
@Internal
static void register(LuckPerms instance) {
LuckPermsProvider.instance = instance;
}
@Internal
static void unregister() {
LuckPermsProvider.instance = null;
}
@Internal
private LuckPermsProvider() {
throw new UnsupportedOperationException("This class cannot be instantiated.");
}
/**
* Exception thrown when the API is requested before it has been loaded.
*/
private static final class NotLoadedException extends IllegalStateException {
private static final String MESSAGE = "The LuckPerms API isn't loaded yet!\n" +
"This could be because:\n" +
" a) the LuckPerms plugin is not installed or it failed to enable\n" +
" b) your plugin does not declare a dependency on LuckPerms\n" +
" c) you are attempting to use the API before plugins reach the 'enable' phase\n" +
" (call the #get method in onEnable, not in your plugin constructor!)\n";
NotLoadedException() {
super(MESSAGE);
}
}
}

View File

@ -165,7 +165,7 @@ public interface ContextManager {
* Invalidates the lookup cache for a given subject
*
* @param subject the subject
* @deprecated use {@link #signalContextUpdate(Object)}
* @deprecated Use {@link #signalContextUpdate(Object)} instead
*/
@Deprecated
default void invalidateCache(@NonNull Object subject) {

View File

@ -136,7 +136,7 @@ public interface ContextSet extends Iterable<Context> {
* may not be a true representation of the set.</p>
*
* @return an immutable map
* @deprecated because the resultant map may not contain all data in the ContextSet
* @deprecated Deprecated because the returned map may not contain all data in the ContextSet
*/
@Deprecated
@NonNull @Unmodifiable Map<String, String> toFlattenedMap();

View File

@ -67,7 +67,7 @@ public interface ImmutableContextSet extends ContextSet {
}
/**
* @deprecated Already immutable!
* @deprecated This context set is already immutable!
*/
@Override
@Deprecated

View File

@ -147,7 +147,7 @@ public interface GroupManager {
* @param permission the permission to search for
* @return a list of held permissions, or null if the operation failed
* @throws NullPointerException if the permission is null
* @deprecated use {@link #searchAll(NodeMatcher)}
* @deprecated Use {@link #searchAll(NodeMatcher)} instead
*/
@Deprecated
@NonNull CompletableFuture<@Unmodifiable List<HeldNode<String>>> getWithPermission(@NonNull String permission);

View File

@ -184,7 +184,7 @@ public interface UserManager {
* @param permission the permission to search for
* @return a list of held permissions
* @throws NullPointerException if the permission is null
* @deprecated use {@link #searchAll(NodeMatcher)}
* @deprecated Use {@link #searchAll(NodeMatcher)} instead
*/
@Deprecated
@NonNull CompletableFuture<@Unmodifiable List<HeldNode<UUID>>> getWithPermission(@NonNull String permission);

View File

@ -33,6 +33,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
* A relationship between a {@link PermissionHolder} and a {@link Node}.
*
* @param <T> the identifier type of the holder
* @deprecated The only usages of this interface are also deprecated.
*/
@Deprecated
public interface HeldNode<T> {