More annotation work

This commit is contained in:
Alexander Söderberg 2021-01-10 00:01:48 +01:00
parent 57fc51d013
commit 8292ed9e31
No known key found for this signature in database
GPG Key ID: FAB5B92197200E2C
35 changed files with 144 additions and 108 deletions

View File

@ -981,7 +981,10 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
} }
@Override @Override
public @Nullable final ChunkGenerator getDefaultWorldGenerator(final @NonNull String worldName, final String id) { public @Nullable final ChunkGenerator getDefaultWorldGenerator(
final @NonNull String worldName,
final @Nullable String id)
{
final IndependentPlotGenerator result; final IndependentPlotGenerator result;
if (id != null && id.equalsIgnoreCase("single")) { if (id != null && id.equalsIgnoreCase("single")) {
result = injector().getInstance(SingleWorldGenerator.class); result = injector().getInstance(SingleWorldGenerator.class);
@ -995,7 +998,10 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
} }
@Override @Override
public @Nullable GeneratorWrapper<?> getGenerator(final @NonNull String world, final @Nullable String name) { public @Nullable GeneratorWrapper<?> getGenerator(
final @NonNull String world,
final @Nullable String name
) {
if (name == null) { if (name == null) {
return null; return null;
} }
@ -1108,7 +1114,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
@Override @Override
public @NonNull GeneratorWrapper<?> wrapPlotGenerator( public @NonNull GeneratorWrapper<?> wrapPlotGenerator(
final @Nullable String world, final @NonNull String world,
final @NonNull IndependentPlotGenerator generator final @NonNull IndependentPlotGenerator generator
) { ) {
return new BukkitPlotGenerator(world, generator, this.plotAreaManager); return new BukkitPlotGenerator(world, generator, this.plotAreaManager);
@ -1194,7 +1200,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
@NonNull @NonNull
@Override @Override
public String toLegacyPlatformString(Component component) { public String toLegacyPlatformString(final @NonNull Component component) {
return LegacyComponentSerializer.legacyAmpersand().serialize(component); return LegacyComponentSerializer.legacyAmpersand().serialize(component);
} }

View File

@ -125,7 +125,7 @@ public class BukkitUtil extends WorldUtil {
* @param player Bukkit player * @param player Bukkit player
* @return PlotSquared player * @return PlotSquared player
*/ */
public @NonNull static BukkitPlayer adapt(final @NonNull Player player) { public static @NonNull BukkitPlayer adapt(final @NonNull Player player) {
final PlayerManager<?, ?> playerManager = PlotSquared.platform().playerManager(); final PlayerManager<?, ?> playerManager = PlotSquared.platform().playerManager();
return ((BukkitPlayerManager) playerManager).getPlayer(player); return ((BukkitPlayerManager) playerManager).getPlayer(player);
} }
@ -137,7 +137,7 @@ public class BukkitUtil extends WorldUtil {
* @param location Bukkit location * @param location Bukkit location
* @return PlotSquared location * @return PlotSquared location
*/ */
public @NonNull static Location adapt(final org.bukkit.@NonNull Location location) { public static @NonNull Location adapt(final org.bukkit.@NonNull Location location) {
return Location return Location
.at(com.plotsquared.bukkit.util.BukkitWorld.of(location.getWorld()), .at(com.plotsquared.bukkit.util.BukkitWorld.of(location.getWorld()),
MathMan.roundInt(location.getX()), MathMan.roundInt(location.getX()),
@ -153,7 +153,7 @@ public class BukkitUtil extends WorldUtil {
* @param location Bukkit location * @param location Bukkit location
* @return PlotSquared location * @return PlotSquared location
*/ */
public @NonNull static Location adaptComplete(final org.bukkit.@NonNull Location location) { public static @NonNull Location adaptComplete(final org.bukkit.@NonNull Location location) {
return Location return Location
.at(com.plotsquared.bukkit.util.BukkitWorld.of(location.getWorld()), .at(com.plotsquared.bukkit.util.BukkitWorld.of(location.getWorld()),
MathMan.roundInt(location.getX()), MathMan.roundInt(location.getX()),
@ -186,7 +186,7 @@ public class BukkitUtil extends WorldUtil {
* @param string World name * @param string World name
* @return World if it exists, or {@code null} * @return World if it exists, or {@code null}
*/ */
public @Nullable static World getWorld(final @NonNull String string) { public static @Nullable World getWorld(final @NonNull String string) {
return Bukkit.getWorld(string); return Bukkit.getWorld(string);
} }

View File

@ -49,7 +49,7 @@ public class BukkitWorld implements World<org.bukkit.World> {
* @param worldName World name * @param worldName World name
* @return World instance * @return World instance
*/ */
public @NonNull static BukkitWorld of(final @NonNull String worldName) { public static @NonNull BukkitWorld of(final @NonNull String worldName) {
final org.bukkit.World bukkitWorld = Bukkit.getWorld(worldName); final org.bukkit.World bukkitWorld = Bukkit.getWorld(worldName);
if (bukkitWorld == null) { if (bukkitWorld == null) {
throw new IllegalArgumentException(String.format("There is no world with the name '%s'", worldName)); throw new IllegalArgumentException(String.format("There is no world with the name '%s'", worldName));
@ -63,7 +63,7 @@ public class BukkitWorld implements World<org.bukkit.World> {
* @param world Bukkit world * @param world Bukkit world
* @return World instance * @return World instance
*/ */
public @NonNull static BukkitWorld of(final org.bukkit.World world) { public static @NonNull BukkitWorld of(final org.bukkit.World world) {
BukkitWorld bukkitWorld = worldMap.get(world.getName()); BukkitWorld bukkitWorld = worldMap.get(world.getName());
if (bukkitWorld != null && bukkitWorld.getPlatformWorld().equals(world)) { if (bukkitWorld != null && bukkitWorld.getPlatformWorld().equals(world)) {
return bukkitWorld; return bukkitWorld;

View File

@ -154,8 +154,6 @@ public class PlotAPI {
final @NonNull String message, final @NonNull String message,
final @NonNull Template @NonNull... replacements) { final @NonNull Template @NonNull... replacements) {
ConsolePlayer.getConsole().sendMessage(StaticCaption.of(message), replacements); ConsolePlayer.getConsole().sendMessage(StaticCaption.of(message), replacements);
// TODO: Re-implement
// PlotSquared.log(message);
} }
/** /**

View File

@ -85,8 +85,7 @@ public interface PlotPlatform<P> extends LocaleHolder {
* *
* @return Plugin name * @return Plugin name
*/ */
@NonNull default @NonNull String pluginName() {
default String pluginName() {
return "PlotSquared"; return "PlotSquared";
} }
@ -316,6 +315,12 @@ public interface PlotPlatform<P> extends LocaleHolder {
return injector().getInstance(PlaceholderRegistry.class); return injector().getInstance(PlaceholderRegistry.class);
} }
@NonNull String toLegacyPlatformString(Component component); /**
* Convert a component to a legacy string
*
* @param component Component to convert
* @return Converted string
*/
@NonNull String toLegacyPlatformString(@NonNull Component component);
} }

View File

@ -1583,10 +1583,25 @@ public class PlotSquared {
return this.plotListener; return this.plotListener;
} }
/**
* Different ways of sorting {@link Plot plots}
*/
public enum SortType { public enum SortType {
/**
* Sort plots by their creation, using their index in the database
*/
CREATION_DATE, CREATION_DATE,
/**
* Sort plots by their creation timestamp
*/
CREATION_DATE_TIMESTAMP, CREATION_DATE_TIMESTAMP,
/**
* Sort plots by when they were last modified
*/
LAST_MODIFIED, LAST_MODIFIED,
/**
* Sort plots based on their distance from the origin of the world
*/
DISTANCE_FROM_ORIGIN DISTANCE_FROM_ORIGIN
} }

View File

@ -36,7 +36,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
public class CmdConfirm { public class CmdConfirm {
public @Nullable static CmdInstance getPending(PlotPlayer<?> player) { public static @Nullable CmdInstance getPending(PlotPlayer<?> player) {
try (final MetaDataAccess<CmdInstance> metaDataAccess = player.accessTemporaryMetaData( try (final MetaDataAccess<CmdInstance> metaDataAccess = player.accessTemporaryMetaData(
PlayerMetaDataKeys.TEMPORARY_CONFIRM)) { PlayerMetaDataKeys.TEMPORARY_CONFIRM)) {
return metaDataAccess.get().orElse(null); return metaDataAccess.get().orElse(null);

View File

@ -42,7 +42,7 @@ public final class StaticCaption implements Caption {
* @param text Text * @param text Text
* @return Created caption * @return Created caption
*/ */
public @NonNull static StaticCaption of(final @NonNull String text) { public static @NonNull StaticCaption of(final @NonNull String text) {
return new StaticCaption(Preconditions.checkNotNull(text, "Text may not be null")); return new StaticCaption(Preconditions.checkNotNull(text, "Text may not be null"));
} }

View File

@ -54,7 +54,7 @@ public final class Templates {
* @param replacements Replacements * @param replacements Replacements
* @return Generated template * @return Generated template
*/ */
public @NonNull static Template of( public static @NonNull Template of(
final @NonNull LocaleHolder localeHolder, final @NonNull LocaleHolder localeHolder,
final @NonNull String key, final @NonNull Caption caption, final @NonNull String key, final @NonNull Caption caption,
final @NonNull Template... replacements final @NonNull Template... replacements
@ -69,7 +69,7 @@ public final class Templates {
* @param uuid Player UUID * @param uuid Player UUID
* @return Generated template * @return Generated template
*/ */
public @NonNull static Template of(final @NonNull String key, final @NonNull UUID uuid) { public static @NonNull Template of(final @NonNull String key, final @NonNull UUID uuid) {
final String username = PlayerManager.getName(uuid); final String username = PlayerManager.getName(uuid);
return Template.of(key, username); return Template.of(key, username);
} }
@ -81,7 +81,7 @@ public final class Templates {
* @param value Template value * @param value Template value
* @return Generated template * @return Generated template
*/ */
public @NonNull static Template of(final @NonNull String key, final @NonNull String value) { public static @NonNull Template of(final @NonNull String key, final @NonNull String value) {
return Template.of(key, value); return Template.of(key, value);
} }
@ -92,7 +92,7 @@ public final class Templates {
* @param area Plot area * @param area Plot area
* @return Generated template * @return Generated template
*/ */
public @NonNull static Template of(final @NonNull String key, final @NonNull PlotArea area) { public static @NonNull Template of(final @NonNull String key, final @NonNull PlotArea area) {
return Template.of(key, area.toString()); return Template.of(key, area.toString());
} }
@ -103,7 +103,7 @@ public final class Templates {
* @param number Number * @param number Number
* @return Generated template * @return Generated template
*/ */
public @NonNull static Template of(final @NonNull String key, final @NonNull Number number) { public static @NonNull Template of(final @NonNull String key, final @NonNull Number number) {
return Template.of(key, number.toString()); return Template.of(key, number.toString());
} }

View File

@ -57,7 +57,7 @@ public final class TranslatableCaption implements NamespacedCaption {
* included, {@link #DEFAULT_NAMESPACE} will be used. * included, {@link #DEFAULT_NAMESPACE} will be used.
* @return Caption instance * @return Caption instance
*/ */
public @NonNull static TranslatableCaption of(final @NonNull String rawKey) { public static @NonNull TranslatableCaption of(final @NonNull String rawKey) {
final String namespace; final String namespace;
final String key; final String key;
if (rawKey.contains(":")) { if (rawKey.contains(":")) {
@ -81,7 +81,7 @@ public final class TranslatableCaption implements NamespacedCaption {
* @param key Caption key * @param key Caption key
* @return Caption instance * @return Caption instance
*/ */
public @NonNull static TranslatableCaption of( public static @NonNull TranslatableCaption of(
final @NonNull String namespace, final @NonNull String namespace,
final @NonNull String key final @NonNull String key
) { ) {

View File

@ -30,6 +30,7 @@ import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.PlotId; import com.plotsquared.core.plot.PlotId;
import com.plotsquared.core.queue.ScopedQueueCoordinator; import com.plotsquared.core.queue.ScopedQueueCoordinator;
import com.plotsquared.core.setup.PlotAreaBuilder; import com.plotsquared.core.setup.PlotAreaBuilder;
import org.checkerframework.checker.nullness.qual.NonNull;
/** /**
* This class allows for implementation independent world generation. * This class allows for implementation independent world generation.
@ -94,7 +95,7 @@ public abstract class IndependentPlotGenerator {
* @param world ChunkGenerator Implementation * @param world ChunkGenerator Implementation
* @return Chunk generator * @return Chunk generator
*/ */
public <T> GeneratorWrapper<T> specify(String world) { public <T> GeneratorWrapper<T> specify(final @NonNull String world) {
return (GeneratorWrapper<T>) PlotSquared.platform().wrapPlotGenerator(world, this); return (GeneratorWrapper<T>) PlotSquared.platform().wrapPlotGenerator(world, this);
} }

View File

@ -84,7 +84,7 @@ public final class Location extends BlockLoc implements Comparable<Location> {
* @param pitch pitch * @param pitch pitch
* @return New location * @return New location
*/ */
public @NonNull static Location at( public static @NonNull Location at(
final @NonNull String world, final @NonNull String world,
final @NonNull BlockVector3 blockVector3, final float yaw, final float pitch final @NonNull BlockVector3 blockVector3, final float yaw, final float pitch
) { ) {
@ -98,7 +98,7 @@ public final class Location extends BlockLoc implements Comparable<Location> {
* @param blockVector3 (x,y,z) vector * @param blockVector3 (x,y,z) vector
* @return New location * @return New location
*/ */
public @NonNull static Location at( public static @NonNull Location at(
final @NonNull String world, final @NonNull String world,
final @NonNull BlockVector3 blockVector3 final @NonNull BlockVector3 blockVector3
) { ) {
@ -116,7 +116,7 @@ public final class Location extends BlockLoc implements Comparable<Location> {
* @param pitch Pitch * @param pitch Pitch
* @return New location * @return New location
*/ */
public @NonNull static Location at( public static @NonNull Location at(
final @NonNull String world, final int x, final int y, final @NonNull String world, final int x, final int y,
final int z, final float yaw, final float pitch final int z, final float yaw, final float pitch
) { ) {
@ -132,7 +132,7 @@ public final class Location extends BlockLoc implements Comparable<Location> {
* @param z Z coordinate * @param z Z coordinate
* @return New location * @return New location
*/ */
public @NonNull static Location at( public static @NonNull Location at(
final @NonNull String world, final int x, final int y, final @NonNull String world, final int x, final int y,
final int z final int z
) { ) {
@ -148,7 +148,7 @@ public final class Location extends BlockLoc implements Comparable<Location> {
* @param pitch pitch * @param pitch pitch
* @return New location * @return New location
*/ */
public @NonNull static Location at( public static @NonNull Location at(
final @NonNull World<?> world, final @NonNull World<?> world,
final @NonNull BlockVector3 blockVector3, final float yaw, final float pitch final @NonNull BlockVector3 blockVector3, final float yaw, final float pitch
) { ) {
@ -162,7 +162,7 @@ public final class Location extends BlockLoc implements Comparable<Location> {
* @param blockVector3 (x,y,z) vector * @param blockVector3 (x,y,z) vector
* @return New location * @return New location
*/ */
public @NonNull static Location at( public static @NonNull Location at(
final @NonNull World<?> world, final @NonNull World<?> world,
final @NonNull BlockVector3 blockVector3 final @NonNull BlockVector3 blockVector3
) { ) {
@ -180,7 +180,7 @@ public final class Location extends BlockLoc implements Comparable<Location> {
* @param pitch Pitch * @param pitch Pitch
* @return New location * @return New location
*/ */
public @NonNull static Location at( public static @NonNull Location at(
final @NonNull World<?> world, final int x, final int y, final @NonNull World<?> world, final int x, final int y,
final int z, final float yaw, final float pitch final int z, final float yaw, final float pitch
) { ) {
@ -196,7 +196,7 @@ public final class Location extends BlockLoc implements Comparable<Location> {
* @param z Z coordinate * @param z Z coordinate
* @return New location * @return New location
*/ */
public @NonNull static Location at( public static @NonNull Location at(
final @NonNull World<?> world, final int x, final int y, final @NonNull World<?> world, final int x, final int y,
final int z final int z
) { ) {

View File

@ -53,7 +53,7 @@ public final class PlotLoc {
this.z = z; this.z = z;
} }
public @Nullable static PlotLoc fromString(final String input) { public static @Nullable PlotLoc fromString(final String input) {
if (input == null || "side".equalsIgnoreCase(input)) { if (input == null || "side".equalsIgnoreCase(input)) {
return null; return null;
} else if (StringMan.isEqualIgnoreCaseToAny(input, "center", "middle")) { } else if (StringMan.isEqualIgnoreCaseToAny(input, "center", "middle")) {

View File

@ -62,7 +62,7 @@ public final class MetaDataKey<T> {
* @param <T> Type * @param <T> Type
* @return MetaData key instance * @return MetaData key instance
*/ */
public @NonNull static <T> MetaDataKey<T> of(final @NonNull String key, final @NonNull TypeLiteral<T> type) { public static @NonNull <T> MetaDataKey<T> of(final @NonNull String key, final @NonNull TypeLiteral<T> type) {
synchronized (keyMetaData) { synchronized (keyMetaData) {
return (MetaDataKey<T>) return (MetaDataKey<T>)
keyMap.computeIfAbsent(key, missingKey -> new MetaDataKey<>(missingKey, type)); keyMap.computeIfAbsent(key, missingKey -> new MetaDataKey<>(missingKey, type));

View File

@ -319,7 +319,7 @@ public class Plot {
* @param message If a message should be sent to the player if a plot cannot be found * @param message If a message should be sent to the player if a plot cannot be found
* @return The plot if only 1 result is found, or null * @return The plot if only 1 result is found, or null
*/ */
public @Nullable static Plot getPlotFromString( public static @Nullable Plot getPlotFromString(
final @Nullable PlotPlayer<?> player, final @Nullable PlotPlayer<?> player,
final @Nullable String arg, final @Nullable String arg,
final boolean message final boolean message
@ -386,7 +386,7 @@ public class Plot {
* @param string plot id/area + id * @param string plot id/area + id
* @return New or existing plot object * @return New or existing plot object
*/ */
public @Nullable static Plot fromString(final @Nullable PlotArea defaultArea, final @NonNull String string) { public static @Nullable Plot fromString(final @Nullable PlotArea defaultArea, final @NonNull String string) {
final String[] split = string.split("[;,]"); final String[] split = string.split("[;,]");
if (split.length == 2) { if (split.length == 2) {
if (defaultArea != null) { if (defaultArea != null) {
@ -416,7 +416,7 @@ public class Plot {
* @return plot at location or null * @return plot at location or null
* @see PlotPlayer#getCurrentPlot() if a player is expected here. * @see PlotPlayer#getCurrentPlot() if a player is expected here.
*/ */
public @Nullable static Plot getPlot(final @NonNull Location location) { public static @Nullable Plot getPlot(final @NonNull Location location) {
final PlotArea pa = location.getPlotArea(); final PlotArea pa = location.getPlotArea();
if (pa != null) { if (pa != null) {
return pa.getPlot(location); return pa.getPlot(location);

View File

@ -61,7 +61,7 @@ public final class PlotId {
* @param y The plot y coordinate * @param y The plot y coordinate
* @return a new PlotId at x,y * @return a new PlotId at x,y
*/ */
public @NonNull static PlotId of(final int x, final int y) { public static @NonNull PlotId of(final int x, final int y) {
return new PlotId(x, y); return new PlotId(x, y);
} }
@ -72,7 +72,7 @@ public final class PlotId {
* @return the PlotId representation of the argument * @return the PlotId representation of the argument
* @throws IllegalArgumentException if the string does not contain a valid PlotId * @throws IllegalArgumentException if the string does not contain a valid PlotId
*/ */
public @NonNull static PlotId fromString(final @NonNull String string) { public static @NonNull PlotId fromString(final @NonNull String string) {
final PlotId plot = fromStringOrNull(string); final PlotId plot = fromStringOrNull(string);
if (plot == null) { if (plot == null) {
throw new IllegalArgumentException("Cannot create PlotID. String invalid."); throw new IllegalArgumentException("Cannot create PlotID. String invalid.");
@ -86,7 +86,7 @@ public final class PlotId {
* @param string ID string * @param string ID string
* @return Plot ID, or {@code null} if none could be parsed * @return Plot ID, or {@code null} if none could be parsed
*/ */
public @Nullable static PlotId fromStringOrNull(final @NonNull String string) { public static @Nullable PlotId fromStringOrNull(final @NonNull String string) {
final String[] parts = string.split("[;_,.]"); final String[] parts = string.split("[;_,.]");
if (parts.length < 2) { if (parts.length < 2) {
return null; return null;
@ -109,7 +109,7 @@ public final class PlotId {
* @param hash ID hash * @param hash ID hash
* @return Plot ID * @return Plot ID
*/ */
public @NonNull static PlotId unpair(final int hash) { public static @NonNull PlotId unpair(final int hash) {
return PlotId.of(hash >> 16, hash & 0xFFFF); return PlotId.of(hash >> 16, hash & 0xFFFF);
} }

View File

@ -131,7 +131,7 @@ public class DenyTeleportFlag extends PlotFlag<DenyTeleportFlag.DeniedGroup, Den
NONTRUSTED, NONTRUSTED,
NONOWNERS; NONOWNERS;
public @Nullable static DeniedGroup fromString(final @NonNull String string) { public static @Nullable DeniedGroup fromString(final @NonNull String string) {
for (final DeniedGroup group : values()) { for (final DeniedGroup group : values()) {
if (group.name().equalsIgnoreCase(string)) { if (group.name().equalsIgnoreCase(string)) {
return group; return group;

View File

@ -98,7 +98,7 @@ public class TitlesFlag extends PlotFlag<TitlesFlag.TitlesFlagValue, TitlesFlag>
TRUE, TRUE,
FALSE; FALSE;
public @Nullable static TitlesFlagValue fromString(final String value) { public static @Nullable TitlesFlagValue fromString(final String value) {
if (value.equalsIgnoreCase("true")) { if (value.equalsIgnoreCase("true")) {
return TRUE; return TRUE;
} else if (value.equalsIgnoreCase("false")) { } else if (value.equalsIgnoreCase("false")) {

View File

@ -135,8 +135,7 @@ public interface PlotAreaManager {
* @param region Optional region * @param region Optional region
* @return All areas in the world (and region) * @return All areas in the world (and region)
*/ */
@NonNull default @NonNull Set<@NonNull PlotArea> getPlotAreasSet(
default Set<PlotArea> getPlotAreasSet(
final @NonNull String world, final @NonNull String world,
final @Nullable CuboidRegion region final @Nullable CuboidRegion region
) { ) {
@ -153,8 +152,7 @@ public interface PlotAreaManager {
* @param world World name * @param world World name
* @return Modifiable set containing all plot areas in the specified world * @return Modifiable set containing all plot areas in the specified world
*/ */
@NonNull default @NonNull Set<@NonNull PlotArea> getPlotAreasSet(final @NonNull String world) {
default Set<PlotArea> getPlotAreasSet(final @NonNull String world) {
final Set<PlotArea> set = new HashSet<>(); final Set<PlotArea> set = new HashSet<>();
Collections.addAll(set, this.getPlotAreas(world, null)); Collections.addAll(set, this.getPlotAreas(world, null));
return set; return set;
@ -167,8 +165,7 @@ public interface PlotAreaManager {
* @param search Search string * @param search Search string
* @return An area that matches the search string, or {@code null} * @return An area that matches the search string, or {@code null}
*/ */
@Nullable default @Nullable PlotArea getPlotAreaByString(final @NonNull String search) {
default PlotArea getPlotAreaByString(final @NonNull String search) {
String[] split = search.split("[;,]"); String[] split = search.split("[;,]");
PlotArea[] areas = this.getPlotAreas(split[0], null); PlotArea[] areas = this.getPlotAreas(split[0], null);
if (areas == null) { if (areas == null) {

View File

@ -60,7 +60,7 @@ public enum CommonSetupSteps implements SetupStep {
return CommonSetupSteps.CHOOSE_PLOT_AREA_TYPE; // proceed with next step return CommonSetupSteps.CHOOSE_PLOT_AREA_TYPE; // proceed with next step
} }
@NonNull
@Override @Override
public Collection<String> getSuggestions() { public Collection<String> getSuggestions() {
return Collections.unmodifiableSet(SetupUtils.generators.keySet()); return Collections.unmodifiableSet(SetupUtils.generators.keySet());

View File

@ -55,7 +55,7 @@ public final class LockKey {
* @param key Key name * @param key Key name
* @return Lock key instance * @return Lock key instance
*/ */
public @NonNull static LockKey of(final @NonNull String key) { public static @NonNull LockKey of(final @NonNull String key) {
synchronized (keyLock) { synchronized (keyLock) {
return keyMap.computeIfAbsent(key, LockKey::new); return keyMap.computeIfAbsent(key, LockKey::new);
} }

View File

@ -64,7 +64,7 @@ public final class BlockUtil {
* @param id Legacy ID * @param id Legacy ID
* @return Block state, or {@code null} * @return Block state, or {@code null}
*/ */
public @Nullable static BlockState get(final int id) { public static @Nullable BlockState get(final int id) {
return LegacyMapper.getInstance().getBlockFromLegacy(id); return LegacyMapper.getInstance().getBlockFromLegacy(id);
} }
@ -75,7 +75,7 @@ public final class BlockUtil {
* @param data Legacy data * @param data Legacy data
* @return Block state, or {@code null} * @return Block state, or {@code null}
*/ */
public @Nullable static BlockState get(final int id, final int data) { public static @Nullable BlockState get(final int id, final int data) {
return LegacyMapper.getInstance().getBlockFromLegacy(id, data); return LegacyMapper.getInstance().getBlockFromLegacy(id, data);
} }
@ -83,20 +83,21 @@ public final class BlockUtil {
* Get a {@link BlockState} from its ID * Get a {@link BlockState} from its ID
* *
* @param id String or integer ID * @param id String or integer ID
* @return Parsed block state, or {@code null} if none * @return Parsed block state, or {@code null} if none
* could be parsed * could be parsed
*/ */
public @Nullable static BlockState get(@NonNull String id) { public static @Nullable BlockState get(final @NonNull String id) {
if (id.length() == 1 && id.charAt(0) == '*') { if (id.length() == 1 && id.charAt(0) == '*') {
return FuzzyBlockState.builder().type(BlockTypes.AIR).build(); return FuzzyBlockState.builder().type(BlockTypes.AIR).build();
} }
id = id.toLowerCase(); String mutableId = id;
BlockType type = BlockTypes.get(id); mutableId = id.toLowerCase();
BlockType type = BlockTypes.get(mutableId );
if (type != null) { if (type != null) {
return type.getDefaultState(); return type.getDefaultState();
} }
if (Character.isDigit(id.charAt(0))) { if (Character.isDigit(mutableId .charAt(0))) {
String[] split = id.split(":"); String[] split = mutableId .split(":");
if (MathMan.isInteger(split[0])) { if (MathMan.isInteger(split[0])) {
if (split.length == 2) { if (split.length == 2) {
if (MathMan.isInteger(split[1])) { if (MathMan.isInteger(split[1])) {
@ -108,7 +109,7 @@ public final class BlockUtil {
} }
} }
try { try {
BaseBlock block = PARSER.parseFromInput(id, PARSER_CONTEXT); BaseBlock block = PARSER.parseFromInput(mutableId, PARSER_CONTEXT);
return block.toImmutableState(); return block.toImmutableState();
} catch (InputParseException e) { } catch (InputParseException e) {
return null; return null;
@ -121,7 +122,7 @@ public final class BlockUtil {
* @param commaDelimited List of block states * @param commaDelimited List of block states
* @return Parsed block states * @return Parsed block states
*/ */
public @NonNull static BlockState[] parse(final @NonNull String commaDelimited) { public static @NonNull BlockState[] parse(final @NonNull String commaDelimited) {
final String[] split = commaDelimited.split(",(?![^\\(\\[]*[\\]\\)])"); final String[] split = commaDelimited.split(",(?![^\\(\\[]*[\\]\\)])");
final BlockState[] result = new BlockState[split.length]; final BlockState[] result = new BlockState[split.length];
for (int i = 0; i < split.length; i++) { for (int i = 0; i < split.length; i++) {
@ -137,7 +138,7 @@ public final class BlockUtil {
* @return Deserialized block state, or {@code null} if the map is * @return Deserialized block state, or {@code null} if the map is
* not a properly serialized block state * not a properly serialized block state
*/ */
public @Nullable static BlockState deserialize(final @NonNull Map<String, Object> map) { public static @Nullable BlockState deserialize(final @NonNull Map<String, Object> map) {
if (map.containsKey("material")) { if (map.containsKey("material")) {
final Object object = map.get("material"); final Object object = map.get("material");
return get(object.toString()); return get(object.toString());

View File

@ -58,7 +58,7 @@ public final class FileUtils {
} }
} }
public @NonNull static File getFile(final @NonNull File base, final @NonNull String path) { public static @NonNull File getFile(final @NonNull File base, final @NonNull String path) {
if (Paths.get(path).isAbsolute()) { if (Paths.get(path).isAbsolute()) {
return new File(path); return new File(path);
} }

View File

@ -117,7 +117,7 @@ public abstract class PlayerManager<P extends PlotPlayer<? extends T>, T> {
* @param localeHolder the localeHolder to localize the component for * @param localeHolder the localeHolder to localize the component for
* @return Component of name list * @return Component of name list
*/ */
public @NonNull static Component getPlayerList(final @NonNull Collection<UUID> uuids, LocaleHolder localeHolder) { public static @NonNull Component getPlayerList(final @NonNull Collection<UUID> uuids, LocaleHolder localeHolder) {
if (uuids.isEmpty()) { if (uuids.isEmpty()) {
return MINI_MESSAGE.parse(TranslatableCaption.of("info.none").getComponent(localeHolder)); return MINI_MESSAGE.parse(TranslatableCaption.of("info.none").getComponent(localeHolder));
} }
@ -163,7 +163,7 @@ public abstract class PlayerManager<P extends PlotPlayer<? extends T>, T> {
* @param owner Owner UUID * @param owner Owner UUID
* @return The player's name, None, Everyone or Unknown * @return The player's name, None, Everyone or Unknown
*/ */
public @NonNull static String getName(final @Nullable UUID owner) { public static @NonNull String getName(final @Nullable UUID owner) {
return getName(owner, true); return getName(owner, true);
} }
@ -174,7 +174,7 @@ public abstract class PlayerManager<P extends PlotPlayer<? extends T>, T> {
* @param blocking Whether or not the operation can be blocking * @param blocking Whether or not the operation can be blocking
* @return The player's name, None, Everyone or Unknown * @return The player's name, None, Everyone or Unknown
*/ */
public @NonNull static String getName(final @Nullable UUID owner, final boolean blocking) { public static @NonNull String getName(final @Nullable UUID owner, final boolean blocking) {
if (owner == null) { if (owner == null) {
TranslatableCaption.of("info.none"); TranslatableCaption.of("info.none");
} }

View File

@ -38,7 +38,7 @@ import java.util.Iterator;
public class RegionUtil { public class RegionUtil {
public @NonNull static Location[] getCorners( public static @NonNull Location[] getCorners(
final @NonNull String world, final @NonNull String world,
final @NonNull CuboidRegion region final @NonNull CuboidRegion region
) { ) {
@ -47,7 +47,7 @@ public class RegionUtil {
return new Location[]{Location.at(world, min), Location.at(world, max)}; return new Location[]{Location.at(world, min), Location.at(world, max)};
} }
public @NonNull static Location[] getCorners(String world, Collection<CuboidRegion> regions) { public static @NonNull Location[] getCorners(String world, Collection<CuboidRegion> regions) {
CuboidRegion aabb = getAxisAlignedBoundingBox(regions); CuboidRegion aabb = getAxisAlignedBoundingBox(regions);
return getCorners(world, aabb); return getCorners(world, aabb);
} }
@ -58,7 +58,7 @@ public class RegionUtil {
* @param regions The regions the bounding box should contain. * @param regions The regions the bounding box should contain.
* @return a CuboidRegion that contains all given regions. * @return a CuboidRegion that contains all given regions.
*/ */
public @NonNull static CuboidRegion getAxisAlignedBoundingBox(Iterable<CuboidRegion> regions) { public static @NonNull CuboidRegion getAxisAlignedBoundingBox(Iterable<CuboidRegion> regions) {
Iterator<CuboidRegion> iterator = regions.iterator(); Iterator<CuboidRegion> iterator = regions.iterator();
if (!iterator.hasNext()) { if (!iterator.hasNext()) {
throw new IllegalArgumentException("No regions given"); throw new IllegalArgumentException("No regions given");
@ -102,7 +102,7 @@ public class RegionUtil {
.getY() && y <= max.getY(); .getY() && y <= max.getY();
} }
public @NonNull static Rectangle2D toRectangle(final @NonNull CuboidRegion region) { public static @NonNull Rectangle2D toRectangle(final @NonNull CuboidRegion region) {
final BlockVector2 min = region.getMinimumPoint().toBlockVector2(); final BlockVector2 min = region.getMinimumPoint().toBlockVector2();
final BlockVector2 max = region.getMaximumPoint().toBlockVector2(); final BlockVector2 max = region.getMaximumPoint().toBlockVector2();
return new Rectangle2D.Double(min.getX(), min.getZ(), max.getX(), max.getZ()); return new Rectangle2D.Double(min.getX(), min.getZ(), max.getX(), max.getZ());

View File

@ -81,7 +81,7 @@ public final class TabCompletions {
* @param existing Players that should not be included in completions * @param existing Players that should not be included in completions
* @return List of completions * @return List of completions
*/ */
public @NonNull static List<Command> completePlayers( public static @NonNull List<Command> completePlayers(
final @NonNull String input, final @NonNull String input,
final @NonNull List<String> existing final @NonNull List<String> existing
) { ) {
@ -96,7 +96,7 @@ public final class TabCompletions {
* @param existing Players that should not be included in completions * @param existing Players that should not be included in completions
* @return List of completions * @return List of completions
*/ */
public @NonNull static List<Command> completeAddedPlayers( public static @NonNull List<Command> completeAddedPlayers(
final @NonNull Plot plot, final @NonNull Plot plot,
final @NonNull String input, final @NonNull List<String> existing final @NonNull String input, final @NonNull List<String> existing
) { ) {
@ -107,7 +107,7 @@ public final class TabCompletions {
); );
} }
public @NonNull static List<Command> completePlayersInPlot( public static @NonNull List<Command> completePlayersInPlot(
final @NonNull Plot plot, final @NonNull Plot plot,
final @NonNull String input, final @NonNull List<String> existing final @NonNull String input, final @NonNull List<String> existing
) { ) {
@ -130,7 +130,7 @@ public final class TabCompletions {
* @param input Command input * @param input Command input
* @return List of completions * @return List of completions
*/ */
public @NonNull static List<Command> completePatterns(final @NonNull String input) { public static @NonNull List<Command> completePatterns(final @NonNull String input) {
return PatternUtil.getSuggestions(input.trim()).stream() return PatternUtil.getSuggestions(input.trim()).stream()
.map(value -> value.toLowerCase(Locale.ENGLISH).replace("minecraft:", "")) .map(value -> value.toLowerCase(Locale.ENGLISH).replace("minecraft:", ""))
.filter(value -> value.startsWith(input.toLowerCase(Locale.ENGLISH))) .filter(value -> value.startsWith(input.toLowerCase(Locale.ENGLISH)))
@ -138,7 +138,7 @@ public final class TabCompletions {
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
public @NonNull static List<Command> completeBoolean(final @NonNull String input) { public static @NonNull List<Command> completeBoolean(final @NonNull String input) {
if (input.isEmpty()) { if (input.isEmpty()) {
return Arrays.asList(booleanTrueCompletion, booleanFalseCompletion); return Arrays.asList(booleanTrueCompletion, booleanFalseCompletion);
} }
@ -160,7 +160,7 @@ public final class TabCompletions {
* @param highestLimit Highest number to include * @param highestLimit Highest number to include
* @return Unmodifiable list of number completions * @return Unmodifiable list of number completions
*/ */
public @NonNull static List<Command> completeNumbers( public static @NonNull List<Command> completeNumbers(
final @NonNull String input, final @NonNull String input,
final int amountLimit, final int highestLimit final int amountLimit, final int highestLimit
) { ) {
@ -187,7 +187,7 @@ public final class TabCompletions {
* @param input Input to filter with * @param input Input to filter with
* @return Unmodifiable list of area completions * @return Unmodifiable list of area completions
*/ */
public @NonNull static List<Command> completeAreas(final @NonNull String input) { public static @NonNull List<Command> completeAreas(final @NonNull String input) {
final List<Command> completions = new ArrayList<>(); final List<Command> completions = new ArrayList<>();
for (final PlotArea area : PlotSquared.get().getPlotAreaManager().getAllPlotAreas()) { for (final PlotArea area : PlotSquared.get().getPlotAreaManager().getAllPlotAreas()) {
String areaName = area.getWorldName(); String areaName = area.getWorldName();
@ -205,7 +205,7 @@ public final class TabCompletions {
return Collections.unmodifiableList(completions); return Collections.unmodifiableList(completions);
} }
public @NonNull static List<Command> asCompletions(String... toFilter) { public static @NonNull List<Command> asCompletions(String... toFilter) {
final List<Command> completions = new ArrayList<>(); final List<Command> completions = new ArrayList<>();
for (String completion : toFilter) { for (String completion : toFilter) {
completions.add(new Command(null, false, completion, "", completions.add(new Command(null, false, completion, "",

View File

@ -40,7 +40,7 @@ public final class TimeUtil {
* @param time Time to format * @param time Time to format
* @return Formatted string * @return Formatted string
*/ */
public @NonNull static String secToTime(@NonNegative long time) { public static @NonNull String secToTime(@NonNegative long time) {
StringBuilder toReturn = new StringBuilder(); StringBuilder toReturn = new StringBuilder();
if (time >= 33868800) { if (time >= 33868800) {
int years = (int) (time / 33868800); int years = (int) (time / 33868800);

View File

@ -92,7 +92,7 @@ public abstract class TaskManager {
* @param id Task ID * @param id Task ID
* @return Task if stored, or {@code null} * @return Task if stored, or {@code null}
*/ */
public @Nullable static PlotSquaredTask removeTask(final int id) { public static @Nullable PlotSquaredTask removeTask(final int id) {
return tasks.remove(id); return tasks.remove(id);
} }
@ -104,7 +104,7 @@ public abstract class TaskManager {
* @param taskTime Task interval * @param taskTime Task interval
* @return Created task object, can be used to cancel the task * @return Created task object, can be used to cancel the task
*/ */
public @NonNull static PlotSquaredTask runTaskRepeat( public static @NonNull PlotSquaredTask runTaskRepeat(
final @Nullable Runnable runnable, final @Nullable Runnable runnable,
final @NonNull TaskTime taskTime final @NonNull TaskTime taskTime
) { ) {
@ -188,7 +188,7 @@ public abstract class TaskManager {
} }
} }
public @Nullable static TaskManager getPlatformImplementation() { public static @Nullable TaskManager getPlatformImplementation() {
return platformImplementation; return platformImplementation;
} }

View File

@ -48,7 +48,7 @@ public final class TaskTime {
* @param seconds Seconds * @param seconds Seconds
* @return Created task time instance * @return Created task time instance
*/ */
public @NonNull static TaskTime seconds(@NonNegative final long seconds) { public static @NonNull TaskTime seconds(@NonNegative final long seconds) {
return new TaskTime(seconds * 1000L, TaskUnit.MILLISECONDS); return new TaskTime(seconds * 1000L, TaskUnit.MILLISECONDS);
} }
@ -58,7 +58,7 @@ public final class TaskTime {
* @param ticks Server ticks * @param ticks Server ticks
* @return Created task time instance * @return Created task time instance
*/ */
public @NonNull static TaskTime ticks(@NonNegative final long ticks) { public static @NonNull TaskTime ticks(@NonNegative final long ticks) {
return new TaskTime(ticks, TaskUnit.TICKS); return new TaskTime(ticks, TaskUnit.TICKS);
} }
@ -68,7 +68,7 @@ public final class TaskTime {
* @param ms Milliseconds * @param ms Milliseconds
* @return Created task time instance * @return Created task time instance
*/ */
public @NonNull static TaskTime ms(@NonNegative final long ms) { public static @NonNull TaskTime ms(@NonNegative final long ms) {
return new TaskTime(ms, TaskUnit.MILLISECONDS); return new TaskTime(ms, TaskUnit.MILLISECONDS);
} }

View File

@ -58,21 +58,21 @@ public class CacheUUIDService implements UUIDService, Consumer<List<UUIDMapping>
} }
@Override @Override
public @NonNull List<UUIDMapping> getNames(final @NonNull List<UUID> uuids) { public @NonNull List<UUIDMapping> getNames(final @NonNull List<@NonNull UUID> uuids) {
final List<UUIDMapping> mappings = new ArrayList<>(uuids.size()); final List<UUIDMapping> mappings = new ArrayList<>(uuids.size());
mappings.addAll(this.uuidCache.getAllPresent(uuids).values()); mappings.addAll(this.uuidCache.getAllPresent(uuids).values());
return mappings; return mappings;
} }
@Override @Override
public @NonNull List<UUIDMapping> getUUIDs(final @NonNull List<String> usernames) { public @NonNull List<UUIDMapping> getUUIDs(final @NonNull List<@NonNull String> usernames) {
final List<UUIDMapping> mappings = new ArrayList<>(usernames.size()); final List<UUIDMapping> mappings = new ArrayList<>(usernames.size());
mappings.addAll(this.usernameCache.getAllPresent(usernames).values()); mappings.addAll(this.usernameCache.getAllPresent(usernames).values());
return mappings; return mappings;
} }
@Override @Override
public void accept(final List<UUIDMapping> uuidMappings) { public void accept(final @NonNull List<@NonNull UUIDMapping> uuidMappings) {
for (final UUIDMapping mapping : uuidMappings) { for (final UUIDMapping mapping : uuidMappings) {
this.uuidCache.put(mapping.getUuid(), mapping); this.uuidCache.put(mapping.getUuid(), mapping);
this.usernameCache.put(mapping.getUsername(), mapping); this.usernameCache.put(mapping.getUsername(), mapping);
@ -80,7 +80,7 @@ public class CacheUUIDService implements UUIDService, Consumer<List<UUIDMapping>
} }
@Override @Override
public @NonNull Collection<UUIDMapping> getImmediately() { public @NonNull Collection<@NonNull UUIDMapping> getImmediately() {
return this.usernameCache.asMap().values(); return this.usernameCache.asMap().values();
} }

View File

@ -36,7 +36,10 @@ public class ServiceError extends RuntimeException {
super(message); super(message);
} }
public ServiceError(final @NonNull String message, final @NonNull Throwable cause) { public ServiceError(
final @NonNull String message,
final @NonNull Throwable cause
) {
super(message, cause); super(message, cause);
} }

View File

@ -38,7 +38,7 @@ public class UUIDMapping {
private final UUID uuid; private final UUID uuid;
private final String username; private final String username;
public UUIDMapping(final @NonNull UUID uuid, final String username) { public UUIDMapping(final @NonNull UUID uuid, final @NonNull String username) {
this.uuid = uuid; this.uuid = uuid;
this.username = username; this.username = username;
} }

View File

@ -101,7 +101,7 @@ public class UUIDPipeline {
* *
* @param mappingConsumer Consumer to register * @param mappingConsumer Consumer to register
*/ */
public void registerConsumer(final @NonNull Consumer<List<UUIDMapping>> mappingConsumer) { public void registerConsumer(final @NonNull Consumer<@NonNull List<@NonNull UUIDMapping>> mappingConsumer) {
this.consumerList.add(mappingConsumer); this.consumerList.add(mappingConsumer);
} }
@ -110,7 +110,7 @@ public class UUIDPipeline {
* *
* @return Copy of service list * @return Copy of service list
*/ */
public List<UUIDService> getServiceListInstance() { public @NonNull List<@NonNull UUIDService> getServiceListInstance() {
return Collections.unmodifiableList(this.serviceList); return Collections.unmodifiableList(this.serviceList);
} }
@ -119,7 +119,7 @@ public class UUIDPipeline {
* *
* @param mappings Mappings * @param mappings Mappings
*/ */
public void consume(final @NonNull List<UUIDMapping> mappings) { public void consume(final @NonNull List<@NonNull UUIDMapping> mappings) {
final Runnable runnable = () -> { final Runnable runnable = () -> {
for (final Consumer<List<UUIDMapping>> consumer : this.consumerList) { for (final Consumer<List<UUIDMapping>> consumer : this.consumerList) {
consumer.accept(mappings); consumer.accept(mappings);
@ -213,7 +213,7 @@ public class UUIDPipeline {
* @param username Username * @param username Username
* @param uuid UUID consumer * @param uuid UUID consumer
*/ */
public void getSingle(final @NonNull String username, final @NonNull BiConsumer<UUID, Throwable> uuid) { public void getSingle(final @NonNull String username, final @NonNull BiConsumer<@Nullable UUID, @Nullable Throwable> uuid) {
this.getUUIDs(Collections.singletonList(username)).applyToEither( this.getUUIDs(Collections.singletonList(username)).applyToEither(
timeoutAfter(Settings.UUID.NON_BLOCKING_TIMEOUT), timeoutAfter(Settings.UUID.NON_BLOCKING_TIMEOUT),
Function.identity() Function.identity()
@ -237,7 +237,7 @@ public class UUIDPipeline {
* @param uuid UUID * @param uuid UUID
* @param username Username consumer * @param username Username consumer
*/ */
public void getSingle(final @NonNull UUID uuid, final @NonNull BiConsumer<String, Throwable> username) { public void getSingle(final @NonNull UUID uuid, final @NonNull BiConsumer<@Nullable String, @Nullable Throwable> username) {
this.getNames(Collections.singletonList(uuid)).applyToEither( this.getNames(Collections.singletonList(uuid)).applyToEither(
timeoutAfter(Settings.UUID.NON_BLOCKING_TIMEOUT), timeoutAfter(Settings.UUID.NON_BLOCKING_TIMEOUT),
Function.identity() Function.identity()
@ -265,7 +265,10 @@ public class UUIDPipeline {
* @param timeout Timeout in milliseconds * @param timeout Timeout in milliseconds
* @return Mappings * @return Mappings
*/ */
public CompletableFuture<List<UUIDMapping>> getNames(final @NonNull Collection<UUID> requests, final long timeout) { public @NonNull CompletableFuture<@NonNull List<@NonNull UUIDMapping>> getNames(
final @NonNull Collection<@NonNull UUID> requests,
final long timeout
) {
return this.getNames(requests).applyToEither(timeoutAfter(timeout), Function.identity()); return this.getNames(requests).applyToEither(timeoutAfter(timeout), Function.identity());
} }
@ -279,11 +282,14 @@ public class UUIDPipeline {
* @param timeout Timeout in milliseconds * @param timeout Timeout in milliseconds
* @return Mappings * @return Mappings
*/ */
public CompletableFuture<List<UUIDMapping>> getUUIDs(final @NonNull Collection<String> requests, final long timeout) { public @NonNull CompletableFuture<List<UUIDMapping>> getUUIDs(
final @NonNull Collection<String> requests,
final long timeout
) {
return this.getUUIDs(requests).applyToEither(timeoutAfter(timeout), Function.identity()); return this.getUUIDs(requests).applyToEither(timeoutAfter(timeout), Function.identity());
} }
private CompletableFuture<List<UUIDMapping>> timeoutAfter(final long timeout) { private @NonNull CompletableFuture<@NonNull List<@NonNull UUIDMapping>> timeoutAfter(final long timeout) {
final CompletableFuture<List<UUIDMapping>> result = new CompletableFuture<>(); final CompletableFuture<List<UUIDMapping>> result = new CompletableFuture<>();
this.timeoutExecutor.schedule(() -> result.completeExceptionally(new TimeoutException()), timeout, TimeUnit.MILLISECONDS); this.timeoutExecutor.schedule(() -> result.completeExceptionally(new TimeoutException()), timeout, TimeUnit.MILLISECONDS);
return result; return result;
@ -295,7 +301,9 @@ public class UUIDPipeline {
* @param requests UUIDs * @param requests UUIDs
* @return Mappings * @return Mappings
*/ */
public CompletableFuture<List<UUIDMapping>> getNames(final @NonNull Collection<UUID> requests) { public @NonNull CompletableFuture<@NonNull List<@NonNull UUIDMapping>> getNames(
final @NonNull Collection<@NonNull UUID> requests
) {
if (requests.isEmpty()) { if (requests.isEmpty()) {
return CompletableFuture.completedFuture(Collections.emptyList()); return CompletableFuture.completedFuture(Collections.emptyList());
} }
@ -362,7 +370,9 @@ public class UUIDPipeline {
* @param requests Names * @param requests Names
* @return Mappings * @return Mappings
*/ */
public CompletableFuture<List<UUIDMapping>> getUUIDs(final @NonNull Collection<String> requests) { public @NonNull CompletableFuture<@NonNull List<@NonNull UUIDMapping>> getUUIDs(
final @NonNull Collection<@NonNull String> requests
) {
if (requests.isEmpty()) { if (requests.isEmpty()) {
return CompletableFuture.completedFuture(Collections.emptyList()); return CompletableFuture.completedFuture(Collections.emptyList());
} }
@ -417,7 +427,7 @@ public class UUIDPipeline {
* *
* @return All mappings that could be provided immediately * @return All mappings that could be provided immediately
*/ */
public @NonNull final Collection<UUIDMapping> getAllImmediately() { public @NonNull final Collection<@NonNull UUIDMapping> getAllImmediately() {
final Set<UUIDMapping> mappings = new LinkedHashSet<>(); final Set<UUIDMapping> mappings = new LinkedHashSet<>();
for (final UUIDService service : this.getServiceListInstance()) { for (final UUIDService service : this.getServiceListInstance()) {
mappings.addAll(service.getImmediately()); mappings.addAll(service.getImmediately());

View File

@ -45,7 +45,7 @@ public interface UUIDService {
* @param uuids Requests * @param uuids Requests
* @return Completed requests * @return Completed requests
*/ */
@NonNull List<UUIDMapping> getNames(final @NonNull List<UUID> uuids); @NonNull List<@NonNull UUIDMapping> getNames(final @NonNull List<@NonNull UUID> uuids);
/** /**
* Attempt to complete the given requests. Returns the mappings * Attempt to complete the given requests. Returns the mappings
@ -54,7 +54,7 @@ public interface UUIDService {
* @param usernames Requests * @param usernames Requests
* @return Completed requests * @return Completed requests
*/ */
@NonNull List<UUIDMapping> getUUIDs(final @NonNull List<String> usernames); @NonNull List<@NonNull UUIDMapping> getUUIDs(final @NonNull List<@NonNull String> usernames);
/** /**
* Get as many UUID mappings as possible under the condition * Get as many UUID mappings as possible under the condition
@ -62,7 +62,7 @@ public interface UUIDService {
* *
* @return All mappings that could be provided immediately * @return All mappings that could be provided immediately
*/ */
default @NonNull Collection<UUIDMapping> getImmediately() { default @NonNull Collection<@NonNull UUIDMapping> getImmediately() {
return Collections.emptyList(); return Collections.emptyList();
} }

View File

@ -51,12 +51,12 @@ public class OfflineModeUUIDService implements UUIDService {
} }
@Override @Override
public @NonNull List<UUIDMapping> getNames(final @NonNull List<UUID> uuids) { public @NonNull List<@NonNull UUIDMapping> getNames(final @NonNull List<@NonNull UUID> uuids) {
return Collections.emptyList(); return Collections.emptyList();
} }
@Override @Override
public @NonNull List<UUIDMapping> getUUIDs(@NonNull List<String> usernames) { public @NonNull List<@NonNull UUIDMapping> getUUIDs(@NonNull List<@NonNull String> usernames) {
final List<UUIDMapping> mappings = new ArrayList<>(usernames.size()); final List<UUIDMapping> mappings = new ArrayList<>(usernames.size());
for (final String username : usernames) { for (final String username : usernames) {
mappings.add(new UUIDMapping(getFromUsername(username), username)); mappings.add(new UUIDMapping(getFromUsername(username), username));