From 96fde09498550087d5c399dd169556654eae0b09 Mon Sep 17 00:00:00 2001 From: CaaMoe Date: Sun, 12 May 2024 19:16:04 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85=E4=B8=80=E7=82=B9=E7=82=B9?= =?UTF-8?q?=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../moe/caa/multilogin/api/MultiLoginAPI.java | 16 ++++++++++++++-- .../multilogin/api/MultiLoginAPIProvider.java | 3 +++ .../api/data/MultiLoginPlayerData.java | 19 +++++++++++++++++-- .../caa/multilogin/api/service/IService.java | 16 ++++++++++++++++ .../multilogin/core/handle/PlayerHandler.java | 3 +++ .../caa/multilogin/core/main/MultiCore.java | 3 ++- 6 files changed, 55 insertions(+), 5 deletions(-) diff --git a/api/src/main/java/moe/caa/multilogin/api/MultiLoginAPI.java b/api/src/main/java/moe/caa/multilogin/api/MultiLoginAPI.java index d0b1d565..418a0d6e 100644 --- a/api/src/main/java/moe/caa/multilogin/api/MultiLoginAPI.java +++ b/api/src/main/java/moe/caa/multilogin/api/MultiLoginAPI.java @@ -4,16 +4,28 @@ import moe.caa.multilogin.api.service.IService; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.Collection; import java.util.UUID; /** - * + * 猫踢螺钉的API, 全部都在这里了 */ @ApiStatus.NonExtendable public interface MultiLoginAPI { + + /** + * 返回所有验证服务列表 + * @return 所有验证服务列表 + */ @NotNull Collection getServices(); - @NotNull MultiLoginPlayerData getPlayerData(@NotNull UUID inGameUUID); + /** + * 通过游戏内 uuid, 返回玩家的登录数据 + * @param inGameUUID 游戏内uuid + * @return 玩家的登录数据 + */ + @Nullable + MultiLoginPlayerData getPlayerData(@NotNull UUID inGameUUID); } diff --git a/api/src/main/java/moe/caa/multilogin/api/MultiLoginAPIProvider.java b/api/src/main/java/moe/caa/multilogin/api/MultiLoginAPIProvider.java index 199fc1d0..9fcfbae8 100644 --- a/api/src/main/java/moe/caa/multilogin/api/MultiLoginAPIProvider.java +++ b/api/src/main/java/moe/caa/multilogin/api/MultiLoginAPIProvider.java @@ -3,6 +3,9 @@ import lombok.Getter; import org.jetbrains.annotations.ApiStatus; +/** + * 提供API的地方................................................. + */ @ApiStatus.NonExtendable public class MultiLoginAPIProvider { @Getter diff --git a/api/src/main/java/moe/caa/multilogin/api/data/MultiLoginPlayerData.java b/api/src/main/java/moe/caa/multilogin/api/data/MultiLoginPlayerData.java index 620ec209..9029bdc9 100644 --- a/api/src/main/java/moe/caa/multilogin/api/data/MultiLoginPlayerData.java +++ b/api/src/main/java/moe/caa/multilogin/api/data/MultiLoginPlayerData.java @@ -2,9 +2,24 @@ import moe.caa.multilogin.api.profile.GameProfile; import moe.caa.multilogin.api.service.IService; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +/** + * 表示一个使用猫踢螺钉登录的玩家的登录数据 + */ +@ApiStatus.NonExtendable public interface MultiLoginPlayerData { - GameProfile getOnlineProfile(); - IService getLoginService(); + /** + * 获取这个玩家的在线游戏档案 + * @return 这个玩家的在线游戏档案 + */ + @NotNull GameProfile getOnlineProfile(); + + /** + * 获取这个玩家使用的验证服务器 + * @return 这个玩家使用的验证服务器 + */ + @NotNull IService getLoginService(); } diff --git a/api/src/main/java/moe/caa/multilogin/api/service/IService.java b/api/src/main/java/moe/caa/multilogin/api/service/IService.java index 2dd6536f..dcef12c0 100644 --- a/api/src/main/java/moe/caa/multilogin/api/service/IService.java +++ b/api/src/main/java/moe/caa/multilogin/api/service/IService.java @@ -3,11 +3,27 @@ import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; +/** + * 表示一个验证服务器 + */ @ApiStatus.NonExtendable public interface IService { + + /** + * 返回这个验证服务ID + * @return 这个验证服务ID + */ int getServiceId(); + /** + * 返回验证服务名字 + * @return 验证服务名字 + */ @NotNull String getServiceName(); + /** + * 返回验证服务类型 + * @return 验证服务类型 + */ @NotNull ServiceType getServiceType(); } diff --git a/core/src/main/java/moe/caa/multilogin/core/handle/PlayerHandler.java b/core/src/main/java/moe/caa/multilogin/core/handle/PlayerHandler.java index 710052a3..2c00f78c 100644 --- a/core/src/main/java/moe/caa/multilogin/core/handle/PlayerHandler.java +++ b/core/src/main/java/moe/caa/multilogin/core/handle/PlayerHandler.java @@ -12,6 +12,7 @@ import moe.caa.multilogin.api.service.IService; import moe.caa.multilogin.core.configuration.service.BaseServiceConfig; import moe.caa.multilogin.core.main.MultiCore; +import org.jetbrains.annotations.NotNull; import java.util.Map; import java.util.Objects; @@ -170,11 +171,13 @@ public static class Entry implements MultiLoginPlayerData { private final BaseServiceConfig serviceConfig; private final long signTimeMillis; + @NotNull @Override public GameProfile getOnlineProfile() { return onlineProfile; } + @NotNull @Override public IService getLoginService() { return serviceConfig; diff --git a/core/src/main/java/moe/caa/multilogin/core/main/MultiCore.java b/core/src/main/java/moe/caa/multilogin/core/main/MultiCore.java index 16e65a12..9dfc16a4 100644 --- a/core/src/main/java/moe/caa/multilogin/core/main/MultiCore.java +++ b/core/src/main/java/moe/caa/multilogin/core/main/MultiCore.java @@ -27,6 +27,7 @@ import moe.caa.multilogin.core.semver.SemVersion; import moe.caa.multilogin.core.skinrestorer.SkinRestorerCore; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.io.IOException; import java.net.URISyntaxException; @@ -180,7 +181,7 @@ public Collection getServices() { return Collections.unmodifiableCollection(pluginConfig.getServiceIdMap().values()); } - @NotNull + @Nullable @Override public MultiLoginPlayerData getPlayerData(@NotNull UUID inGameUUID) { return playerHandler.getPlayerData(inGameUUID);