SQDLib
一个库,让我无需反复复制粘贴相同的代码
它很轻量
你以为呢?它只有 10 个类?最终构建输出仅约 21.1 KB,因此几乎不会影响你的 jar 包大小
作为管理员使用
如果你的插件 明确说明需要 安装 SQDLib 才能运行,你可以在哪里下载它?你可以从 Modrinth(尚未审核通过)
或 GitHub Releases 获取。但请注意,由于 SQDLib 更新频繁且变化迅速,不同版本之间可能存在兼容性问题,某些版本可能正常工作,而其他版本则可能导致依赖该库的旧版或新版插件出现问题。
使用 SQDLib 进行开发
打包(推荐)
添加仓库
repositories {
maven {
name = "chamosmpRepoReleases"
url = uri("https://maven.chamosmp.net/releases")
}
}
添加依赖项(插件)
plugins {
// 添加 shadow 插件
id("com.gradleup.shadow") version "9.6.1"
}
dependencies {
// 将 3.2.0-BETA 替换为最新版本,并将 "paper" 替换为以下平台之一:
// velocity, bungee, spigot
implementation("com.sqdstudios.sqdlib:sqdlib-paper:3.2.0-BETA")
}
tasks {
// shadowJar 配置
shadowJar {
configurations = project.configurations.runtimeClasspath.map { setOf(it) }
relocate("com.sqdstudios.sqdlib", "(your plugin group).libs.sqdlib")
}
}
添加依赖项(模组)
dependencies {
// 将 3.2.0-BETA 替换为最新版本
implementation("com.sqdstudios.sqdlib:sqdlib-fabric:3.2.0-BETA")
}
模组/插件依赖(不推荐)
添加仓库
repositories {
maven {
name = "chamosmpRepoReleases"
url = uri("https://maven.chamosmp.net/releases")
}
}
添加依赖项(插件)
当使用 paper-plugin.yml 时,请确保设置 join-classpath: true,否则会出现类未找到的异常
dependencies {
// 将 3.2.0-BETA 替换为最新版本,并将 "paper" 替换为以下平台之一:
// velocity, bungee, spigot
compileOnly("com.sqdstudios.sqdlib:sqdlib-paper:3.2.0-BETA")
}
添加依赖项(模组)
dependencies {
// 将 3.2.0-BETA 替换为最新版本
compileOnly("com.sqdstudios.sqdlib:sqdlib-fabric:3.2.0-BETA")
}
从 v3 迁移到 v4
v4 可能是最大的重大版本发布,其中包含一些破坏性变更。
首先,你需要将所有 net.chamosmp 替换为 com.sqdstudios(包括依赖项中的名称)
如果你是从更旧的版本(如 v2)迁移,应删除找不到的包,并让 IDE 为你建议它们,因为这些包没有文档记录
SQDLib
A library so I don't have to copy and paste the same things again and again
It's lightweight
What did you think, it's like only 10 classes? The finished build output is as small as 21,1 Kilobytes so it's not
really going to affect your jar output
Using as an administrator
If you have a plugin which clearly states you need to have SQDLib installed for it to work, where can you download
it? Well you can get it from either Modrinth (Not yet approved)
or GitHub Releases. Warning though because SQDLib changes a lot, very
fast
that can do it that 1 version works while the other just breaks all the plugins which may use an older or newer version
of SQDLib.
Developing with SQDLib
Bundling (Recommended)
Adding the repository
repositories {
maven {
name = "chamosmpRepoReleases"
url = uri("https://maven.chamosmp.net/releases")
}
}
Adding the dependency (Plugin)
plugins {
// Adding the shadow plugin
id("com.gradleup.shadow") version "9.6.1"
}
dependencies {
// Replace 3.2.0-BETA with the latest version, and you can replace "paper", with the following platforms:
// velocity, bungee, spigot
implementation("com.sqdstudios.sqdlib:sqdlib-paper:3.2.0-BETA")
}
tasks {
// The shadowJar configuration
shadowJar {
configurations = project.configurations.runtimeClasspath.map { setOf(it) }
relocate("com.sqdstudios.sqdlib", "(your plugin group).libs.sqdlib")
}
}
Adding the dependency (Mod)
dependencies {
// Replace 3.2.0-BETA with the latest version
implementation("com.sqdstudios.sqdlib:sqdlib-fabric:3.2.0-BETA")
}
Mod/Plugin Dependency (Not Recommended)
Adding the repository
repositories {
maven {
name = "chamosmpRepoReleases"
url = uri("https://maven.chamosmp.net/releases")
}
}
Adding the dependency (Plugin)
When using a paper-plugin.yml, make sure you have join-classpath: true when using this, or else you'll get class not
found exceptions
dependencies {
// Replace 3.2.0-BETA with the latest version, and you can replace "paper", with the following platforms:
// velocity, bungee, spigot
compileOnly("com.sqdstudios.sqdlib:sqdlib-paper:3.2.0-BETA")
}
Adding the dependency (Mod)
dependencies {
// Replace 3.2.0-BETA with the latest version
compileOnly("com.sqdstudios.sqdlib:sqdlib-fabric:3.2.0-BETA")
}
Migrating from v3 to v4
Version 4 is probably the biggest major release and it contains some breaking changes.
You'll first need to replace every instance of net.chamosmp with com.sqdstudios (And in the dependency too)
If you're migrating from even older versions like v2, you should delete the packages that are not found and make your
IDE suggest them to you because they're undocumented
评论 0
登录后参与评分
还没有评论,来抢沙发吧