6 Commits
1.7.2 ... 1.8.1

Author SHA1 Message Date
e937924317 build: 更新版本号
All checks were successful
Publish Project / build (push) Successful in 2m43s
2025-07-10 20:47:03 +08:00
de10bd7feb feat: 允许单独配置 redis-url
All checks were successful
Publish Project / build (push) Successful in 4m23s
2025-07-10 20:40:36 +08:00
1e0417c814 docs: 修正文档
All checks were successful
Publish Project / build (push) Successful in 2m17s
2025-07-03 02:38:54 +08:00
c3b2248c60 ci: 添加自动构建发布配置 2025-07-03 02:37:36 +08:00
25828267f6 feat: 使用 lettuce-core 连接 redis 提升稳定性 2025-07-03 02:36:20 +08:00
95c0a23857 build: 优化构建脚本 2025-03-23 00:46:54 +08:00
14 changed files with 126 additions and 80 deletions

View File

@@ -0,0 +1,29 @@
name: Publish Project
on:
push:
tags:
- "*"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: 21
distribution: temurin
cache: gradle
cache-dependency-path: gradle/wrapper/gradle-wrapper.properties
- name: Build Project
env:
ORG_GRADLE_PROJECT_MAVEN_AIRGAME_USERNAME: ${{ secrets.MAVEN_AIRGAME_USERNAME }}
ORG_GRADLE_PROJECT_MAVEN_AIRGAME_PASSWORD: ${{ secrets.MAVEN_AIRGAME_PASSWORD }}
run: chmod +x gradlew && ./gradlew build publish --no-daemon
- name: Publish to Release
uses: softprops/action-gh-release@v2
with:
files: build/*.jar

View File

@@ -11,8 +11,6 @@
3. 命令行窗口中执行`./gradlew clean build` 3. 命令行窗口中执行`./gradlew clean build`
4. 构建成品在 `build` 文件夹 4. 构建成品在 `build` 文件夹
也可访问我的[Jenkins网站](https://jenkins.airgame.net/job/opensource/job/hamster-ball/)获取最新版
# 安装步骤 # 安装步骤
1. 关闭服务器 1. 关闭服务器
@@ -49,9 +47,9 @@ repositories {
dependencies { dependencies {
// 对于 Bukkit 插件 // 对于 Bukkit 插件
compileOnly("cn.hamster3.mc.plugin:ball-bukkit:1.7.0") compileOnly("cn.hamster3.mc.plugin:ball-bukkit:1.8.1")
// 对于 BungeeCord 插件 // 对于 BungeeCord 插件
compileOnly("cn.hamster3.mc.plugin:ball-bungee:1.7.0") compileOnly("cn.hamster3.mc.plugin:ball-bungee:1.8.1")
} }
``` ```
@@ -77,13 +75,13 @@ dependencies {
<dependency> <dependency>
<groupId>cn.hamster3.mc.plugin</groupId> <groupId>cn.hamster3.mc.plugin</groupId>
<artifactId>ball-bukkit</artifactId> <artifactId>ball-bukkit</artifactId>
<version>1.7.0</version> <version>1.8.1</version>
</dependency> </dependency>
<!--对于 BungeeCord 插件--> <!--对于 BungeeCord 插件-->
<dependency> <dependency>
<groupId>cn.hamster3.mc.plugin</groupId> <groupId>cn.hamster3.mc.plugin</groupId>
<artifactId>ball-bungee</artifactId> <artifactId>ball-bungee</artifactId>
<version>1.7.0</version> <version>1.8.1</version>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>

View File

@@ -20,6 +20,6 @@ tasks {
archiveBaseName = "HamsterBall-Bukkit" archiveBaseName = "HamsterBall-Bukkit"
} }
shadowJar { shadowJar {
destinationDirectory = rootProject.buildDir destinationDirectory = rootProject.layout.buildDirectory
} }
} }

View File

@@ -42,6 +42,11 @@ server-info:
# 不填则自动获取 server.properties 文件中的设置 # 不填则自动获取 server.properties 文件中的设置
# port: 25577 # port: 25577
# Redis 配置
# 如果注释该选项则默认使用 HamsterCore 中的连接配置
# 否则 HamsterBall 将会使用与 HamsterCore 不同的 Redis 链接
# redis-url: redis://localhost:6379/0?clientName=HamsterBall&timeout=5s
# 数据库连接池配置 # 数据库连接池配置
# 如果注释该选项则默认使用 HamsterCore 中的连接池配置 # 如果注释该选项则默认使用 HamsterCore 中的连接池配置
# 否则 HamsterBall 将会使用与 HamsterCore 不同的数据库链接 # 否则 HamsterBall 将会使用与 HamsterCore 不同的数据库链接
@@ -53,9 +58,6 @@ server-info:
# # MySQL数据库链接填写格式: # # MySQL数据库链接填写格式:
# # jdbc:mysql://{数据库地址}:{数据库端口}/{使用的库名}?参数 # # jdbc:mysql://{数据库地址}:{数据库端口}/{使用的库名}?参数
# 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 作本地数据库 ↓
# # driver: "org.sqlite.JDBC"
# # url: "jdbc:sqlite:./plugins/HamsterCore/database.db"
# # 用户名 # # 用户名
# username: "root" # username: "root"
# # 密码 # # 密码

View File

@@ -12,7 +12,7 @@ UPDATE_CHECKER:
CHECK_TYPE: GITEA_RELEASES CHECK_TYPE: GITEA_RELEASES
GIT_BASE_URL: https://git.airgame.net GIT_BASE_URL: https://git.airgame.net
GIT_REPO: MiniDay/hamster-ball GIT_REPO: MiniDay/hamster-ball
DOWNLOAD_URL: https://jenkins.airgame.net/job/opensource/job/hamster-ball/
load: STARTUP load: STARTUP

View File

@@ -18,6 +18,6 @@ tasks {
archiveBaseName = "HamsterBall-BungeeCord" archiveBaseName = "HamsterBall-BungeeCord"
} }
shadowJar { shadowJar {
destinationDirectory = rootProject.buildDir destinationDirectory = rootProject.layout.buildDirectory
} }
} }

View File

@@ -11,7 +11,6 @@ UPDATE_CHECKER:
CHECK_TYPE: GITEA_RELEASES CHECK_TYPE: GITEA_RELEASES
GIT_BASE_URL: https://git.airgame.net GIT_BASE_URL: https://git.airgame.net
GIT_REPO: MiniDay/hamster-ball GIT_REPO: MiniDay/hamster-ball
DOWNLOAD_URL: https://jenkins.airgame.net/job/opensource/job/hamster-ball/
depend: depend:
- HamsterCore - HamsterCore

View File

@@ -33,6 +33,11 @@ server-info:
# 不填则自动设置为 25577 # 不填则自动设置为 25577
port: 25577 port: 25577
# Redis 配置
# 如果注释该选项则默认使用 HamsterCore 中的连接配置
# 否则 HamsterBall 将会使用与 HamsterCore 不同的 Redis 链接
# redis-url: redis://localhost:6379/0?clientName=HamsterBall&timeout=5s
# 数据库连接池配置 # 数据库连接池配置
# 如果注释该选项则默认使用 HamsterCore 中的连接池配置 # 如果注释该选项则默认使用 HamsterCore 中的连接池配置
# 否则 HamsterBall 将会使用与 HamsterCore 不同的数据库链接 # 否则 HamsterBall 将会使用与 HamsterCore 不同的数据库链接

View File

@@ -20,11 +20,14 @@ import cn.hamster3.mc.plugin.core.common.data.DisplayMessage;
import cn.hamster3.mc.plugin.core.common.util.CoreUtils; import cn.hamster3.mc.plugin.core.common.util.CoreUtils;
import com.google.common.eventbus.AsyncEventBus; import com.google.common.eventbus.AsyncEventBus;
import com.google.common.eventbus.EventBus; import com.google.common.eventbus.EventBus;
import io.lettuce.core.RedisClient;
import io.lettuce.core.api.StatefulRedisConnection;
import io.lettuce.core.api.sync.RedisCommands;
import io.lettuce.core.pubsub.StatefulRedisPubSubConnection;
import lombok.Getter; import lombok.Getter;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import redis.clients.jedis.Jedis;
import javax.sql.DataSource; import javax.sql.DataSource;
import java.sql.*; import java.sql.*;
@@ -58,6 +61,8 @@ public abstract class BallAPI {
@NotNull @NotNull
private final DataSource datasource; private final DataSource datasource;
@NotNull @NotNull
private final RedisClient redisClient;
@NotNull
private final BallServerInfo localServerInfo; private final BallServerInfo localServerInfo;
@NotNull @NotNull
@@ -69,7 +74,7 @@ public abstract class BallAPI {
private final Map<UUID, BallPlayerInfo> allPlayerInfo; private final Map<UUID, BallPlayerInfo> allPlayerInfo;
@NotNull @NotNull
private final Jedis redisSub; private final StatefulRedisPubSubConnection<String, String> redisPubSub;
@Nullable @Nullable
private ScheduledFuture<?> lockUpdater; private ScheduledFuture<?> lockUpdater;
@@ -79,6 +84,11 @@ public abstract class BallAPI {
throw new IllegalArgumentException("配置文件中未找到 server-info 节点"); throw new IllegalArgumentException("配置文件中未找到 server-info 节点");
} }
localServerInfo = new BallServerInfo(serverInfoConfig, type); localServerInfo = new BallServerInfo(serverInfoConfig, type);
if (config.hasKey("redis-url")) {
redisClient = RedisClient.create(config.getString("redis-url"));
} else {
redisClient = CoreAPI.getInstance().getRedisClient();
}
ConfigSection section = config.getSection("datasource"); ConfigSection section = config.getSection("datasource");
if (section != null) { if (section != null) {
getLogger().info("启用仓鼠球自定义数据库连接池"); getLogger().info("启用仓鼠球自定义数据库连接池");
@@ -92,7 +102,7 @@ public abstract class BallAPI {
eventBus.register(BallCommonListener.INSTANCE); eventBus.register(BallCommonListener.INSTANCE);
allServerInfo = new ConcurrentHashMap<>(); allServerInfo = new ConcurrentHashMap<>();
allPlayerInfo = new ConcurrentHashMap<>(); allPlayerInfo = new ConcurrentHashMap<>();
redisSub = CoreAPI.getInstance().getJedisPool().getResource(); redisPubSub = getRedisClient().connectPubSub();
getLogger().info("频道前缀: " + ballConfig.getChannelPrefix()); getLogger().info("频道前缀: " + ballConfig.getChannelPrefix());
getLogger().info("启用子服更新玩家状态: " + ballConfig.isGameServerUpdatePlayerInfo()); getLogger().info("启用子服更新玩家状态: " + ballConfig.isGameServerUpdatePlayerInfo());
if (ballConfig.isGameServerUpdatePlayerInfo()) { if (ballConfig.isGameServerUpdatePlayerInfo()) {
@@ -102,29 +112,31 @@ public abstract class BallAPI {
getLogger().warning("已启用调试模式"); getLogger().warning("已启用调试模式");
eventBus.register(BallDebugListener.INSTANCE); eventBus.register(BallDebugListener.INSTANCE);
} }
CoreAPI.getInstance().getExecutorService().submit(() -> redisSub.subscribe(BallRedisListener.INSTANCE, BALL_CHANNEL)); redisPubSub.addListener(BallRedisListener.INSTANCE);
redisPubSub.sync().subscribe(BALL_CHANNEL);
} }
protected void enable() throws SQLException, InterruptedException { protected void enable() throws SQLException, InterruptedException {
try (Jedis jedis = CoreAPI.getInstance().getJedisPool().getResource()) { try (StatefulRedisConnection<String, String> connect = getRedisClient().connect()) {
RedisCommands<String, String> redis = connect.sync();
String key = "HamsterBall:ServerInfo:" + localServerInfo.getId(); String key = "HamsterBall:ServerInfo:" + localServerInfo.getId();
if (jedis.exists(key) && ballConfig.isSingletonServerID()) { if (redis.exists(key) > 0 && ballConfig.isSingletonServerID()) {
throw new IllegalStateException("已经有一个服务器占用了该 ID"); throw new IllegalStateException("已经有一个服务器占用了该 ID");
} }
jedis.hset(key, "id", localServerInfo.getId()); redis.hset(key, "id", localServerInfo.getId());
jedis.hset(key, "name", localServerInfo.getName()); redis.hset(key, "name", localServerInfo.getName());
jedis.hset(key, "type", localServerInfo.getType().name()); redis.hset(key, "type", localServerInfo.getType().name());
jedis.hset(key, "host", localServerInfo.getHost()); redis.hset(key, "host", localServerInfo.getHost());
jedis.hset(key, "port", String.valueOf(localServerInfo.getPort())); redis.hset(key, "port", String.valueOf(localServerInfo.getPort()));
jedis.expire(key, 180); redis.expire(key, 180);
lockUpdater = CoreAPI.getInstance().getScheduledService().scheduleAtFixedRate(LockUpdateThread.INSTANCE, 1, 1, TimeUnit.MINUTES); lockUpdater = CoreAPI.getInstance().getScheduledService().scheduleAtFixedRate(LockUpdateThread.INSTANCE, 1, 1, TimeUnit.MINUTES);
for (String serverInfoKey : jedis.keys("HamsterBall:ServerInfo:*")) { for (String serverInfoKey : redis.keys("HamsterBall:ServerInfo:*")) {
BallServerInfo info = new BallServerInfo( BallServerInfo info = new BallServerInfo(
jedis.hget(serverInfoKey, "id"), redis.hget(serverInfoKey, "id"),
jedis.hget(serverInfoKey, "name"), redis.hget(serverInfoKey, "name"),
BallServerType.valueOf(jedis.hget(serverInfoKey, "type")), BallServerType.valueOf(redis.hget(serverInfoKey, "type")),
jedis.hget(serverInfoKey, "host"), redis.hget(serverInfoKey, "host"),
Integer.parseInt(jedis.hget(serverInfoKey, "port")) Integer.parseInt(redis.hget(serverInfoKey, "port"))
); );
allServerInfo.put(info.getId(), info); allServerInfo.put(info.getId(), info);
} }
@@ -192,9 +204,10 @@ public abstract class BallAPI {
if (lockUpdater != null) { if (lockUpdater != null) {
lockUpdater.cancel(true); lockUpdater.cancel(true);
lockUpdater = null; lockUpdater = null;
try (Jedis jedis = CoreAPI.getInstance().getJedisPool().getResource()) { try (StatefulRedisConnection<String, String> connect = getRedisClient().connect()) {
RedisCommands<String, String> redis = connect.sync();
String key = "HamsterBall:ServerInfo:" + localServerInfo.getId(); String key = "HamsterBall:ServerInfo:" + localServerInfo.getId();
jedis.del(key); redis.del(key);
} }
} }
try (Connection connection = getDatasource().getConnection()) { try (Connection connection = getDatasource().getConnection()) {
@@ -206,7 +219,7 @@ public abstract class BallAPI {
statement.executeUpdate(); statement.executeUpdate();
} }
} }
redisSub.close(); redisPubSub.close();
} }
/** /**
@@ -488,16 +501,12 @@ public abstract class BallAPI {
channel = ballConfig.getChannelPrefix() + channel; channel = ballConfig.getChannelPrefix() + channel;
} }
if (block) { if (block) {
try (Jedis jedis = CoreAPI.getInstance().getJedisPool().getResource()) { redisPubSub.sync().publish(channel, CoreAPI.getInstance().getGson().toJson(message));
jedis.publish(channel, CoreAPI.getInstance().getGson().toJson(message));
}
eventBus.post(new MessageSentEvent(channel, message)); eventBus.post(new MessageSentEvent(channel, message));
} else { } else {
@NotNull String finalChannel = channel; @NotNull String finalChannel = channel;
CoreAPI.getInstance().getExecutorService().submit(() -> { CoreAPI.getInstance().getExecutorService().execute(() -> {
try (Jedis jedis = CoreAPI.getInstance().getJedisPool().getResource()) { redisPubSub.sync().publish(finalChannel, CoreAPI.getInstance().getGson().toJson(message));
jedis.publish(finalChannel, CoreAPI.getInstance().getGson().toJson(message));
}
eventBus.post(new MessageSentEvent(finalChannel, message)); eventBus.post(new MessageSentEvent(finalChannel, message));
}); });
} }
@@ -523,14 +532,7 @@ public abstract class BallAPI {
* @param channels 频道名称 * @param channels 频道名称
*/ */
public void subscribeRaw(@NotNull String... channels) { public void subscribeRaw(@NotNull String... channels) {
BallRedisListener.INSTANCE.subscribe(channels); redisPubSub.sync().subscribe(channels);
// CoreAPI.getInstance().getExecutorService().submit(() -> {
// try {
// redisSub.subscribe(BallRedisListener.INSTANCE, channels);
// } catch (Exception | Error e) {
// e.printStackTrace();
// }
// });
} }
/** /**
@@ -539,10 +541,7 @@ public abstract class BallAPI {
* @param patterns 频道名称正则表达式 * @param patterns 频道名称正则表达式
*/ */
public void subscribePatterns(@NotNull String patterns) { public void subscribePatterns(@NotNull String patterns) {
BallRedisListener.INSTANCE.psubscribe(patterns); redisPubSub.sync().psubscribe(patterns);
// CoreAPI.getInstance().getExecutorService().submit(
// () -> redisSub.psubscribe(BallRedisListener.INSTANCE, patterns)
// );
} }
/** /**
@@ -565,7 +564,7 @@ public abstract class BallAPI {
* @param channels 频道名称 * @param channels 频道名称
*/ */
public void unsubscribeRaw(@NotNull String... channels) { public void unsubscribeRaw(@NotNull String... channels) {
BallRedisListener.INSTANCE.unsubscribe(channels); redisPubSub.sync().unsubscribe(channels);
} }
/** /**
@@ -574,7 +573,7 @@ public abstract class BallAPI {
* @param patterns 频道名称正则表达式 * @param patterns 频道名称正则表达式
*/ */
public void unsubscribePatterns(@NotNull String patterns) { public void unsubscribePatterns(@NotNull String patterns) {
BallRedisListener.INSTANCE.punsubscribe(patterns); redisPubSub.sync().punsubscribe(patterns);
} }
@NotNull @NotNull

View File

@@ -5,18 +5,17 @@ import cn.hamster3.mc.plugin.ball.common.data.BallMessage;
import cn.hamster3.mc.plugin.ball.common.event.message.MessageReceivedEvent; import cn.hamster3.mc.plugin.ball.common.event.message.MessageReceivedEvent;
import cn.hamster3.mc.plugin.core.common.api.CoreAPI; import cn.hamster3.mc.plugin.core.common.api.CoreAPI;
import com.google.common.eventbus.EventBus; import com.google.common.eventbus.EventBus;
import redis.clients.jedis.JedisPubSub; import io.lettuce.core.pubsub.RedisPubSubListener;
import java.util.logging.Level; import java.util.logging.Level;
public class BallRedisListener extends JedisPubSub { public class BallRedisListener implements RedisPubSubListener<String, String> {
public static final BallRedisListener INSTANCE = new BallRedisListener(); public static final BallRedisListener INSTANCE = new BallRedisListener();
private BallRedisListener() { private BallRedisListener() {
} }
@Override public void handle(String channel, String message) {
public void onMessage(String channel, String message) {
CoreAPI.getInstance().getExecutorService().submit(() -> { CoreAPI.getInstance().getExecutorService().submit(() -> {
try { try {
String finalChannel = channel; String finalChannel = channel;
@@ -40,27 +39,32 @@ public class BallRedisListener extends JedisPubSub {
} }
@Override @Override
public void onPMessage(String pattern, String channel, String message) { public void message(String channel, String message) {
onMessage(channel, message); handle(channel, message);
} }
@Override @Override
public void onSubscribe(String channel, int subscribedChannels) { public void message(String pattern, String channel, String message) {
handle(channel, message);
}
@Override
public void subscribed(String channel, long count) {
BallAPI.getInstance().getLogger().info("已订阅 redis 频道 " + channel); BallAPI.getInstance().getLogger().info("已订阅 redis 频道 " + channel);
} }
@Override @Override
public void onUnsubscribe(String channel, int subscribedChannels) { public void psubscribed(String pattern, long count) {
BallAPI.getInstance().getLogger().info("已取消订阅 redis 频道 " + channel);
}
@Override
public void onPSubscribe(String pattern, int subscribedChannels) {
BallAPI.getInstance().getLogger().info("已订阅 redis 频道(正则) " + pattern); BallAPI.getInstance().getLogger().info("已订阅 redis 频道(正则) " + pattern);
} }
@Override @Override
public void onPUnsubscribe(String pattern, int subscribedChannels) { public void unsubscribed(String channel, long count) {
BallAPI.getInstance().getLogger().info("已取消订阅 redis 频道 " + channel);
}
@Override
public void punsubscribed(String pattern, long count) {
BallAPI.getInstance().getLogger().info("已取消订阅 redis 频道(正则) " + pattern); BallAPI.getInstance().getLogger().info("已取消订阅 redis 频道(正则) " + pattern);
} }
} }

View File

@@ -1,8 +1,8 @@
package cn.hamster3.mc.plugin.ball.common.thread; package cn.hamster3.mc.plugin.ball.common.thread;
import cn.hamster3.mc.plugin.ball.common.api.BallAPI; import cn.hamster3.mc.plugin.ball.common.api.BallAPI;
import cn.hamster3.mc.plugin.core.common.api.CoreAPI; import io.lettuce.core.api.StatefulRedisConnection;
import redis.clients.jedis.Jedis; import io.lettuce.core.api.sync.RedisCommands;
public class LockUpdateThread implements Runnable { public class LockUpdateThread implements Runnable {
public static final LockUpdateThread INSTANCE = new LockUpdateThread(); public static final LockUpdateThread INSTANCE = new LockUpdateThread();
@@ -13,8 +13,9 @@ public class LockUpdateThread implements Runnable {
@Override @Override
public void run() { public void run() {
String key = "HamsterBall:ServerInfo:" + BallAPI.getInstance().getLocalServerInfo().getId(); String key = "HamsterBall:ServerInfo:" + BallAPI.getInstance().getLocalServerInfo().getId();
try (Jedis jedis = CoreAPI.getInstance().getJedisPool().getResource()) { try (StatefulRedisConnection<String, String> connect = BallAPI.getInstance().getRedisClient().connect()) {
jedis.expire(key, 180); RedisCommands<String, String> redis = connect.sync();
redis.expire(key, 180);
} }
} }
} }

View File

@@ -33,6 +33,11 @@ server-info:
# 不填则自动设置为 25577 # 不填则自动设置为 25577
port: 25577 port: 25577
# Redis 配置
# 如果注释该选项则默认使用 HamsterCore 中的连接配置
# 否则 HamsterBall 将会使用与 HamsterCore 不同的 Redis 链接
# redis-url: redis://localhost:6379/0?clientName=HamsterBall&timeout=5s
# 数据库连接池配置 # 数据库连接池配置
# 如果注释该选项则默认使用 HamsterCore 中的连接池配置 # 如果注释该选项则默认使用 HamsterCore 中的连接池配置
# 否则 HamsterBall 将会使用与 HamsterCore 不同的数据库链接 # 否则 HamsterBall 将会使用与 HamsterCore 不同的数据库链接

View File

@@ -2,4 +2,3 @@ VERSION: ${version}
CHECK_TYPE: GITEA_RELEASES CHECK_TYPE: GITEA_RELEASES
GIT_BASE_URL: https://git.airgame.net GIT_BASE_URL: https://git.airgame.net
GIT_REPO: MiniDay/hamster-ball GIT_REPO: MiniDay/hamster-ball
DOWNLOAD_URL: https://jenkins.airgame.net/job/opensource/job/hamster-ball/

View File

@@ -1,18 +1,24 @@
buildscript {
repositories {
maven("https://maven.airgame.net/maven-public/")
}
}
plugins { plugins {
id("java-library") id("java-library")
id("maven-publish") id("maven-publish")
id("com.github.johnrengelman.shadow") version "8+" id("com.gradleup.shadow") version "8.3.6"
} }
group = "cn.hamster3.mc.plugin" group = "cn.hamster3.mc.plugin"
version = "1.7.2" version = "1.8.1"
description = "基于 Redis 的 Minecraft 服务端通用消息中间件" description = "基于 Redis 的 Minecraft 服务端通用消息中间件"
subprojects { subprojects {
apply { apply {
plugin("java-library") plugin("java-library")
plugin("maven-publish") plugin("maven-publish")
plugin("com.github.johnrengelman.shadow") plugin("com.gradleup.shadow")
} }
group = rootProject.group group = rootProject.group
@@ -59,10 +65,9 @@ subprojects {
repositories { repositories {
maven { maven {
url = uri("https://maven.airgame.net/public") url = uri("https://maven.airgame.net/public")
credentials { credentials {
username = rootProject.properties.getOrDefault("maven_username", "").toString() username = findProperty("MAVEN_AIRGAME_USERNAME")?.toString() ?: ""
password = rootProject.properties.getOrDefault("maven_password", "").toString() password = findProperty("MAVEN_AIRGAME_PASSWORD")?.toString() ?: ""
} }
} }
} }