diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 68c0553..c2bb940 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,48 +1,31 @@ -name: build -on: - push: - branches: - - main +name: Workflow Build +on: [ push ] jobs: build: runs-on: ubuntu-latest steps: - name: checkout repository uses: actions/checkout@v2 + - name: cache gradle packages + uses: actions/cache@v2 + with: + key: ${{ runner.os }}-build-${{ env.cache-name }} + path: | + ~/.gradle/caches + ~/.gradle/wrapper - name: validate gradle wrapper uses: gradle/wrapper-validation-action@v1 - - name: setup jdk 8.0 + - name: setup jdk 16.0 uses: actions/setup-java@v2 with: distribution: adopt - java-version: 8.0 + java-version: 16.0 - name: make gradle wrapper executable run: chmod +x ./gradlew - # 第一次构建 - name: build - continue-on-error: true - id: build_1 - run: ./gradlew build - # 第二次构建 - - name: build (retry 1) - continue-on-error: true - id: build_2 - if: steps.build_1.outcome == 'failure' - run: ./gradlew build - # 第三次构建 - - name: build (retry 2) - continue-on-error: true - id: build_3 - if: steps.build_2.outcome == 'failure' - run: ./gradlew build - # 第四次构建 - - name: build (retry 3) - id: build_4 - if: steps.build_3.outcome == 'failure' run: ./gradlew build - # 上传构建文件 - name: capture build artifacts uses: actions/upload-artifact@v2 with: name: Artifacts - path: build/libs/ + path: build/libs/ \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index c4b639d..f024948 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -68,7 +68,7 @@ tasks.withType { } configure { - sourceCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_14 targetCompatibility = JavaVersion.VERSION_1_8 } diff --git a/gradle.properties b/gradle.properties index c4c9743..ae320cb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,2 @@ group=com.github.l1an.yuspawnerhologram -version=1.0.2 \ No newline at end of file +version=1.0.3 \ No newline at end of file diff --git a/src/main/kotlin/com/github/l1an/yuspawnerhologram/api/event/PluginReloadEvent.kt b/src/main/kotlin/com/github/l1an/yuspawnerhologram/api/event/PluginReloadEvent.kt new file mode 100644 index 0000000..2b9eb05 --- /dev/null +++ b/src/main/kotlin/com/github/l1an/yuspawnerhologram/api/event/PluginReloadEvent.kt @@ -0,0 +1,5 @@ +package com.github.l1an.yuspawnerhologram.api.event + +import taboolib.platform.type.BukkitProxyEvent + +class PluginReloadEvent : BukkitProxyEvent() \ No newline at end of file diff --git a/src/main/kotlin/com/github/l1an/yuspawnerhologram/internal/command/MainCommand.kt b/src/main/kotlin/com/github/l1an/yuspawnerhologram/internal/command/MainCommand.kt index 67b1ceb..5928d86 100644 --- a/src/main/kotlin/com/github/l1an/yuspawnerhologram/internal/command/MainCommand.kt +++ b/src/main/kotlin/com/github/l1an/yuspawnerhologram/internal/command/MainCommand.kt @@ -2,11 +2,15 @@ package com.github.l1an.yuspawnerhologram.internal.command import com.github.l1an.yuspawnerhologram.internal.command.subcommand.CommandRefresh import com.github.l1an.yuspawnerhologram.internal.command.subcommand.CommandReload +import org.bukkit.Bukkit +import org.bukkit.entity.Player import taboolib.common.platform.ProxyCommandSender +import taboolib.common.platform.ProxyPlayer import taboolib.common.platform.command.CommandBody import taboolib.common.platform.command.CommandHeader import taboolib.common.platform.command.mainCommand import taboolib.common.platform.command.subCommand +import taboolib.common.platform.function.onlinePlayers import taboolib.common5.Mirror import taboolib.common5.mirrorNow import taboolib.expansion.createHelper diff --git a/src/main/kotlin/com/github/l1an/yuspawnerhologram/internal/command/subcommand/CommandRefresh.kt b/src/main/kotlin/com/github/l1an/yuspawnerhologram/internal/command/subcommand/CommandRefresh.kt index 98fa6af..5b3bfd1 100644 --- a/src/main/kotlin/com/github/l1an/yuspawnerhologram/internal/command/subcommand/CommandRefresh.kt +++ b/src/main/kotlin/com/github/l1an/yuspawnerhologram/internal/command/subcommand/CommandRefresh.kt @@ -1,12 +1,12 @@ package com.github.l1an.yuspawnerhologram.internal.command.subcommand import com.github.l1an.yuspawnerhologram.internal.config.YuSpawnerHologramConfig.config -import com.github.l1an.yuspawnerhologram.internal.core.mythichologram.AdyeshachHologram.refreshHologramByADY -import com.github.l1an.yuspawnerhologram.internal.core.mythichologram.DecentHologram.refreshHologramByDH +import com.github.l1an.yuspawnerhologram.module.adyeshach.AdyeshachHologram.refreshHologramByADY +import com.github.l1an.yuspawnerhologram.module.decentholograms.DecentHologram.refreshHologramByDH import com.github.l1an.yuspawnerhologram.internal.core.mythichologram.HologramEnter.adyeshach import com.github.l1an.yuspawnerhologram.internal.core.mythichologram.HologramEnter.decentHolograms import com.github.l1an.yuspawnerhologram.internal.core.mythichologram.HologramEnter.holographicDisplays -import com.github.l1an.yuspawnerhologram.internal.core.mythichologram.HolographicHologram.refreshHologramByHD +import com.github.l1an.yuspawnerhologram.module.holographicdisplays.HolographicHologram.refreshHologramByHD import com.github.l1an.yuspawnerhologram.util.Utils import org.bukkit.command.CommandSender import taboolib.common.platform.command.subCommand diff --git a/src/main/kotlin/com/github/l1an/yuspawnerhologram/internal/command/subcommand/CommandReload.kt b/src/main/kotlin/com/github/l1an/yuspawnerhologram/internal/command/subcommand/CommandReload.kt index 8305996..4db0a7d 100644 --- a/src/main/kotlin/com/github/l1an/yuspawnerhologram/internal/command/subcommand/CommandReload.kt +++ b/src/main/kotlin/com/github/l1an/yuspawnerhologram/internal/command/subcommand/CommandReload.kt @@ -1,10 +1,11 @@ package com.github.l1an.yuspawnerhologram.internal.command.subcommand +import com.github.l1an.yuspawnerhologram.api.event.PluginReloadEvent import com.github.l1an.yuspawnerhologram.internal.config.YuSpawnerHologramConfig -import com.github.l1an.yuspawnerhologram.internal.core.mythichologram.AdyeshachHologram -import com.github.l1an.yuspawnerhologram.internal.core.mythichologram.DecentHologram +import com.github.l1an.yuspawnerhologram.module.adyeshach.AdyeshachHologram +import com.github.l1an.yuspawnerhologram.module.decentholograms.DecentHologram import com.github.l1an.yuspawnerhologram.internal.core.mythichologram.HologramEnter -import com.github.l1an.yuspawnerhologram.internal.core.mythichologram.HolographicHologram +import com.github.l1an.yuspawnerhologram.module.holographicdisplays.HolographicHologram import com.github.l1an.yuspawnerhologram.internal.manager.ConfigManager import com.github.l1an.yuspawnerhologram.util.Utils import org.bukkit.command.CommandSender @@ -26,6 +27,7 @@ val CommandReload = subCommand { } sender.sendLang("command-reload") ConfigManager.reload() + PluginReloadEvent().call() } } } \ No newline at end of file diff --git a/src/main/kotlin/com/github/l1an/yuspawnerhologram/internal/core/HologramUpdateSubmit.kt b/src/main/kotlin/com/github/l1an/yuspawnerhologram/internal/core/HologramUpdateSubmit.kt index 2374e93..0b08aaf 100644 --- a/src/main/kotlin/com/github/l1an/yuspawnerhologram/internal/core/HologramUpdateSubmit.kt +++ b/src/main/kotlin/com/github/l1an/yuspawnerhologram/internal/core/HologramUpdateSubmit.kt @@ -2,14 +2,13 @@ package com.github.l1an.yuspawnerhologram.internal.core import com.github.l1an.yuspawnerhologram.internal.compat.hook.HookMythicMobs.getSpawnerManager import com.github.l1an.yuspawnerhologram.internal.config.YuSpawnerHologramConfig.config -import com.github.l1an.yuspawnerhologram.internal.core.mythichologram.AdyeshachHologram.refreshHologramTextByADY -import com.github.l1an.yuspawnerhologram.internal.core.mythichologram.DecentHologram.refreshHologramByDH -import com.github.l1an.yuspawnerhologram.internal.core.mythichologram.DecentHologram.refreshHologramTextByDH +import com.github.l1an.yuspawnerhologram.module.adyeshach.AdyeshachHologram.refreshHologramTextByADY +import com.github.l1an.yuspawnerhologram.module.decentholograms.DecentHologram.refreshHologramTextByDH import com.github.l1an.yuspawnerhologram.internal.core.mythichologram.HologramEnter.adyeshach import com.github.l1an.yuspawnerhologram.internal.core.mythichologram.HologramEnter.decentHolograms import com.github.l1an.yuspawnerhologram.internal.core.mythichologram.HologramEnter.holographicDisplays -import com.github.l1an.yuspawnerhologram.internal.core.mythichologram.HolographicHologram.getHologramTextWithInfo -import com.github.l1an.yuspawnerhologram.internal.core.mythichologram.HolographicHologram.holograms +import com.github.l1an.yuspawnerhologram.module.holographicdisplays.HolographicHologram.getHologramTextWithInfo +import com.github.l1an.yuspawnerhologram.module.holographicdisplays.HolographicHologram.holograms import com.github.l1an.yuspawnerhologram.internal.util.MythicHologramUtils.getDisplayNameFromConfigs import com.github.l1an.yuspawnerhologram.util.TimeUtils.secondToFormat import com.github.l1an.yuspawnerhologram.internal.manager.HologramType.* @@ -36,6 +35,9 @@ object HologramUpdateSubmit { mirrorNow("Refresh HologramText") { for ((name, hologram) in holograms.entries) { // 获取刷怪管理器 + if (getSpawnerManager(name) == null) { + return@mirrorNow + } val spawnerManager = getSpawnerManager(name)!! // 获取所有行 diff --git a/src/main/kotlin/com/github/l1an/yuspawnerhologram/internal/core/mythichologram/HologramEnter.kt b/src/main/kotlin/com/github/l1an/yuspawnerhologram/internal/core/mythichologram/HologramEnter.kt index 25d9800..8fbb33e 100644 --- a/src/main/kotlin/com/github/l1an/yuspawnerhologram/internal/core/mythichologram/HologramEnter.kt +++ b/src/main/kotlin/com/github/l1an/yuspawnerhologram/internal/core/mythichologram/HologramEnter.kt @@ -1,9 +1,8 @@ package com.github.l1an.yuspawnerhologram.internal.core.mythichologram -import com.github.l1an.yuspawnerhologram.internal.core.mythichologram.AdyeshachHologram.createAllHologramByADY -import com.github.l1an.yuspawnerhologram.internal.core.mythichologram.DecentHologram.createAllHologramByDH -import com.github.l1an.yuspawnerhologram.internal.core.mythichologram.HolographicHologram.createAllHologramByHD -import me.filoghost.holographicdisplays.api.hologram.Hologram +import com.github.l1an.yuspawnerhologram.module.adyeshach.AdyeshachHologram.createAllHologramByADY +import com.github.l1an.yuspawnerhologram.module.decentholograms.DecentHologram.createAllHologramByDH +import com.github.l1an.yuspawnerhologram.module.holographicdisplays.HolographicHologram.createAllHologramByHD import org.bukkit.Bukkit import org.bukkit.plugin.Plugin import taboolib.common.LifeCycle diff --git a/src/main/kotlin/com/github/l1an/yuspawnerhologram/internal/core/mythichologram/AdyeshachHologram.kt b/src/main/kotlin/com/github/l1an/yuspawnerhologram/module/adyeshach/AdyeshachHologram.kt similarity index 98% rename from src/main/kotlin/com/github/l1an/yuspawnerhologram/internal/core/mythichologram/AdyeshachHologram.kt rename to src/main/kotlin/com/github/l1an/yuspawnerhologram/module/adyeshach/AdyeshachHologram.kt index 1f649e5..8d9aada 100644 --- a/src/main/kotlin/com/github/l1an/yuspawnerhologram/internal/core/mythichologram/AdyeshachHologram.kt +++ b/src/main/kotlin/com/github/l1an/yuspawnerhologram/module/adyeshach/AdyeshachHologram.kt @@ -1,4 +1,4 @@ -package com.github.l1an.yuspawnerhologram.internal.core.mythichologram +package com.github.l1an.yuspawnerhologram.module.adyeshach import com.github.l1an.yuspawnerhologram.internal.compat.hook.HookMythicMobs.getSpawnerManager import com.github.l1an.yuspawnerhologram.internal.config.YuSpawnerHologramConfig.config diff --git a/src/main/kotlin/com/github/l1an/yuspawnerhologram/internal/core/mythichologram/DecentHologram.kt b/src/main/kotlin/com/github/l1an/yuspawnerhologram/module/decentholograms/DecentHologram.kt similarity index 98% rename from src/main/kotlin/com/github/l1an/yuspawnerhologram/internal/core/mythichologram/DecentHologram.kt rename to src/main/kotlin/com/github/l1an/yuspawnerhologram/module/decentholograms/DecentHologram.kt index 713e453..361f8f1 100644 --- a/src/main/kotlin/com/github/l1an/yuspawnerhologram/internal/core/mythichologram/DecentHologram.kt +++ b/src/main/kotlin/com/github/l1an/yuspawnerhologram/module/decentholograms/DecentHologram.kt @@ -1,4 +1,4 @@ -package com.github.l1an.yuspawnerhologram.internal.core.mythichologram +package com.github.l1an.yuspawnerhologram.module.decentholograms import com.github.l1an.yuspawnerhologram.internal.compat.hook.HookMythicMobs.getSpawnerManager import com.github.l1an.yuspawnerhologram.internal.config.YuSpawnerHologramConfig.config diff --git a/src/main/kotlin/com/github/l1an/yuspawnerhologram/internal/core/mythichologram/HolographicHologram.kt b/src/main/kotlin/com/github/l1an/yuspawnerhologram/module/holographicdisplays/HolographicHologram.kt similarity index 98% rename from src/main/kotlin/com/github/l1an/yuspawnerhologram/internal/core/mythichologram/HolographicHologram.kt rename to src/main/kotlin/com/github/l1an/yuspawnerhologram/module/holographicdisplays/HolographicHologram.kt index ea4c2a8..859e53c 100644 --- a/src/main/kotlin/com/github/l1an/yuspawnerhologram/internal/core/mythichologram/HolographicHologram.kt +++ b/src/main/kotlin/com/github/l1an/yuspawnerhologram/module/holographicdisplays/HolographicHologram.kt @@ -1,7 +1,8 @@ -package com.github.l1an.yuspawnerhologram.internal.core.mythichologram +package com.github.l1an.yuspawnerhologram.module.holographicdisplays import com.github.l1an.yuspawnerhologram.internal.compat.hook.HookMythicMobs.getSpawnerManager import com.github.l1an.yuspawnerhologram.internal.config.YuSpawnerHologramConfig.config +import com.github.l1an.yuspawnerhologram.internal.core.mythichologram.HologramEnter import com.github.l1an.yuspawnerhologram.internal.manager.HologramTextContainer import com.github.l1an.yuspawnerhologram.internal.manager.HologramType import com.github.l1an.yuspawnerhologram.internal.util.MythicHologramUtils.getDisplayNameFromConfigs