docs: 修正文档

This commit is contained in:
2024-03-16 10:12:57 +08:00
parent 9e34dd5d54
commit 78574d692e
5 changed files with 11 additions and 13 deletions

View File

@@ -27,7 +27,7 @@ public final class CoreBukkitAPI extends CoreAPI {
@NotNull
private final Gson gson;
@NotNull
private final Gson humanGson;
private final Gson gsonHuman;
private CoreBukkitAPI(@NotNull ConfigSection config) {
super(config);
@@ -38,7 +38,7 @@ public final class CoreBukkitAPI extends CoreAPI {
.registerTypeAdapter(MinecraftVersion.getCraftBukkitClassSilent("inventory.CraftItemStack"), ItemStackAdapter.INSTANCE)
.registerTypeAdapter(PotionEffect.class, PotionEffectAdapter.INSTANCE)
.create();
humanGson = new GsonBuilder()
gsonHuman = new GsonBuilder()
.registerTypeAdapter(Component.class, ComponentTypeAdapter.INSTANCE)
.registerTypeAdapter(DisplayMessage.class, MessageTypeAdapter.INSTANCE)
.registerTypeAdapter(ItemStack.class, ItemStackAdapter.INSTANCE)
@@ -72,8 +72,8 @@ public final class CoreBukkitAPI extends CoreAPI {
}
@Override
public @NotNull Gson getHumanGson() {
return humanGson;
public @NotNull Gson getGsonHuman() {
return gsonHuman;
}
@Override

View File

@@ -2,9 +2,9 @@
# 完整格式如下:
# redis://用户名:密码@主机名:端口/数据库索引?参数名=参数值&参数名=参数值
# 若没有设置 redis 用户名,但设置了密码,则可以使用以下格式:
# redis://密码@localhost:6379/0?clientName=HamsterCore
# redis://:密码@localhost:6379?clientName=HamsterCore
# 若没有设置 redis 用户名,也没有设置密码,则可以使用以下格式:
# redis://localhost:6379/0?clientName=HamsterCore
# redis://localhost:6379?clientName=HamsterCore
# 若不设置数据库,则默认使用 0
redis-url: "redis://localhost:6379/0?clientName=HamsterCore&timeout=5s"

View File

@@ -61,7 +61,7 @@ public final class CoreBungeeAPI extends CoreAPI {
}
@Override
public @NotNull Gson getHumanGson() {
public @NotNull Gson getGsonHuman() {
return humanGson;
}

View File

@@ -2,12 +2,11 @@
# 完整格式如下:
# redis://用户名:密码@主机名:端口/数据库索引?参数名=参数值&参数名=参数值
# 若没有设置 redis 用户名,但设置了密码,则可以使用以下格式:
# redis://密码@localhost:6379?clientName=HamsterCore
# redis://:密码@localhost:6379?clientName=HamsterCore
# 若没有设置 redis 用户名,也没有设置密码,则可以使用以下格式:
# redis://localhost:6379?clientName=HamsterCore
# 若不设置数据库,则默认使用 0
# 详细信息https://github.com/lettuce-io/lettuce-core/wiki/Redis-URI-and-connection-details
redis-url: "redis://localhost:6379?clientName=HamsterCore&timeout=5s"
redis-url: "redis://localhost:6379/0?clientName=HamsterCore&timeout=5s"
datasource:
# 数据库链接驱动地址

View File

@@ -11,7 +11,6 @@ import org.jetbrains.annotations.NotNull;
import redis.clients.jedis.JedisPool;
import javax.sql.DataSource;
import java.net.URI;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.concurrent.ExecutorService;
@@ -51,7 +50,7 @@ public abstract class CoreAPI {
scheduledService = Executors.newScheduledThreadPool(1, new NamedThreadFactory("HamsterCore - Scheduler"));
getLogger().info("正在创建 Redis 连接池");
jedisPool = new JedisPool(URI.create(config.getString("redis-url", "redis://localhost:6379/0?clientName=HamsterCore&timeout=5s")));
jedisPool = new JedisPool(config.getString("redis-url"));
getLogger().info("Redis 连接池创建完成");
ConfigSection datasourceConfig = config.getSection("datasource");
@@ -112,7 +111,7 @@ public abstract class CoreAPI {
* @return GSON 工具会使用格式化输出、且解析中包含null参数
*/
@NotNull
public abstract Gson getHumanGson();
public abstract Gson getGsonHuman();
@NotNull
public abstract AudienceProvider getAudienceProvider();