docs: 修正文档
This commit is contained in:
@@ -27,7 +27,7 @@ public final class CoreBukkitAPI extends CoreAPI {
|
|||||||
@NotNull
|
@NotNull
|
||||||
private final Gson gson;
|
private final Gson gson;
|
||||||
@NotNull
|
@NotNull
|
||||||
private final Gson humanGson;
|
private final Gson gsonHuman;
|
||||||
|
|
||||||
private CoreBukkitAPI(@NotNull ConfigSection config) {
|
private CoreBukkitAPI(@NotNull ConfigSection config) {
|
||||||
super(config);
|
super(config);
|
||||||
@@ -38,7 +38,7 @@ public final class CoreBukkitAPI extends CoreAPI {
|
|||||||
.registerTypeAdapter(MinecraftVersion.getCraftBukkitClassSilent("inventory.CraftItemStack"), ItemStackAdapter.INSTANCE)
|
.registerTypeAdapter(MinecraftVersion.getCraftBukkitClassSilent("inventory.CraftItemStack"), ItemStackAdapter.INSTANCE)
|
||||||
.registerTypeAdapter(PotionEffect.class, PotionEffectAdapter.INSTANCE)
|
.registerTypeAdapter(PotionEffect.class, PotionEffectAdapter.INSTANCE)
|
||||||
.create();
|
.create();
|
||||||
humanGson = new GsonBuilder()
|
gsonHuman = new GsonBuilder()
|
||||||
.registerTypeAdapter(Component.class, ComponentTypeAdapter.INSTANCE)
|
.registerTypeAdapter(Component.class, ComponentTypeAdapter.INSTANCE)
|
||||||
.registerTypeAdapter(DisplayMessage.class, MessageTypeAdapter.INSTANCE)
|
.registerTypeAdapter(DisplayMessage.class, MessageTypeAdapter.INSTANCE)
|
||||||
.registerTypeAdapter(ItemStack.class, ItemStackAdapter.INSTANCE)
|
.registerTypeAdapter(ItemStack.class, ItemStackAdapter.INSTANCE)
|
||||||
@@ -72,8 +72,8 @@ public final class CoreBukkitAPI extends CoreAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Gson getHumanGson() {
|
public @NotNull Gson getGsonHuman() {
|
||||||
return humanGson;
|
return gsonHuman;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
# 完整格式如下:
|
# 完整格式如下:
|
||||||
# redis://用户名:密码@主机名:端口/数据库索引?参数名=参数值&参数名=参数值
|
# redis://用户名:密码@主机名:端口/数据库索引?参数名=参数值&参数名=参数值
|
||||||
# 若没有设置 redis 用户名,但设置了密码,则可以使用以下格式:
|
# 若没有设置 redis 用户名,但设置了密码,则可以使用以下格式:
|
||||||
# redis://密码@localhost:6379/0?clientName=HamsterCore
|
# redis://:密码@localhost:6379?clientName=HamsterCore
|
||||||
# 若没有设置 redis 用户名,也没有设置密码,则可以使用以下格式:
|
# 若没有设置 redis 用户名,也没有设置密码,则可以使用以下格式:
|
||||||
# redis://localhost:6379/0?clientName=HamsterCore
|
# redis://localhost:6379?clientName=HamsterCore
|
||||||
# 若不设置数据库,则默认使用 0
|
# 若不设置数据库,则默认使用 0
|
||||||
redis-url: "redis://localhost:6379/0?clientName=HamsterCore&timeout=5s"
|
redis-url: "redis://localhost:6379/0?clientName=HamsterCore&timeout=5s"
|
||||||
|
|
||||||
|
@@ -61,7 +61,7 @@ public final class CoreBungeeAPI extends CoreAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Gson getHumanGson() {
|
public @NotNull Gson getGsonHuman() {
|
||||||
return humanGson;
|
return humanGson;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2,12 +2,11 @@
|
|||||||
# 完整格式如下:
|
# 完整格式如下:
|
||||||
# redis://用户名:密码@主机名:端口/数据库索引?参数名=参数值&参数名=参数值
|
# redis://用户名:密码@主机名:端口/数据库索引?参数名=参数值&参数名=参数值
|
||||||
# 若没有设置 redis 用户名,但设置了密码,则可以使用以下格式:
|
# 若没有设置 redis 用户名,但设置了密码,则可以使用以下格式:
|
||||||
# redis://密码@localhost:6379?clientName=HamsterCore
|
# redis://:密码@localhost:6379?clientName=HamsterCore
|
||||||
# 若没有设置 redis 用户名,也没有设置密码,则可以使用以下格式:
|
# 若没有设置 redis 用户名,也没有设置密码,则可以使用以下格式:
|
||||||
# redis://localhost:6379?clientName=HamsterCore
|
# redis://localhost:6379?clientName=HamsterCore
|
||||||
# 若不设置数据库,则默认使用 0
|
# 若不设置数据库,则默认使用 0
|
||||||
# 详细信息:https://github.com/lettuce-io/lettuce-core/wiki/Redis-URI-and-connection-details
|
redis-url: "redis://localhost:6379/0?clientName=HamsterCore&timeout=5s"
|
||||||
redis-url: "redis://localhost:6379?clientName=HamsterCore&timeout=5s"
|
|
||||||
|
|
||||||
datasource:
|
datasource:
|
||||||
# 数据库链接驱动地址
|
# 数据库链接驱动地址
|
||||||
|
@@ -11,7 +11,6 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import redis.clients.jedis.JedisPool;
|
import redis.clients.jedis.JedisPool;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
import java.net.URI;
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
@@ -51,7 +50,7 @@ public abstract class CoreAPI {
|
|||||||
scheduledService = Executors.newScheduledThreadPool(1, new NamedThreadFactory("HamsterCore - Scheduler"));
|
scheduledService = Executors.newScheduledThreadPool(1, new NamedThreadFactory("HamsterCore - Scheduler"));
|
||||||
|
|
||||||
getLogger().info("正在创建 Redis 连接池");
|
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 连接池创建完成");
|
getLogger().info("Redis 连接池创建完成");
|
||||||
|
|
||||||
ConfigSection datasourceConfig = config.getSection("datasource");
|
ConfigSection datasourceConfig = config.getSection("datasource");
|
||||||
@@ -112,7 +111,7 @@ public abstract class CoreAPI {
|
|||||||
* @return GSON 工具,会使用格式化输出、且解析中包含null参数
|
* @return GSON 工具,会使用格式化输出、且解析中包含null参数
|
||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
public abstract Gson getHumanGson();
|
public abstract Gson getGsonHuman();
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public abstract AudienceProvider getAudienceProvider();
|
public abstract AudienceProvider getAudienceProvider();
|
||||||
|
Reference in New Issue
Block a user