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

Commit

Permalink
Fix chatbubbles prevent portal teleportation
Browse files Browse the repository at this point in the history
  • Loading branch information
fxdsu committed Jul 16, 2023
1 parent 1ed187d commit d73c0e9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/main/java/net/flectone/tickers/ChatBubbleTicker.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import net.flectone.managers.FPlayerManager;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.entity.AreaEffectCloud;
import org.bukkit.entity.Entity;
Expand All @@ -15,7 +16,6 @@

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

public class ChatBubbleTicker extends FBukkitRunnable {

Expand All @@ -28,7 +28,12 @@ public void run() {
Bukkit.getOnlinePlayers().forEach(player -> {

FPlayer fPlayer = FPlayerManager.getPlayer(player);
List<Entity> entities = fPlayer.getPlayer().getPassengers().stream().filter(entity -> entity instanceof AreaEffectCloud).collect(Collectors.toList());
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;

Expand Down

0 comments on commit d73c0e9

Please sign in to comment.