Skip to content

Commit

Permalink
更新上游
Browse files Browse the repository at this point in the history
支持1.20.1
  • Loading branch information
Iseason2000 authored and Iseason2000 committed Aug 12, 2023
1 parent 25a7766 commit b0426f6
Show file tree
Hide file tree
Showing 13 changed files with 73 additions and 49 deletions.
35 changes: 25 additions & 10 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath("com.guardsquare:proguard-gradle:7.3.2")
classpath("com.guardsquare:proguard-gradle:7.4.0-beta01")
}
}

Expand Down Expand Up @@ -53,18 +53,33 @@ subprojects {

dependencies {
val kotlinVersion: String by rootProject
val exposedVersion: String by rootProject
val nbtEditorVersion: String by rootProject

compileOnly(platform("org.jetbrains.kotlin:kotlin-bom:$kotlinVersion"))
compileOnly("org.spigotmc:spigot-api:1.19.4-R0.1-SNAPSHOT")
//基础库
compileOnly(kotlin("stdlib"))
// 数据库
val exposedVersion: String by rootProject
val nbtEditorVersion: String by rootProject
compileOnly("org.spigotmc:spigot-api:1.20.1-R0.1-SNAPSHOT")
compileOnly("me.clip:placeholderapi:2.11.3")
implementation("io.github.bananapuncher714:nbteditor:$nbtEditorVersion")
compileOnly("org.jetbrains.exposed:exposed-core:$exposedVersion")
compileOnly("org.jetbrains.exposed:exposed-dao:$exposedVersion")
compileOnly("org.jetbrains.exposed:exposed-jdbc:$exposedVersion")
compileOnly("org.jetbrains.exposed:exposed-java-time:$exposedVersion")

// 数据库
compileOnly("org.jetbrains.exposed:exposed-core:$exposedVersion") {
isTransitive = false
targetConfiguration = "runtime"
}
compileOnly("org.jetbrains.exposed:exposed-dao:$exposedVersion") {
isTransitive = false
targetConfiguration = "runtime"
}
compileOnly("org.jetbrains.exposed:exposed-jdbc:$exposedVersion") {
isTransitive = false
targetConfiguration = "runtime"
}
compileOnly("org.jetbrains.exposed:exposed-java-time:$exposedVersion") {
isTransitive = false
targetConfiguration = "runtime"
}
compileOnly("com.zaxxer:HikariCP:4.0.3")
}

Expand All @@ -90,4 +105,4 @@ repositories {
dependencies {
//基础库
compileOnly(kotlin("stdlib"))
}
}
1 change: 0 additions & 1 deletion core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ dependencies {
// compileOnly("org.spigotmc:spigot-api:1.19.4-R0.1-SNAPSHOT")
dokkaHtmlPlugin("org.jetbrains.dokka:kotlin-as-java-plugin:1.8.10")

compileOnly("me.clip:placeholderapi:2.11.3")
compileOnly("net.kyori:adventure-text-minimessage:4.13.0")
compileOnly("net.kyori:adventure-platform-bukkit:4.3.0")
implementation("org.bstats:bstats-bukkit:3.0.1")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,6 @@ public static RuntimeManager getRuntimeManager() {
return runtimeManager;
}

/**
* 获取Bukkit插件主类
*
* @return Bukkit插件主类
*/
public static JavaPlugin getPlugin() {
return plugin;
}

/**
* 加载插件主类
*/
Expand All @@ -70,6 +61,15 @@ private BukkitPlugin loadInstance() {
}
}

/**
* 获取Bukkit插件主类
*
* @return Bukkit插件主类
*/
public static JavaPlugin getPlugin() {
return plugin;
}

/**
* 遍历寻找插件入口类 继承 BukkitPlugin
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ public static Builder builder() {
}

public static class Builder {
private final List<String> assemblyDependencies = new LinkedList<>();
private final List<String> excludeDependencies = new LinkedList<>();
private ClassLoader classLoader;
private File storagePath = new File("libraries");
private List<String> repositories = new LinkedList<>();
private List<String> dependencies = new LinkedList<>();
private final List<String> assemblyDependencies = new LinkedList<>();
private final List<String> excludeDependencies = new LinkedList<>();
private boolean isParallel = false;
private Logger logger = Logger.getLogger(RuntimeManager.class.getSimpleName());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public class RuntimeManager {
*/
private final Set<String> parallel = new HashSet<>();
private final ClassAppender classAppender;
private final boolean isParallel;
/**
* 下载源
*/
Expand All @@ -51,6 +50,7 @@ public class RuntimeManager {
* maxDepth表示最大依赖解析层数
*/
public Map<String, Integer> dependencies;
private final boolean isParallel;

public RuntimeManager(File parent, ClassAppender classAppender, List<String> repositories, List<String> dependencies, List<String> assembly, boolean isParallel) {
this(parent, classAppender, repositories, new LinkedHashMap<>(), assembly, isParallel);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundE
}
}

@Override
public void addURL(URL url) {
super.addURL(url);
}

public static void addBlackList(Class<?> clazz) {
BLACK_LIST.add(clazz.getName());
List<String> subClasses = Arrays.stream(clazz.getDeclaredClasses()).map(Class::getName).collect(Collectors.toList());
BLACK_LIST.addAll(subClasses);
}

@Override
public void addURL(URL url) {
super.addURL(url);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,19 @@ object DatabaseConfig : SimpleYAMLConfig() {

@Comment(
"",
"数据库驱动类型: 支持 MySQL、MariaDB、SQLite、Oracle、PostgreSQL、SQLServer",
"数据库驱动类型: 支持 MySQL、MariaDB、H2、SQLite、Oracle、PostgreSQL、SQLServer",
"如果你的 MySQL 总是连不上请将驱动类型改为 MariaDB,它支持连接到mysql"
)
@Key
var database_type = "SQLite"
var database_type = "H2"

@Comment("", "数据库地址")
@Key
var address = File(BukkitTemplate.getPlugin().dataFolder, "database.db").absoluteFile.toString()
var address = File(BukkitTemplate.getPlugin().dataFolder, "database").absoluteFile.toString()

@Comment("", "数据库名")
@Key
var database_name = "database_${BukkitTemplate.getPlugin().name}"
var database_name = "database_${BukkitTemplate.getPlugin().name.lowercase()}"

@Comment(
"",
Expand Down Expand Up @@ -194,11 +194,11 @@ object DatabaseConfig : SimpleYAMLConfig() {
driverClassName = "org.sqlite.JDBC"
}

// "H2" -> HikariConfig().apply {
// dd.downloadDependency("com.h2database:h2:2.1.214")
// jdbcUrl = "jdbc:h2:$url/$dbName$params"
// driverClassName = "org.h2.Driver"
// }
"H2" -> HikariConfig().apply {
runtimeManager.downloadADependency("com.h2database:h2:2.2.220")
jdbcUrl = "jdbc:h2:$address/$database_name$params"
driverClassName = "org.h2.Driver"
}

"PostgreSQL" -> HikariConfig(props).apply {
runtimeManager.downloadADependency("com.impossibl.pgjdbc-ng:pgjdbc-ng:0.8.9")
Expand Down
10 changes: 10 additions & 0 deletions core/src/main/kotlin/top/iseason/bukkittemplate/ui/slot/IOSlot.kt
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,16 @@ open class IOSlot(
}
}

/**
* 直接把物品给某人,不触发别的事件
*/
fun ejectSilently(humanEntity: HumanEntity) {
val itemStack = itemStack
if (itemStack != null && output(this, itemStack)) {
humanEntity.giveItems(itemStack)
reset()
}
}
override fun reset() {
itemStack = null
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ object ItemUtils {
is BlockStateMeta -> {
val blockState = blockState
if (blockState is CreatureSpawner) {
yaml["spawner"] = blockState.spawnedType.name
yaml["spawner"] = blockState.spawnedType?.name
} else if (blockState is InventoryHolder) {
if (allowNested) {
val createSection = yaml.createSection("inventory")
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ pluginName=SakuraCDK
group=top.iseason.bukkit.sakuracdk
author=Iseason
jarOutputFile=build
version=1.0.5
version=1.0.6
# api设置
kotlinVersion=1.8.21
kotlinVersion=1.9.0
shadowJarVersion=8.1.1
nbtEditorVersion=7.18.6
# 编译设置
Expand All @@ -16,7 +16,7 @@ obfuscatedDictionary=proguard-dictionary\\iIl-dictionary.txt
# 是否删除未使用代码
shrink=true
# exposed 数据库框架版本
exposedVersion=0.41.1
exposedVersion=0.42.0
kotlin.code.style=official
kotlin.incremental=true
kotlin.incremental.java=true
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
networkTimeout=50000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
6 changes: 3 additions & 3 deletions plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ dependencies {

// 协程库
// compileOnly("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.2")
implementation("org.bstats:bstats-bukkit:3.0.1")
compileOnly("me.clip:placeholderapi:2.11.3")

// 本地依赖放在libs文件夹内
compileOnly(fileTree("libs") { include("*.jar") })
compileOnly("fr.xephi:authme:5.6.0-SNAPSHOT") { isTransitive = false }
implementation("org.bstats:bstats-bukkit:3.0.1")
}

// 插件名称,请在gradle.properties 修改
Expand Down Expand Up @@ -61,7 +61,7 @@ tasks {
}
relocate("top.iseason.bukkittemplate", "$groupS.libs.core")
relocate("org.bstats", "$groupS.libs.bstats")
// relocate("io.github.bananapuncher714.nbteditor", "$groupS.libs.nbteditor")
relocate("io.github.bananapuncher714.nbteditor", "$groupS.libs.nbteditor")
}
build {
dependsOn("buildPlugin")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ object CDKsYml : SimpleYAMLConfig() {
override fun onLoaded(section: ConfigurationSection) {
cdkCache.clear()
for (key in section.getKeys(false)) {
val section = section.getConfigurationSection(key) ?: continue
val type = section.getString("type") ?: continue
val sec = section.getConfigurationSection(key) ?: continue
val type = sec.getString("type") ?: continue
val cdk: BaseCDK = when (type.lowercase()) {
"normal" -> NormalCDKYml.fromSection(key, section)
"random" -> RandomCDKYml.fromSection(key, section)
"normal" -> NormalCDKYml.fromSection(key, sec)
"random" -> RandomCDKYml.fromSection(key, sec)
else -> null
} ?: continue
cdkCache[cdk.id] = cdk
Expand Down

0 comments on commit b0426f6

Please sign in to comment.