style: 修正代码格式
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package cn.hamster3.mc.plugin.core.velocity;
|
package cn.hamster3.mc.plugin.core.velocity;
|
||||||
|
|
||||||
import cn.hamster3.mc.plugin.core.common.api.CoreAPI;
|
import cn.hamster3.mc.plugin.core.common.api.CoreAPI;
|
||||||
|
import cn.hamster3.mc.plugin.core.velocity.api.CoreVelocityAPI;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.velocitypowered.api.event.Subscribe;
|
import com.velocitypowered.api.event.Subscribe;
|
||||||
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
|
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
|
||||||
@@ -10,7 +11,6 @@ import com.velocitypowered.api.plugin.annotation.DataDirectory;
|
|||||||
import com.velocitypowered.api.proxy.ProxyServer;
|
import com.velocitypowered.api.proxy.ProxyServer;
|
||||||
import com.zaxxer.hikari.HikariDataSource;
|
import com.zaxxer.hikari.HikariDataSource;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import cn.hamster3.mc.plugin.core.velocity.api.CoreVelocityAPI;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -20,15 +20,15 @@ import java.nio.file.StandardCopyOption;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@Plugin(
|
@Plugin(
|
||||||
id = "airgame-core",
|
id = "hamster-core",
|
||||||
name = "AirGameCore",
|
name = "HamsterCore",
|
||||||
version = BuildConstants.VERSION,
|
version = BuildConstants.VERSION,
|
||||||
description = BuildConstants.DESCRIPTION,
|
description = BuildConstants.DESCRIPTION,
|
||||||
authors = {"MiniDay"}
|
authors = {"MiniDay"}
|
||||||
)
|
)
|
||||||
public class AirGameCorePlugin {
|
public class HamsterCorePlugin {
|
||||||
@Getter
|
@Getter
|
||||||
private static AirGameCorePlugin instance;
|
private static HamsterCorePlugin instance;
|
||||||
@Getter
|
@Getter
|
||||||
private final java.util.logging.Logger logger;
|
private final java.util.logging.Logger logger;
|
||||||
@Getter
|
@Getter
|
||||||
@@ -39,8 +39,8 @@ public class AirGameCorePlugin {
|
|||||||
private final File dataFolder;
|
private final File dataFolder;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public AirGameCorePlugin(Logger slf4jLogger, ProxyServer proxyServer, @DataDirectory Path dataPath) {
|
public HamsterCorePlugin(Logger slf4jLogger, ProxyServer proxyServer, @DataDirectory Path dataPath) {
|
||||||
logger = java.util.logging.Logger.getLogger("airgame-core");
|
logger = java.util.logging.Logger.getLogger("hamster-core");
|
||||||
this.slf4jLogger = slf4jLogger;
|
this.slf4jLogger = slf4jLogger;
|
||||||
this.proxyServer = proxyServer;
|
this.proxyServer = proxyServer;
|
||||||
dataFolder = dataPath.toFile();
|
dataFolder = dataPath.toFile();
|
||||||
@@ -53,7 +53,7 @@ public class AirGameCorePlugin {
|
|||||||
File configFile = new File(dataFolder, "config.yml");
|
File configFile = new File(dataFolder, "config.yml");
|
||||||
if (!configFile.exists()) {
|
if (!configFile.exists()) {
|
||||||
Files.copy(
|
Files.copy(
|
||||||
Objects.requireNonNull(AirGameCorePlugin.class.getResourceAsStream("/config.yml")),
|
Objects.requireNonNull(HamsterCorePlugin.class.getResourceAsStream("/config.yml")),
|
||||||
configFile.toPath(),
|
configFile.toPath(),
|
||||||
StandardCopyOption.REPLACE_EXISTING
|
StandardCopyOption.REPLACE_EXISTING
|
||||||
);
|
);
|
||||||
@@ -64,7 +64,7 @@ public class AirGameCorePlugin {
|
|||||||
slf4jLogger.error("初始化 CoreAPI 出错", e);
|
slf4jLogger.error("初始化 CoreAPI 出错", e);
|
||||||
}
|
}
|
||||||
long time = System.currentTimeMillis() - start;
|
long time = System.currentTimeMillis() - start;
|
||||||
slf4jLogger.info("AirGameCore 初始化完成,总计耗时 " + time + " ms");
|
slf4jLogger.info("HamsterCore 初始化完成,总计耗时 " + time + " ms");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
@@ -91,7 +91,6 @@ public class AirGameCorePlugin {
|
|||||||
CoreAPI.getInstance().getScheduledService().shutdownNow();
|
CoreAPI.getInstance().getScheduledService().shutdownNow();
|
||||||
slf4jLogger.info("已关闭 ScheduledExecutorService 线程池");
|
slf4jLogger.info("已关闭 ScheduledExecutorService 线程池");
|
||||||
long time = System.currentTimeMillis() - start;
|
long time = System.currentTimeMillis() - start;
|
||||||
slf4jLogger.info("AirGameCore 关闭完成,总计耗时 " + time + " ms");
|
slf4jLogger.info("HamsterCore 关闭完成,总计耗时 " + time + " ms");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
@@ -6,7 +6,7 @@ import cn.hamster3.mc.plugin.core.common.config.YamlConfig;
|
|||||||
import cn.hamster3.mc.plugin.core.common.data.DisplayMessage;
|
import cn.hamster3.mc.plugin.core.common.data.DisplayMessage;
|
||||||
import cn.hamster3.mc.plugin.core.common.impl.ComponentTypeAdapter;
|
import cn.hamster3.mc.plugin.core.common.impl.ComponentTypeAdapter;
|
||||||
import cn.hamster3.mc.plugin.core.common.impl.MessageTypeAdapter;
|
import cn.hamster3.mc.plugin.core.common.impl.MessageTypeAdapter;
|
||||||
import cn.hamster3.mc.plugin.core.velocity.AirGameCorePlugin;
|
import cn.hamster3.mc.plugin.core.velocity.HamsterCorePlugin;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import cn.hamster3.mc.plugin.core.velocity.impl.AudienceProviderImpl;
|
import cn.hamster3.mc.plugin.core.velocity.impl.AudienceProviderImpl;
|
||||||
@@ -58,7 +58,7 @@ public final class CoreVelocityAPI extends CoreAPI {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Logger getLogger() {
|
public @NotNull Logger getLogger() {
|
||||||
return AirGameCorePlugin.getInstance().getLogger();
|
return HamsterCorePlugin.getInstance().getLogger();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
package cn.hamster3.mc.plugin.core.velocity.impl;
|
package cn.hamster3.mc.plugin.core.velocity.impl;
|
||||||
|
|
||||||
import cn.hamster3.mc.plugin.core.velocity.AirGameCorePlugin;
|
import cn.hamster3.mc.plugin.core.velocity.HamsterCorePlugin;
|
||||||
import com.velocitypowered.api.proxy.Player;
|
import com.velocitypowered.api.proxy.Player;
|
||||||
import net.kyori.adventure.audience.Audience;
|
import net.kyori.adventure.audience.Audience;
|
||||||
import net.kyori.adventure.key.Key;
|
import net.kyori.adventure.key.Key;
|
||||||
@@ -23,17 +23,17 @@ public class AudienceProviderImpl implements AudienceProvider {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Audience console() {
|
public @NotNull Audience console() {
|
||||||
return AirGameCorePlugin.getInstance().getProxyServer().getConsoleCommandSource();
|
return HamsterCorePlugin.getInstance().getProxyServer().getConsoleCommandSource();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Audience players() {
|
public @NotNull Audience players() {
|
||||||
return Audience.audience(AirGameCorePlugin.getInstance().getProxyServer().getAllPlayers());
|
return Audience.audience(HamsterCorePlugin.getInstance().getProxyServer().getAllPlayers());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Audience player(@NotNull UUID playerId) {
|
public @NotNull Audience player(@NotNull UUID playerId) {
|
||||||
Player player = AirGameCorePlugin.getInstance().getProxyServer().getPlayer(playerId).orElse(null);
|
Player player = HamsterCorePlugin.getInstance().getProxyServer().getPlayer(playerId).orElse(null);
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
return Audience.empty();
|
return Audience.empty();
|
||||||
}
|
}
|
||||||
|
@@ -2,11 +2,11 @@
|
|||||||
# 完整格式如下:
|
# 完整格式如下:
|
||||||
# redis://用户名:密码@主机名:端口/数据库索引?参数名=参数值&参数名=参数值
|
# redis://用户名:密码@主机名:端口/数据库索引?参数名=参数值&参数名=参数值
|
||||||
# 若没有设置 redis 用户名,但设置了密码,则可以使用以下格式:
|
# 若没有设置 redis 用户名,但设置了密码,则可以使用以下格式:
|
||||||
# redis://密码@localhost:6379/0?clientName=AirGameCore
|
# redis://:密码@localhost:6379?clientName=HamsterCore
|
||||||
# 若没有设置 redis 用户名,也没有设置密码,则可以使用以下格式:
|
# 若没有设置 redis 用户名,也没有设置密码,则可以使用以下格式:
|
||||||
# redis://localhost:6379/0?clientName=AirGameCore
|
# redis://localhost:6379?clientName=HamsterCore
|
||||||
# 若不设置数据库,则默认使用 0
|
# 若不设置数据库,则默认使用 0
|
||||||
redis-url: "redis://localhost:6379/0?clientName=AirGameCore&timeout=5s"
|
redis-url: "redis://localhost:6379/0?clientName=HamsterCore&timeout=5s"
|
||||||
|
|
||||||
datasource:
|
datasource:
|
||||||
# 数据库链接驱动地址
|
# 数据库链接驱动地址
|
||||||
@@ -19,7 +19,7 @@ datasource:
|
|||||||
url: "jdbc:mysql://localhost:3306/Test?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true"
|
url: "jdbc:mysql://localhost:3306/Test?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true"
|
||||||
# 如果你不需要做多端跨服,那么请使用 sqlite 作本地数据库
|
# 如果你不需要做多端跨服,那么请使用 sqlite 作本地数据库
|
||||||
# driver: "org.sqlite.JDBC"
|
# driver: "org.sqlite.JDBC"
|
||||||
# url: "jdbc:sqlite:./plugins/AirGameCore/database.db"
|
# url: "jdbc:sqlite:./plugins/HamsterCore/database.db"
|
||||||
# 用户名
|
# 用户名
|
||||||
username: "root"
|
username: "root"
|
||||||
# 密码
|
# 密码
|
||||||
|
Reference in New Issue
Block a user