Skip to content

Commit

Permalink
1.8.8 experimental support, NPC kinda broken
Browse files Browse the repository at this point in the history
  • Loading branch information
boiscljo committed Sep 20, 2023
1 parent b093ad9 commit d84e070
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 15 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions plugin/src/main/java/io/github/pronze/sba/SBA.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
28 changes: 17 additions & 11 deletions plugin/src/main/java/io/github/pronze/sba/game/Arena.java
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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));
}
Expand Down Expand Up @@ -565,12 +569,14 @@ public Optional<InvisiblePlayer> getHiddenPlayer(UUID playerUUID) {

Map<Player, Player> 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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 -> {
Expand Down

0 comments on commit d84e070

Please sign in to comment.