9
0
mirror of https://github.com/Xiao-MoMi/Custom-Nameplates.git synced 2026-01-06 15:42:00 +00:00
This commit is contained in:
XiaoMoMi
2023-10-26 21:48:01 +08:00
parent 5c8ffbe7b6
commit 8470a73f91
6 changed files with 20 additions and 14 deletions

View File

@@ -29,6 +29,7 @@ import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.event.EventHandler;
import java.util.Objects;
import java.util.Optional;
public class BungeeEventListener implements Listener {
@@ -57,8 +58,9 @@ public class BungeeEventListener implements Listener {
String teamName = playerName;
if (plugin.getBungeeConfig().isTab()) {
TabPlayer tabPlayer = TabAPI.getInstance().getPlayer(playerName);
if (tabPlayer == null) return;
teamName = sortingManager.getOriginalTeamName(tabPlayer);
if (tabPlayer != null) {
teamName = Optional.ofNullable(sortingManager.getOriginalTeamName(tabPlayer)).orElse(playerName);
}
}
ProxiedPlayer proxiedPlayer = plugin.getProxy().getPlayer(playerName);
ByteArrayDataOutput byteArrayDataOutput = ByteStreams.newDataOutput();

View File

@@ -44,6 +44,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.plugin.PluginManager;
import org.bukkit.potion.PotionEffectType;
import org.jetbrains.annotations.Nullable;
import java.io.File;
@@ -250,7 +251,10 @@ public class ChatBubblesManager extends Function {
}
public void onChat(Player player, String text) {
if (player.getGameMode() == GameMode.SPECTATOR || !player.hasPermission("bubbles.use")) return;
if (player.getGameMode() == GameMode.SPECTATOR
|| player.hasPotionEffect(PotionEffectType.INVISIBILITY)
|| !player.hasPermission("bubbles.use")
) return;
String bubble = plugin.getDataManager().getEquippedBubble(player);
BubblesEvent bubblesEvent = new BubblesEvent(player, bubble, text);

View File

@@ -22,7 +22,6 @@ import net.momirealms.customnameplates.object.Function;
import net.momirealms.customnameplates.object.SimpleChar;
import net.momirealms.customnameplates.utils.AdventureUtils;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.Nullable;
import java.io.File;

View File

@@ -32,6 +32,7 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.entity.Pose;
import org.bukkit.potion.PotionEffectType;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -80,7 +81,10 @@ public class NamedEntityImpl implements NamedEntity {
@Override
public boolean canShow() {
if (requirements == null) return true;
if (owner.hasPotionEffect(PotionEffectType.INVISIBILITY))
return false;
if (requirements == null)
return true;
for (Requirement requirement : requirements) {
if (!requirement.isConditionMet(owner)) {
return false;

View File

@@ -17,14 +17,9 @@
package net.momirealms.customnameplates.object.carrier;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.events.PacketContainer;
import net.momirealms.customnameplates.CustomNameplates;
import net.momirealms.customnameplates.object.ConditionalText;
import net.momirealms.customnameplates.object.DisplayMode;
import net.momirealms.customnameplates.object.DynamicText;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import java.util.*;
@@ -79,6 +74,12 @@ public class NamedEntityManager {
fakeArmorStand.spawn(viewer);
}
public void spawn() {
for (Player player : nearbyPlayers) {
spawn(player);
}
}
public void refresh(boolean force) {
highestTextHeight = -2;
for (NamedEntity fakeArmorStand : namedEntityArray) {

View File

@@ -17,13 +17,9 @@
package net.momirealms.customnameplates.object.carrier;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.events.PacketEvent;
import net.momirealms.customnameplates.CustomNameplates;
import net.momirealms.customnameplates.listener.packet.*;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import java.util.List;