Skip to content

Commit

Permalink
feat(config): add permission support and rename server tag
Browse files Browse the repository at this point in the history
Add permission support configuration in BotConfig and rename the server tag
from "主服" to "main" for consistency. Also, refactor the build.gradle files
to include shadowJar configurations and relocate dependencies to preventconflicts. The mod version has been updated to 2.3.0.
  • Loading branch information
cnlimiter committed Aug 14, 2024
1 parent db3f79a commit 230bd22
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 8 deletions.
1 change: 1 addition & 0 deletions Common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ dependencies {
annotationProcessor ("org.projectlombok:lombok:$lombok_version")
implementation ("cn.evole.onebot:OneBot-Client:$onebot_client_version"){transitive = false}
implementation ("org.spongepowered:configurate-yaml:$yaml_version")
implementation ("org.yaml:snakeyaml:1.28")
implementation("com.github.houbb:csv:0.2.0")
implementation ("com.google.code.findbugs:jsr305:3.0.1")
}
19 changes: 19 additions & 0 deletions Common/src/main/java/cn/evole/mods/mcbot/api/cmd/Cmd.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package cn.evole.mods.mcbot.api.cmd;

import lombok.Getter;

import java.util.List;

/**
* @Project: McBot
* @Author: cnlimiter
* @CreateTime: 2024/8/14 13:04
* @Description:
*/
@Getter
public class Cmd {
private String cmd;
private List<String> alies;
private List<String> allow_members;
private String permission;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
@Setter
@ConfigSerializable
public class BotConfig {
@Comment("跨服支持")
private String tag = "主服";
@Comment("跨服支持,权限支持")
private String tag = "main";
@Comment("地址(支持域名和ipv6)")
private String url = "ws://127.0.0.1:8080";
@Comment("鉴权")
Expand Down
23 changes: 23 additions & 0 deletions Common/src/main/java/cn/evole/mods/mcbot/core/cmd/CmdHandler.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package cn.evole.mods.mcbot.core.cmd;

import cn.evole.mods.mcbot.api.cmd.Cmd;
import org.yaml.snakeyaml.Yaml;

import java.util.ArrayList;
import java.util.List;

/**
* @Project: McBot
* @Author: cnlimiter
* @CreateTime: 2024/8/14 13:19
* @Description:
*/
public class CmdHandler {

public static List<Cmd> cmds = new ArrayList<>();

public static void load() {
Yaml yaml = new Yaml();
}

}
37 changes: 33 additions & 4 deletions Fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import net.darkhax.curseforgegradle.TaskPublishCurseForge

plugins {
id 'fabric-loom' version '1.7.+'
id 'com.github.johnrengelman.shadow'
}

base {
Expand All @@ -11,6 +12,13 @@ base {

println "Fabric API: $fabric_version, Loader: $fabric_loader_version"

configurations {
shadowBundle {
canBeResolved = true
canBeConsumed = false
}
}

loom {
runs {
configureEach {
Expand Down Expand Up @@ -53,16 +61,37 @@ dependencies {
modImplementation "net.fabricmc:fabric-loader:$fabric_loader_version"
modImplementation "net.fabricmc.fabric-api:fabric-api:$fabric_version"

implementation include("cn.evole.onebot:OneBot-Client:$onebot_client_version"){transitive = false}
implementation include("org.spongepowered:configurate-yaml:$yaml_version")
implementation include("com.github.houbb:csv:0.2.0")
implementation shadowBundle("cn.evole.onebot:OneBot-Client:$onebot_client_version"){transitive = false}
implementation shadowBundle("org.spongepowered:configurate-yaml:$yaml_version"){transitive = true}
implementation shadowBundle("com.github.houbb:csv:0.2.0")
implementation ("org.yaml:snakeyaml:1.28")

compileOnly "org.projectlombok:lombok:$lombok_version"
annotationProcessor "org.projectlombok:lombok:$lombok_version"
}

shadowJar {
configurations = [project.configurations.shadowBundle]
archiveClassifier.set("")

relocate 'org.yaml', 'cn.evole.dependencies.yaml'
relocate 'org.spongepowered', 'cn.evole.dependencies.spongepowered'
relocate 'io.leangen', 'cn.evole.dependencies.leagen'
relocate 'org.checkerframework', 'cn.evole.dependencies.checkerframework'
relocate 'com.google.errorprone', 'cn.evole.dependencies.errorprone'
relocate 'org.apiguardian', 'cn.evole.dependencies.apiguardian'
relocate 'com.github.houbb', 'cn.evole.dependencies.houbb'
}

remapJar {
input.set shadowJar.archiveFile
dependsOn shadowJar
}

sourcesJar {
from project(':Common').sourceSets.main.allSource
def commonSources = project(":Common").sourcesJar
dependsOn commonSources
from commonSources.archiveFile.map { zipTree(it) }
}

artifacts {
Expand Down
8 changes: 7 additions & 1 deletion Forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
id 'net.minecraftforge.gradle' version '6.+'
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
id 'org.spongepowered.mixin' version '0.7-SNAPSHOT'
id 'com.github.johnrengelman.shadow'
}

base {
Expand Down Expand Up @@ -89,7 +90,12 @@ dependencies {

library ("cn.evole.onebot:OneBot-Client:$onebot_client_version"){transitive = false}
library ("org.spongepowered:configurate-yaml:$yaml_version")
library("com.github.houbb:csv:0.2.0")
library ("com.github.houbb:csv:0.2.0")
jarJar("cn.evole.onebot:OneBot-Client:[$onebot_client_version,)"){transitive = false}
jarJar("org.spongepowered:configurate-yaml:[$yaml_version,)")
jarJar("com.github.houbb:csv:[0.2.0,)")

implementation ("org.yaml:snakeyaml:1.28")

compileOnly "org.projectlombok:lombok:$lombok_version"
annotationProcessor "org.projectlombok:lombok:$lombok_version"
Expand Down
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins {
id 'com.modrinth.minotaur' version '2.+' apply false
id 'io.freefair.lombok' version '8.+' apply false
id 'net.neoforged.gradleutils' version '3.+'
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
}

gradleutils.version {
Expand Down Expand Up @@ -63,7 +64,7 @@ subprojects {
from project(':Common').sourceSets.main.resources

var replaceProperties = [
'mod_version' : version,
'mod_version' : mod_version,
"minecraft_version" : minecraft_version,
"forge_version" : forge_version,
"forge_loader_version_range" : forge_loader_version_range,
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ description=Adds chat linking between QQ and Minecraft and QQ commands to reques
minecraft_version_range=[1.20, 1.21)
minecraft_version=1.20.1
mod_version_label=beta
mod_version=2.3.0

# Mappings
mappings_channel = parchment
Expand Down

0 comments on commit 230bd22

Please sign in to comment.