diff --git a/.github/workflows/build-0-2-x.yml b/.github/workflows/build-0-2-x.yml index c3e2f0275..998c9cfaf 100644 --- a/.github/workflows/build-0-2-x.yml +++ b/.github/workflows/build-0-2-x.yml @@ -11,6 +11,8 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Validate Gradle Wrapper + uses: gradle/actions/wrapper-validation@v4 - name: Set the Build number id: calculated_build_number env: diff --git a/build.gradle b/build.gradle index dfa5ad3be..410586055 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'org.screamingsandals.plugin-builder' version '1.0.85' apply false + id 'org.screamingsandals.plugin-builder' version '1.0.87' apply false id 'me.kcra.takenaka.accessor' version '1.2.0' apply false id 'com.github.gmazzo.buildconfig' version '3.0.0' apply false } diff --git a/gradle.properties b/gradle.properties index d3c0820f4..fea92aec5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -version=0.2.36 +version=0.2.36.1 org.gradle.caching=true org.gradle.parallel=true diff --git a/plugin/src/main/java/org/screamingsandals/bedwars/boss/BossBar18.java b/plugin/src/main/java/org/screamingsandals/bedwars/boss/BossBar18.java index c70bacbd5..e7e105951 100644 --- a/plugin/src/main/java/org/screamingsandals/bedwars/boss/BossBar18.java +++ b/plugin/src/main/java/org/screamingsandals/bedwars/boss/BossBar18.java @@ -42,6 +42,7 @@ public class BossBar18 implements org.screamingsandals.bedwars.api.boss.BossBar1 public final FakeEntityNMS bossbarEntity; public final boolean viaActive; public BossBar viaBossBar; // can't be final + public boolean viaAfterJsonUpdate; public BossBar18(Location location) { String backend = Main.getConfigurator().config.getString("bossbar.backend-entity"); @@ -51,9 +52,12 @@ public BossBar18(Location location) { bossbarEntity = new BossBarWither(location); } boolean viaActive = false; - if (Bukkit.getPluginManager().isPluginEnabled("ViaVersion")) { + if (Main.getConfigurator().config.getBoolean("bossbar.allow-via-hooks") && Bukkit.getPluginManager().isPluginEnabled("ViaVersion")) { try { - viaBossBar = Via.getAPI().legacyAPI().createLegacyBossBar("", 1, BossColor.PURPLE, BossStyle.SOLID); + String version = Bukkit.getPluginManager().getPlugin("ViaVersion").getDescription().getVersion(); + // due to Via now accepting both, many strings including an empty string fails + viaAfterJsonUpdate = Integer.parseInt(version.split("\\.", 2)[0]) >= 5 && !version.equals("5.0.0") && !version.equals("5.0.1"); + viaBossBar = Via.getAPI().legacyAPI().createLegacyBossBar(viaAfterJsonUpdate ? "{text: \"\"}" : "", 1, BossColor.PURPLE, BossStyle.SOLID); viaActive = true; } catch (Throwable ignored) { // Too old ViaVersion is installed @@ -71,7 +75,7 @@ public String getMessage() { public void setMessage(String message) { bossbarEntity.setCustomName(message); if (viaActive) { - viaBossBar.setTitle(message); + viaBossBar.setTitle(viaAfterJsonUpdate ? "{text: \"" + message.replace("\"", "\\\"") + "\"}" : message); } } diff --git a/plugin/src/main/java/org/screamingsandals/bedwars/config/Configurator.java b/plugin/src/main/java/org/screamingsandals/bedwars/config/Configurator.java index f7aa6c475..f465ac168 100644 --- a/plugin/src/main/java/org/screamingsandals/bedwars/config/Configurator.java +++ b/plugin/src/main/java/org/screamingsandals/bedwars/config/Configurator.java @@ -475,6 +475,7 @@ public void createFiles() { checkOrSetConfig(modify, "bossbar.game.style", "SEGMENTED_20"); if (Main.getVersionNumber() <= 108) { checkOrSetConfig(modify, "bossbar.backend-entity", "dragon"); + checkOrSetConfig(modify, "bossbar.allow-via-hooks", true); } checkOrSetConfig(modify, "holograms.enabled", true);