Skip to content

Commit

Permalink
Merge branch 'Misat11-update-configs' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
boiscljo committed Sep 23, 2023
2 parents 55e37ea + 5a2c147 commit c1fea04
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 29 deletions.
45 changes: 27 additions & 18 deletions plugin/src/main/java/io/github/pronze/sba/game/Arena.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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?");
Expand Down Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,14 @@ public Map.Entry<Boolean, Boolean> 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;
Expand Down
2 changes: 1 addition & 1 deletion plugin/src/main/resources/games-inventory/double.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion plugin/src/main/resources/games-inventory/solo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion plugin/src/main/resources/games-inventory/squads.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion plugin/src/main/resources/games-inventory/triples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions plugin/src/main/resources/shops/shop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ data:
stack:
type: STICK
enchants:
KNOCKBACK: 1
knockback: 1

- write: false
stack: 'STONE'
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions plugin/src/main/resources/shops/upgradeShop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit c1fea04

Please sign in to comment.