finish client & server communicate

finish database
This commit is contained in:
2023-03-27 01:19:37 +08:00
parent aa4a229b7d
commit e1459c3e8e
23 changed files with 359 additions and 49 deletions
@@ -9,13 +9,13 @@ import java.util.List;
@SuppressWarnings("unused") // API
public interface MultiServerManAPI {
@NotNull
ServerInfo getServer(@NotNull String type, @NotNull List<ProxiedPlayer> players);
ServerInfo getServer(@NotNull String type, @NotNull List<String> players);
void informEnd(int id);
@NotNull
ServerInfo getPlayerServer(@NotNull ProxiedPlayer player);
ServerInfo getPlayerServer(@NotNull String player);
Boolean containPlayer(@NotNull ProxiedPlayer player);
Boolean containPlayer(@NotNull String player);
}
@@ -1,17 +1,22 @@
package cc.maxmc.msm.api;
@SuppressWarnings("unused") // API
public abstract class MultiServerManAPIProvider {
private static MultiServerManAPIProvider instance;
public class MultiServerManAPIProvider {
private static MultiServerManAPI instance = null;
public static MultiServerManAPI getAPI() {
if (instance == null) {
throw new NotLoadedException();
}
return instance.provideAPI();
return instance;
}
abstract MultiServerManAPI provideAPI();
public static void register(MultiServerManAPI api) {
if (instance != null) {
throw new IllegalStateException("The MultiServerMan API has been load twice");
}
instance = api;
}
/**
* 在加载 API 之前请求 API 时引发异常。