Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
ChatBubble: add vehicle check
Browse files Browse the repository at this point in the history
  • Loading branch information
TheFaser committed Aug 26, 2023
1 parent 9981654 commit 925107a
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions src/main/java/net/flectone/tickers/ChatBubbleTicker.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,26 @@ public ChatBubbleTicker() {

@Override
public void run() {
Bukkit.getOnlinePlayers().stream().filter(player -> !player.isInsideVehicle()).forEach(player -> {
FPlayer fPlayer = FPlayerManager.getPlayer(player);
if(fPlayer == null) return;
Bukkit.getOnlinePlayers().stream()
.filter(player -> !player.isInsideVehicle() || !(player.getVehicle() instanceof AreaEffectCloud))
.forEach(player -> {

List<Entity> entities = fPlayer.getChatBubbleEntities();
FPlayer fPlayer = FPlayerManager.getPlayer(player);
if(fPlayer == null) return;

Material currentBlock = player.getLocation().getBlock().getType();
if (currentBlock.equals(Material.NETHER_PORTAL) || currentBlock.equals(Material.END_PORTAL)) {
fPlayer.clearChatBubbles();
}
List<Entity> entities = fPlayer.getChatBubbleEntities();

Material currentBlock = player.getLocation().getBlock().getType();
if (currentBlock.equals(Material.NETHER_PORTAL) || currentBlock.equals(Material.END_PORTAL)) {
fPlayer.clearChatBubbles();
}

if (fPlayer.getListChatBubbles().isEmpty() || !entities.isEmpty()) return;
if (fPlayer.getListChatBubbles().isEmpty() || !entities.isEmpty()) return;

String message = fPlayer.getListChatBubbles().get(0);
spawnMessageBubble(player, message);
String message = fPlayer.getListChatBubbles().get(0);
spawnMessageBubble(player, message);

fPlayer.removeChatBubble();
fPlayer.removeChatBubble();
});
}

Expand Down

0 comments on commit 925107a

Please sign in to comment.