Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle

name: Java CI with Gradle

on:
push:
branches: [ "release", "develop" ]
pull_request:
branches: [ "release", "develop" ]

jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read

steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies.
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
- name: Setup Gradle
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
# 添加权限修复步骤
- name: Set gradlew executable
run: chmod +x gradlew

- name: Build with Gradle Wrapper
run: ./gradlew build

# NOTE: The Gradle Wrapper is the default and recommended way to run Gradle (https://docs.gradle.org/current/userguide/gradle_wrapper.html).
# If your project does not have the Gradle Wrapper configured, you can use the following configuration to run Gradle with a specified version.
#
# - name: Setup Gradle
# uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
# with:
# gradle-version: '8.9'
#
# - name: Build with Gradle 8.9
# run: gradle build

dependency-submission:

runs-on: ubuntu-latest
permissions:
contents: write

steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

# Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies.
# See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md
- name: Generate and submit dependency graph
uses: gradle/actions/dependency-submission@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ dependencies {
testImplementation platform('org.junit:junit-bom:5.10.0')
testImplementation 'org.junit.jupiter:junit-jupiter'
implementation group: 'org.slf4j', name: 'slf4j-api', version: '2.0.16'
implementation 'org.apache.logging.log4j:log4j-slf4j2-impl:2.20.0'
}
shadowJar {
destinationDirectory = file('output')
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

project_group ='com.r3944realms.dg_lab'
project_version=2.0.1.7
project_version=2.2.8.16
2 changes: 0 additions & 2 deletions sc/gradle.properties

This file was deleted.

24 changes: 21 additions & 3 deletions src/main/java/com/r3944realms/dg_lab/DgLab.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*******************************************************************************
* Copyright (c) 2024-2025 R3944Realms. All rights reserved.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/

package com.r3944realms.dg_lab;

import io.netty.handler.logging.LogLevel;
Expand All @@ -12,14 +28,16 @@ public class DgLab {
*/
public static LoggingHandler LOGGING_HANDLER = new LoggingHandler(LogLevel.DEBUG);


/**
* Instantiates a new Dg lab.
* Sets logging handler level.
*
* @param level Netty日志级别()
* @param level the level
*/
public DgLab(LogLevel level) {
public void setLoggingHandlerLevel(LogLevel level) {
LOGGING_HANDLER = new LoggingHandler(level);
}



}
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*******************************************************************************
* Copyright (c) 2024-2025 R3944Realms. All rights reserved.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/

package com.r3944realms.dg_lab.api.dataType;

import com.r3944realms.dg_lab.websocket.message.data.type.PowerBoxDataType;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*******************************************************************************
* Copyright (c) 2024-2025 R3944Realms. All rights reserved.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/

package com.r3944realms.dg_lab.api.dataType;

import com.r3944realms.dg_lab.websocket.message.data.type.PowerBoxDataType;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,57 @@
/*******************************************************************************
* Copyright (c) 2024-2025 R3944Realms. All rights reserved.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/

package com.r3944realms.dg_lab.api.handler;

import com.r3944realms.dg_lab.websocket.message.data.PowerBoxData;

/**
* The interface Client operation.
*/
public interface ClientOperation {
public interface ClientOperation extends IOperation {
/**
* 客户端线程开启中处理
*/
void ClientStartingHandler();

/**
* 客户端线程完全开启后处理
*/
void ClientStartedHandler();

/**
* 客户端启动遇到错误后处理
*/
void ClientStartingErrorHandler();

/**
* 客户端线程关闭中处理
*/
void ClientStoppingHandler();

/**
* 客户端线程关闭中遇到错误后处理
*/
void ClientStoppingErrorHandler();

/**
* 客户端线程完全关闭后处理
*/
void ClientStoppedHandler();

/**
* 接收一个参数,实现二维码生成
*
Expand Down
23 changes: 23 additions & 0 deletions src/main/java/com/r3944realms/dg_lab/api/handler/IOperation.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*******************************************************************************
* Copyright (c) 2024-2025 R3944Realms. All rights reserved.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/

package com.r3944realms.dg_lab.api.handler;

/**
* The interface Operation.
*/
public interface IOperation {
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,59 @@
/*******************************************************************************
* Copyright (c) 2024-2025 R3944Realms. All rights reserved.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/

package com.r3944realms.dg_lab.api.handler;

import com.r3944realms.dg_lab.websocket.message.PowerBoxMessage;
import org.jetbrains.annotations.Nullable;

/**
* The interface Server operation.
*/
public interface ServerOperation {
public interface ServerOperation extends IOperation {

/**
* 服务器线程开启中通知
*/
void ServerStartingHandler();

/**
* 服务器线程开启中遇到错误后处理
*/
void ServerStartingErrorHandler();

/**
* 服务器线程开启后处理
*/
void ServerStartedHandler();

/**
* 服务器线程关闭中处理后通知
*/
void ServerStoppingHandler();

/**
* 服务器线程关闭中遇到错误后处理
*/
void ServerStoppingErrorHandler();

/**
* 服务器线程完全关闭后处理
*/
void ServerStoppedHandler();

/**
* 在定时器里即将被移除的UUID处理
*
Expand Down Expand Up @@ -75,7 +123,18 @@ public interface ServerOperation {
* @param clearMessage 清理信息
* @param pulseMessage 波形消息
*/
void PulseClientMessageHandler(final PowerBoxMessage clearMessage, final PowerBoxMessage pulseMessage);
default void PulseClientMessageHandler(final PowerBoxMessage clearMessage, final PowerBoxMessage pulseMessage) {
PulseClientMessageHandler(clearMessage, 500, pulseMessage);
}

/**
* 波形信息由客户端下发处理
*
* @param clearMessage 清理信息
* @param delayTime 延迟时间
* @param pulseMessage 波形消息
*/
void PulseClientMessageHandler(@Nullable final PowerBoxMessage clearMessage, final int delayTime, final PowerBoxMessage pulseMessage);

/**
* 连接断开消息处理
Expand Down
Loading
Loading