From 63069ecd7abedf768b28a3a1380144ab17e17f50 Mon Sep 17 00:00:00 2001 From: Misat11 <20199703+Misat11@users.noreply.github.com> Date: Sat, 23 Sep 2023 16:19:19 +0200 Subject: [PATCH] chore: update configs to reflect latest slib changes --- .../java/io/github/pronze/sba/game/Arena.java | 45 +++++++++++-------- .../sba/inventories/SBAStoreInventoryV2.java | 9 +++- .../main/resources/games-inventory/double.yml | 2 +- .../main/resources/games-inventory/solo.yml | 2 +- .../main/resources/games-inventory/squads.yml | 2 +- .../resources/games-inventory/triples.yml | 2 +- plugin/src/main/resources/shops/shop.yml | 8 ++-- .../src/main/resources/shops/upgradeShop.yml | 4 +- 8 files changed, 45 insertions(+), 29 deletions(-) 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 2e8f52f0..9efae30d 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 @@ -1,6 +1,7 @@ package io.github.pronze.sba.game; import io.github.pronze.sba.MessageKeys; +import io.github.pronze.sba.SBA; import io.github.pronze.sba.config.SBAConfig; import io.github.pronze.sba.data.GamePlayerData; import io.github.pronze.sba.game.tasks.BaseGameTask; @@ -204,19 +205,21 @@ public void onGameStarted() { Main.unregisterGameEntity(villager); } - if (mockEntity == null) { - // find a better version independent way to mock entities lol - mockEntity = (Bat) game.getGameWorld() - .spawnEntity(game.getSpectatorSpawn().clone().add(0, 300, 0), EntityType.BAT); - try { - mockEntity.setAI(false); - } catch (Throwable t) { - // 1.8.8 doesn't have that + if (!SBA.sbw_0_2_30) { + if (mockEntity == null){ + // find a better version independent way to mock entities lol + mockEntity = (Bat) game.getGameWorld() + .spawnEntity(game.getSpectatorSpawn().clone().add(0, 300, 0), EntityType.BAT); + try { + mockEntity.setAI(false); + } catch (Throwable t) { + // 1.8.8 doesn't have that + } } - } - // set fake entity to avoid bw listener npe - Reflect.setField(nonAPIStore, "entity", mockEntity); + // set fake entity to avoid bw listener npe + Reflect.setField(nonAPIStore, "entity", mockEntity); + } } catch (Throwable t) { Logger.error( "SBA cannot unspawn the store, is something preventing the spawning of the stores?"); @@ -293,14 +296,20 @@ public void onGameStarted() { npc.getNavigator().setTarget(nonAPIStore.getStoreLocation()); - if (mockEntity == null) { - // 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); + if (!SBA.sbw_0_2_30) { + if (mockEntity == null) { + // find a better version independent way to mock entities lol + mockEntity = (Bat) game.getGameWorld() + .spawnEntity(game.getSpectatorSpawn().clone().add(0, 300, 0), EntityType.BAT); + try { + mockEntity.setAI(false); + } catch (Throwable t) { + // 1.8.8 doesn't have that + } + } + // set fake entity to avoid bw listener npe + Reflect.setField(nonAPIStore, "entity", mockEntity); } - // set fake entity to avoid bw listener npe - Reflect.setField(nonAPIStore, "entity", mockEntity); final var file = store.getShopFile(); diff --git a/plugin/src/main/java/io/github/pronze/sba/inventories/SBAStoreInventoryV2.java b/plugin/src/main/java/io/github/pronze/sba/inventories/SBAStoreInventoryV2.java index eeb21ee7..cb099a16 100644 --- a/plugin/src/main/java/io/github/pronze/sba/inventories/SBAStoreInventoryV2.java +++ b/plugin/src/main/java/io/github/pronze/sba/inventories/SBAStoreInventoryV2.java @@ -215,7 +215,14 @@ public Map.Entry handlePurchase(Player player, AtomicReference .forEach(effectItem -> { try { String effectType = effectItem.childrenMap().get("type").getString(); - PotionEffectType type_ = PotionEffectType.getByName(effectType); + var slibEffect = org.screamingsandals.lib.item.meta.PotionEffectType.ofNullable(effectType); + + PotionEffectType type_; + if (slibEffect != null) { + type_ = slibEffect.as(PotionEffectType.class); + } else { + type_ = PotionEffectType.getByName(effectType); + } if (type_ == null) { Logger.error("{} is not a recognized Potion effect", effectType); return; diff --git a/plugin/src/main/resources/games-inventory/double.yml b/plugin/src/main/resources/games-inventory/double.yml index 5ca49359..5fa8fd2e 100644 --- a/plugin/src/main/resources/games-inventory/double.yml +++ b/plugin/src/main/resources/games-inventory/double.yml @@ -26,7 +26,7 @@ data: rows: 6 render_actual_rows: 6 items: - - stack: "FIREWORK;1;§7Random Map;§8Doubles; ;§aClick to Play" + - stack: "FIREWORK_ROCKET;1;§7Random Map;§8Doubles; ;§aClick to Play" row: 4 column: 3 properties: diff --git a/plugin/src/main/resources/games-inventory/solo.yml b/plugin/src/main/resources/games-inventory/solo.yml index ba1b1a2b..bf142e13 100644 --- a/plugin/src/main/resources/games-inventory/solo.yml +++ b/plugin/src/main/resources/games-inventory/solo.yml @@ -26,7 +26,7 @@ data: rows: 6 render_actual_rows: 6 items: - - stack: "FIREWORK;1;§7Random Map;§8Solo; ;§aClick to Play" + - stack: "FIREWORK_ROCKET;1;§7Random Map;§8Solo; ;§aClick to Play" row: 4 column: 3 properties: diff --git a/plugin/src/main/resources/games-inventory/squads.yml b/plugin/src/main/resources/games-inventory/squads.yml index 024d2764..db4d4ed2 100644 --- a/plugin/src/main/resources/games-inventory/squads.yml +++ b/plugin/src/main/resources/games-inventory/squads.yml @@ -26,7 +26,7 @@ data: rows: 6 render_actual_rows: 6 items: - - stack: "FIREWORK;1;§7Random Map;§8Squads; ;§aClick to Play" + - stack: "FIREWORK_ROCKET;1;§7Random Map;§8Squads; ;§aClick to Play" row: 4 column: 3 properties: diff --git a/plugin/src/main/resources/games-inventory/triples.yml b/plugin/src/main/resources/games-inventory/triples.yml index 3229f764..1a6d541d 100644 --- a/plugin/src/main/resources/games-inventory/triples.yml +++ b/plugin/src/main/resources/games-inventory/triples.yml @@ -26,7 +26,7 @@ data: rows: 6 render_actual_rows: 6 items: - - stack: "FIREWORK;1;§7Random Map;§8Triples; ;§aClick to Play" + - stack: "FIREWORK_ROCKET;1;§7Random Map;§8Triples; ;§aClick to Play" row: 4 column: 3 properties: diff --git a/plugin/src/main/resources/shops/shop.yml b/plugin/src/main/resources/shops/shop.yml index 7b544d84..59c8d016 100644 --- a/plugin/src/main/resources/shops/shop.yml +++ b/plugin/src/main/resources/shops/shop.yml @@ -69,7 +69,7 @@ data: stack: type: STICK enchants: - KNOCKBACK: 1 + knockback: 1 - write: false stack: 'STONE' @@ -163,13 +163,13 @@ data: stack: type: BOW enchants: - ARROW_DAMAGE: 1 + power: 1 - price: 6 of emerald stack: type: BOW enchants: - ARROW_KNOCKBACK: 1 - ARROW_DAMAGE: 1 + punch: 1 + power: 1 - price: 2 of gold stack: type: ARROW diff --git a/plugin/src/main/resources/shops/upgradeShop.yml b/plugin/src/main/resources/shops/upgradeShop.yml index 739cda1b..bcd81eda 100644 --- a/plugin/src/main/resources/shops/upgradeShop.yml +++ b/plugin/src/main/resources/shops/upgradeShop.yml @@ -63,10 +63,10 @@ data: identifier: custom_trap_1 target: team effects: - - type: JUMP + - type: jump_boost duration: 600 level: 6 - - type: REGENERATION + - type: regeneration duration: 600 level: 2 stack: