mirror of
https://github.com/ColdeZhang/Dominion.git
synced 2025-01-27 10:23:59 +08:00
实现了多模块、多版本打包
This commit is contained in:
parent
cabd3149ff
commit
e0bd285e74
@ -20,7 +20,7 @@ jobs:
|
||||
distribution: 'zulu'
|
||||
cache: gradle
|
||||
- name: "Build with Gradle"
|
||||
run: ./gradlew shadowJar
|
||||
run: ./gradlew buildPlugin
|
||||
- name: "Copy jar to staging"
|
||||
run: mkdir staging && cp build/libs/*.jar staging/
|
||||
- name: "Build & test"
|
||||
|
@ -4,7 +4,7 @@ plugins {
|
||||
}
|
||||
|
||||
group = "cn.lunadeer"
|
||||
version = "1.44.4-beta"
|
||||
version = "1.44.6-beta"
|
||||
|
||||
java {
|
||||
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
|
||||
@ -15,7 +15,7 @@ tasks.withType<JavaCompile> {
|
||||
options.encoding = "UTF-8"
|
||||
}
|
||||
|
||||
subprojects {
|
||||
allprojects {
|
||||
apply(plugin = "java")
|
||||
apply(plugin = "com.github.johnrengelman.shadow")
|
||||
|
||||
@ -37,19 +37,34 @@ subprojects {
|
||||
implementation("org.yaml:snakeyaml:2.0")
|
||||
}
|
||||
|
||||
|
||||
tasks.withType<ProcessResources> {
|
||||
tasks.processResources {
|
||||
// replace @version@ in plugin.yml with project version
|
||||
filesMatching("**/plugin.yml") {
|
||||
filter {
|
||||
it.replace("@version@", project.version.toString())
|
||||
it.replace("@version@", rootProject.version.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar> {
|
||||
tasks.shadowJar {
|
||||
archiveClassifier.set("")
|
||||
archiveVersion.set(project.version.toString())
|
||||
dependsOn(tasks.withType<ProcessResources>())
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(":core"))
|
||||
implementation(project(":v1_20_1"))
|
||||
implementation(project(":v1_21"))
|
||||
}
|
||||
|
||||
tasks.shadowJar {
|
||||
archiveClassifier.set("")
|
||||
archiveVersion.set(project.version.toString())
|
||||
}
|
||||
|
||||
tasks.register("buildPlugin") {
|
||||
dependsOn(tasks.getByName("clean"))
|
||||
dependsOn(tasks.getByName("shadowJar"))
|
||||
}
|
@ -11,16 +11,6 @@ tasks.withType<JavaCompile> {
|
||||
options.encoding = "UTF-8"
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
maven("https://oss.sonatype.org/content/groups/public")
|
||||
maven("https://repo.papermc.io/repository/maven-public/")
|
||||
maven("https://jitpack.io")
|
||||
maven("https://repo.mikeprimm.com/")
|
||||
maven("https://ssl.lunadeer.cn:14454/repository/maven-snapshots/")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly("io.papermc.paper:paper-api:1.20.1-R0.1-SNAPSHOT")
|
||||
}
|
||||
|
@ -18,11 +18,13 @@ public class RegisterEvents {
|
||||
try {
|
||||
switch (version) {
|
||||
case v1_21:
|
||||
XLogger.debug("Load API version: 1.21");
|
||||
registerEvents("cn.lunadeer.dominion.events_v1_21.PlayerEvents");
|
||||
registerEvents("cn.lunadeer.dominion.events_v1_21.EnvironmentEvents");
|
||||
registerEvents("cn.lunadeer.dominion.events_v1_21.SelectPointEvents");
|
||||
break;
|
||||
case v1_20_1:
|
||||
XLogger.debug("Load API version: 1.20.1");
|
||||
registerEvents("cn.lunadeer.dominion.events_v1_20_1.PlayerEvents");
|
||||
registerEvents("cn.lunadeer.dominion.events_v1_20_1.EnvironmentEvents");
|
||||
registerEvents("cn.lunadeer.dominion.events_v1_20_1.SelectPointEvents");
|
||||
|
@ -11,10 +11,6 @@ tasks.withType<JavaCompile> {
|
||||
options.encoding = "UTF-8"
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven("https://repo.papermc.io/repository/maven-public/")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(project(":core"))
|
||||
compileOnly("io.papermc.paper:paper-api:1.20.1-R0.1-SNAPSHOT")
|
||||
|
@ -162,10 +162,11 @@ public class EnvironmentEvents implements Listener {
|
||||
@EventHandler(priority = EventPriority.HIGHEST) // tnt_explode - armor stand
|
||||
public void onArmorStandExplodedByTnt(EntityDamageByEntityEvent event) {
|
||||
Entity entity = event.getEntity();
|
||||
Entity harmer = event.getDamager();
|
||||
if (entity.getType() != EntityType.ARMOR_STAND) {
|
||||
return;
|
||||
}
|
||||
if (entity.getType() != EntityType.MINECART_TNT && entity.getType() != EntityType.PRIMED_TNT) {
|
||||
if (harmer.getType() != EntityType.MINECART_TNT && harmer.getType() != EntityType.PRIMED_TNT) {
|
||||
return;
|
||||
}
|
||||
DominionDTO dom = Cache.instance.getDominionByLoc(entity.getLocation());
|
||||
|
@ -359,7 +359,7 @@ public class PlayerEvents implements Listener {
|
||||
if (block == null) {
|
||||
return;
|
||||
}
|
||||
if (!Tag.DOORS.isTagged(block.getType())) {
|
||||
if (!Tag.DOORS.isTagged(block.getType()) && !Tag.TRAPDOORS.isTagged(block.getType())) {
|
||||
return;
|
||||
}
|
||||
Player player = event.getPlayer();
|
||||
|
@ -11,10 +11,6 @@ tasks.withType<JavaCompile> {
|
||||
options.encoding = "UTF-8"
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven("https://repo.papermc.io/repository/maven-public/")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(project(":core"))
|
||||
compileOnly("io.papermc.paper:paper-api:1.21-R0.1-SNAPSHOT")
|
||||
|
@ -162,10 +162,11 @@ public class EnvironmentEvents implements Listener {
|
||||
@EventHandler(priority = EventPriority.HIGHEST) // tnt_explode - armor stand
|
||||
public void onArmorStandExplodedByTnt(EntityDamageByEntityEvent event) {
|
||||
Entity entity = event.getEntity();
|
||||
Entity harmer = event.getDamager();
|
||||
if (entity.getType() != EntityType.ARMOR_STAND) {
|
||||
return;
|
||||
}
|
||||
if (entity.getType() != EntityType.TNT_MINECART && entity.getType() != EntityType.TNT) {
|
||||
if (harmer.getType() != EntityType.TNT_MINECART && harmer.getType() != EntityType.TNT) {
|
||||
return;
|
||||
}
|
||||
DominionDTO dom = Cache.instance.getDominionByLoc(entity.getLocation());
|
||||
|
@ -52,8 +52,8 @@ public class PlayerEvents implements Listener {
|
||||
}
|
||||
DominionDTO dom = Cache.instance.getPlayerCurrentDominion(bukkitPlayer);
|
||||
if (!checkFlag(dom, Flag.ANCHOR, bukkitPlayer, null)) {
|
||||
if (bukkitPlayer.getBedSpawnLocation() != null) {
|
||||
event.setRespawnLocation(bukkitPlayer.getBedSpawnLocation());
|
||||
if (bukkitPlayer.getRespawnLocation() != null) {
|
||||
event.setRespawnLocation(bukkitPlayer.getRespawnLocation());
|
||||
} else {
|
||||
event.setRespawnLocation(bukkitPlayer.getWorld().getSpawnLocation());
|
||||
}
|
||||
@ -355,7 +355,7 @@ public class PlayerEvents implements Listener {
|
||||
if (block == null) {
|
||||
return;
|
||||
}
|
||||
if (!Tag.DOORS.isTagged(block.getType())) {
|
||||
if (!Tag.DOORS.isTagged(block.getType()) && !Tag.TRAPDOORS.isTagged(block.getType())) {
|
||||
return;
|
||||
}
|
||||
Player player = event.getPlayer();
|
||||
@ -617,7 +617,7 @@ public class PlayerEvents implements Listener {
|
||||
Teleport.doTeleportSafely(player, to).thenAccept((success) -> {
|
||||
if (!success) {
|
||||
Notification.warn(player, "传送失败,你将被传送到复活点");
|
||||
Location bed = player.getBedSpawnLocation();
|
||||
Location bed = player.getRespawnLocation();
|
||||
if (bed == null) {
|
||||
bed = player.getWorld().getSpawnLocation();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user