Skip to content

Commit

Permalink
fix: remaining opponents action bar message not being sent (MC 1.8)
Browse files Browse the repository at this point in the history
  • Loading branch information
RoinujNosde committed Sep 27, 2023
1 parent fa24085 commit 7dbedf5
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions src/main/java/me/roinujnosde/titansbattle/BaseGame.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
import me.roinujnosde.titansbattle.types.Group;
import me.roinujnosde.titansbattle.types.Kit;
import me.roinujnosde.titansbattle.types.Warrior;
import me.roinujnosde.titansbattle.utils.MessageUtils;
import me.roinujnosde.titansbattle.utils.SoundUtils;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.*;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Entity;
Expand Down Expand Up @@ -478,16 +477,13 @@ protected void playDeathSound(@NotNull Warrior victim) {
}

protected void sendRemainingOpponentsCount() {
try {
getPlayerParticipantsStream().forEach(p -> {
int remaining = getRemainingOpponents(p);
if (remaining <= 0) {
return;
}
p.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(MessageFormat.format(getLang("action-bar-remaining-opponents"), remaining)));
});
} catch (NoSuchMethodError ignored) {
}
getPlayerParticipantsStream().forEach(p -> {
int remaining = getRemainingOpponents(p);
if (remaining <= 0) {
return;
}
MessageUtils.sendActionBar(p, MessageFormat.format(getLang("action-bar-remaining-opponents"), remaining));
});
}

protected int getRemainingOpponents(@NotNull Player player) {
Expand Down

0 comments on commit 7dbedf5

Please sign in to comment.