From d84e0703ac7b2a0451ecdaefb8b70d25c304f6b0 Mon Sep 17 00:00:00 2001 From: Jonathan Boisclair Date: Wed, 20 Sep 2023 18:27:18 -0400 Subject: [PATCH] 1.8.8 experimental support, NPC kinda broken --- gradle.properties | 2 +- .../main/java/io/github/pronze/sba/SBA.java | 6 ++-- .../java/io/github/pronze/sba/game/Arena.java | 28 +++++++++++-------- .../sba/visuals/GameScoreboardManager.java | 6 ++++ 4 files changed, 27 insertions(+), 15 deletions(-) diff --git a/gradle.properties b/gradle.properties index b7bb3955..ed023ea8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -SBA_VERSION=1.5.11-dev2-pr29 +SBA_VERSION=1.5.11-dev4-pr28 PAPER_LEGACY_VERSION=1.16.5 BEDWARS_VERSION=0.2.30-SNAPSHOT CLOUD_COMMANDS_VERSION=1.6.2 diff --git a/plugin/src/main/java/io/github/pronze/sba/SBA.java b/plugin/src/main/java/io/github/pronze/sba/SBA.java index 10f297ec..ee2f7c91 100644 --- a/plugin/src/main/java/io/github/pronze/sba/SBA.java +++ b/plugin/src/main/java/io/github/pronze/sba/SBA.java @@ -152,9 +152,9 @@ public void enable() { Logger.init(cachedPluginInstance); if (Main.getVersionNumber() < 109) { - showErrorMessage("Minecraft server is running versions below 1.9.4, please upgrade!"); - Bukkit.getServer().getPluginManager().disablePlugin(getPluginInstance()); - return; + //showErrorMessage("Minecraft server is running versions below 1.9.4, please upgrade!"); + //Bukkit.getServer().getPluginManager().disablePlugin(getPluginInstance()); + //return; } fixs = new ArrayList<>(); fixs.add(BungeecordNPC.getInstance()); diff --git a/plugin/src/main/java/io/github/pronze/sba/game/Arena.java b/plugin/src/main/java/io/github/pronze/sba/game/Arena.java index 8c6f7b13..2e8f52f0 100644 --- a/plugin/src/main/java/io/github/pronze/sba/game/Arena.java +++ b/plugin/src/main/java/io/github/pronze/sba/game/Arena.java @@ -167,7 +167,8 @@ public void onGameStarted() { LanguageService .getInstance() .get(MessageKeys.GAME_START_MESSAGE) - .send(game.getConnectedPlayers().stream().map(Players::wrapPlayer).toArray(org.screamingsandals.lib.player.Player[]::new)); + .send(game.getConnectedPlayers().stream().map(Players::wrapPlayer) + .toArray(org.screamingsandals.lib.player.Player[]::new)); // spawn rotating generators if (SBAConfig.getInstance().node("floating-generator", "enabled").getBoolean()) { @@ -207,7 +208,11 @@ public void onGameStarted() { // find a better version independent way to mock entities lol mockEntity = (Bat) game.getGameWorld() .spawnEntity(game.getSpectatorSpawn().clone().add(0, 300, 0), EntityType.BAT); - mockEntity.setAI(false); + try { + mockEntity.setAI(false); + } catch (Throwable t) { + // 1.8.8 doesn't have that + } } // set fake entity to avoid bw listener npe @@ -459,10 +464,9 @@ public void onOver(BedwarsGameEndingEvent e) { thirdKillerUUID = entry.getKey(); } } - firstKillerUsername = firstKillerName; - secondKillerUsername = secondKillerName; - thirdKillerUsername = thirdKillerName; - + firstKillerUsername = firstKillerName; + secondKillerUsername = secondKillerName; + thirdKillerUsername = thirdKillerName; firstKillerName = replaceNameWithDisplayName(nullStr, firstKillerName, firstKillerUUID); secondKillerName = replaceNameWithDisplayName(nullStr, secondKillerName, secondKillerUUID); @@ -497,7 +501,7 @@ public void onOver(BedwarsGameEndingEvent e) { .replace("%first_killer_score%", String.valueOf(firstKillerScore)) .replace("%second_killer_score%", String.valueOf(secondKillerScore)) .replace("%third_killer_score%", String.valueOf(thirdKillerScore)) - + .send(game.getConnectedPlayers().stream().map(Players::wrapPlayer) .toArray(org.screamingsandals.lib.player.Player[]::new)); } @@ -565,12 +569,14 @@ public Optional getHiddenPlayer(UUID playerUUID) { Map tracking = new HashMap<>(); - public void track(Player source, Player target) - { - if(!game.isPlayerInAnyTeam(source))return; - if(!game.isPlayerInAnyTeam(target))return; + public void track(Player source, Player target) { + if (!game.isPlayerInAnyTeam(source)) + return; + if (!game.isPlayerInAnyTeam(target)) + return; tracking.put(source, target); } + public void onGameTick(BedwarsGameTickEvent e) { Game game = e.getGame(); for (var p : game.getConnectedPlayers()) { diff --git a/plugin/src/main/java/io/github/pronze/sba/visuals/GameScoreboardManager.java b/plugin/src/main/java/io/github/pronze/sba/visuals/GameScoreboardManager.java index 0079b1c1..54af9b70 100644 --- a/plugin/src/main/java/io/github/pronze/sba/visuals/GameScoreboardManager.java +++ b/plugin/src/main/java/io/github/pronze/sba/visuals/GameScoreboardManager.java @@ -88,7 +88,13 @@ public void createScoreboard(@NotNull Player player) { } final var scoreboardTeam = holder.getTeamOrRegister(team.getName()); + try{ scoreboardTeam.setOption(Option.COLLISION_RULE, OptionStatus.NEVER); + } + catch(Throwable t) + { + //1.8.8 + } team.getConnectedPlayers() .forEach(teamPlayer -> {