Skip to content

Commit

Permalink
add api annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
CaaMoe committed May 12, 2024
1 parent 4b4e3ab commit 8db7232
Show file tree
Hide file tree
Showing 46 changed files with 121 additions and 6 deletions.
2 changes: 1 addition & 1 deletion api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

dependencies {

compileOnly("org.jetbrains:annotations:24.1.0")
}
10 changes: 8 additions & 2 deletions api/src/main/java/moe/caa/multilogin/api/MultiLoginAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@

import moe.caa.multilogin.api.data.MultiLoginPlayerData;
import moe.caa.multilogin.api.service.IService;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;

import java.util.Collection;
import java.util.UUID;

/**
*
*/
@ApiStatus.NonExtendable
public interface MultiLoginAPI {
Collection<? extends IService> getServices();
@NotNull Collection<? extends IService> getServices();

MultiLoginPlayerData getPlayerData(UUID inGameUUID);
@NotNull MultiLoginPlayerData getPlayerData(@NotNull UUID inGameUUID);
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package moe.caa.multilogin.api;

import lombok.Getter;
import org.jetbrains.annotations.ApiStatus;

@ApiStatus.NonExtendable
public class MultiLoginAPIProvider {
@Getter
private static MultiLoginAPI api;

@ApiStatus.Internal
public synchronized static void setApi(MultiLoginAPI api) {
if (MultiLoginAPIProvider.api != null) throw new UnsupportedOperationException("duplicate api.");
MultiLoginAPIProvider.api = api;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package moe.caa.multilogin.api.internal.auth;

import org.jetbrains.annotations.ApiStatus;

/**
* 验证 API
*/
@ApiStatus.Internal
public interface AuthAPI {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package moe.caa.multilogin.api.internal.auth;

import moe.caa.multilogin.api.profile.GameProfile;
import org.jetbrains.annotations.ApiStatus;

/**
* 验证结果
*/
@ApiStatus.Internal
public interface AuthResult {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package moe.caa.multilogin.api.internal.command;

import moe.caa.multilogin.api.internal.plugin.ISender;
import org.jetbrains.annotations.ApiStatus;

import java.util.List;

/**
* 命令处理程序
*/
@ApiStatus.Internal
public interface CommandAPI {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package moe.caa.multilogin.api.internal.function;

import org.jetbrains.annotations.ApiStatus;

// 表示接受两个输入参数且不返回结果的操作
@FunctionalInterface
@ApiStatus.Internal
public interface BiConsumerFunction<T, U, R> {
R accept(T t, U u);
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package moe.caa.multilogin.api.internal.function;

import org.jetbrains.annotations.ApiStatus;

// 可抛出的函数
@FunctionalInterface
@ApiStatus.Internal
public interface ThrowFunction<T, R> {
R apply(T t) throws Throwable;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.jetbrains.annotations.ApiStatus;

/**
* 表示一个通讯结果
*/
@Getter
@ApiStatus.Internal
@AllArgsConstructor
public class HandleResult {
// 通讯结果类型
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
import moe.caa.multilogin.api.profile.GameProfile;
import moe.caa.multilogin.api.internal.plugin.IPlayer;
import moe.caa.multilogin.api.internal.util.Pair;
import org.jetbrains.annotations.ApiStatus;

import java.util.UUID;

/**
* 简单通讯 API,所操作玩家需要在线。
*/
@ApiStatus.Internal
public interface HandlerAPI {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package moe.caa.multilogin.api.internal.injector;

import moe.caa.multilogin.api.internal.main.MultiCoreAPI;
import org.jetbrains.annotations.ApiStatus;

/**
* 子模块注入接口
*/
@ApiStatus.Internal
public interface Injector {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package moe.caa.multilogin.api.internal.language;

import moe.caa.multilogin.api.internal.util.Pair;
import org.jetbrains.annotations.ApiStatus;

@ApiStatus.Internal
public interface LanguageAPI {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package moe.caa.multilogin.api.internal.logger;

import org.jetbrains.annotations.ApiStatus;

/**
* 日志级别
*/
@ApiStatus.Internal
public enum Level {
DEBUG,
INFO,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package moe.caa.multilogin.api.internal.logger;

import org.jetbrains.annotations.ApiStatus;

/**
* 一个日志记录程序
*/
@ApiStatus.Internal
public interface Logger {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
import lombok.Getter;
import lombok.Setter;
import moe.caa.multilogin.api.internal.logger.bridges.ConsoleBridge;
import org.jetbrains.annotations.ApiStatus;

/**
* 日志提供程序
*/
@ApiStatus.Internal
public class LoggerProvider {
@Getter
@Setter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@


import moe.caa.multilogin.api.internal.logger.Logger;
import org.jetbrains.annotations.ApiStatus;

/**
* 基础的日志桥接程序
*/
@ApiStatus.Internal
public abstract class BaseLoggerBridge implements Logger {

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

import lombok.NoArgsConstructor;
import moe.caa.multilogin.api.internal.logger.Level;
import org.jetbrains.annotations.ApiStatus;

/**
* 控制台日志程序桥接
*/
@ApiStatus.Internal
@NoArgsConstructor
public class ConsoleBridge extends BaseLoggerBridge {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
import moe.caa.multilogin.api.internal.logger.Level;
import moe.caa.multilogin.api.internal.logger.Logger;
import moe.caa.multilogin.api.internal.logger.LoggerProvider;
import org.jetbrains.annotations.ApiStatus;

/**
* 调试日志处理
*/
@ApiStatus.Internal
public class DebugLoggerBridge implements Logger {
private final Logger logger;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

import lombok.NoArgsConstructor;
import moe.caa.multilogin.api.internal.logger.Level;
import org.jetbrains.annotations.ApiStatus;

/**
* 空日志程序桥接
*/
@ApiStatus.Internal
@NoArgsConstructor
public class EmptyLoggerBridge extends BaseLoggerBridge {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

import lombok.AllArgsConstructor;
import moe.caa.multilogin.api.internal.logger.Level;
import org.jetbrains.annotations.ApiStatus;

import java.util.logging.Logger;

/**
* java.util.logging.Logger 日志程序桥接
*/
@ApiStatus.Internal
@AllArgsConstructor
public class JavaLoggerBridge extends BaseLoggerBridge {
private final Logger HANDLER;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
import moe.caa.multilogin.api.internal.language.LanguageAPI;
import moe.caa.multilogin.api.internal.plugin.IPlugin;
import moe.caa.multilogin.api.internal.skinrestorer.SkinRestorerAPI;
import org.jetbrains.annotations.ApiStatus;

@ApiStatus.Internal
public interface MultiCoreAPI {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package moe.caa.multilogin.api.internal.plugin;

import org.jetbrains.annotations.ApiStatus;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
Expand All @@ -8,6 +10,7 @@
/**
* 公共服务器线程调度器对象
*/
@ApiStatus.Internal
public abstract class BaseScheduler {
private final AtomicInteger asyncThreadId = new AtomicInteger(0);
private final ScheduledExecutorService asyncExecutor = Executors.newScheduledThreadPool(5,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package moe.caa.multilogin.api.internal.plugin;

import org.jetbrains.annotations.ApiStatus;

import java.net.SocketAddress;
import java.util.UUID;

@ApiStatus.Internal
public interface IPlayer extends ISender {
/**
* 以给定的理由踢出这名玩家
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package moe.caa.multilogin.api.internal.plugin;

import org.jetbrains.annotations.ApiStatus;

import java.util.Set;
import java.util.UUID;

/**
* 公共玩家管理器对象
*/
@ApiStatus.Internal
public interface IPlayerManager {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package moe.caa.multilogin.api.internal.plugin;

import org.jetbrains.annotations.ApiStatus;

import java.io.File;

@ApiStatus.Internal
public interface IPlugin {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package moe.caa.multilogin.api.internal.plugin;

import org.jetbrains.annotations.ApiStatus;

/**
* 公共命令执行者对象
*/
@ApiStatus.Internal
public interface ISender {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package moe.caa.multilogin.api.internal.plugin;

import org.jetbrains.annotations.ApiStatus;

@ApiStatus.Internal
public interface IServer {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package moe.caa.multilogin.api.internal.skinrestorer;

import moe.caa.multilogin.api.internal.auth.AuthResult;
import org.jetbrains.annotations.ApiStatus;

@ApiStatus.Internal
public interface SkinRestorerAPI {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package moe.caa.multilogin.api.internal.skinrestorer;

import moe.caa.multilogin.api.profile.GameProfile;
import org.jetbrains.annotations.ApiStatus;

@ApiStatus.Internal
public interface SkinRestorerResult {

Reason getReason();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.jetbrains.annotations.ApiStatus;

import java.io.File;
import java.io.IOException;
Expand All @@ -12,6 +13,7 @@
/**
* 流工具
*/
@ApiStatus.Internal
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class IOUtil {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

import lombok.AllArgsConstructor;
import lombok.Data;
import org.jetbrains.annotations.ApiStatus;

/**
* 表示一对对象
*/
@Data
@ApiStatus.Internal
@AllArgsConstructor
public class Pair<V1, V2> {
private final V1 value1;
Expand Down
Loading

0 comments on commit 8db7232

Please sign in to comment.