mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2025-03-02 04:01:26 +01:00
Disable fancy hidden tabs if ViaBackwards is in the server
This commit is contained in:
parent
ccce16da69
commit
b098e2028d
@ -184,7 +184,7 @@ public abstract class Disguise {
|
||||
ArrayList<PacketContainer> packets = DisguiseUtilities.getNamePackets(this, oldName);
|
||||
|
||||
for (Player player : DisguiseUtilities.getPerverts(this)) {
|
||||
if (!NmsVersion.v1_19_R2.isSupported() && isPlayerDisguise() &&
|
||||
if (!DisguiseUtilities.isFancyHiddenTabs() && isPlayerDisguise() &&
|
||||
LibsDisguises.getInstance().getSkinHandler().isSleeping(player, (PlayerDisguise) this)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -511,7 +511,7 @@ public class FlagWatcher {
|
||||
ArrayList<PacketContainer> packets = DisguiseUtilities.getNamePackets(getDisguise(), new String[0]);
|
||||
|
||||
for (Player player : DisguiseUtilities.getPerverts(getDisguise())) {
|
||||
if (!NmsVersion.v1_19_R2.isSupported() && getDisguise().isPlayerDisguise() &&
|
||||
if (!DisguiseUtilities.isFancyHiddenTabs() && getDisguise().isPlayerDisguise() &&
|
||||
LibsDisguises.getInstance().getSkinHandler().isSleeping(player, (PlayerDisguise) getDisguise())) {
|
||||
continue;
|
||||
}
|
||||
|
@ -254,7 +254,8 @@ public class DisguiseUtilities {
|
||||
private final static boolean java16;
|
||||
private static boolean criedOverJava16;
|
||||
private static final HashSet<UUID> warnedSkin = new HashSet<>();
|
||||
private static Boolean adventureTextSupport;
|
||||
@Getter
|
||||
private static boolean fancyHiddenTabs;
|
||||
|
||||
static {
|
||||
final Matcher matcher = Pattern.compile("(?:1\\.)?(\\d+)").matcher(System.getProperty("java.version"));
|
||||
@ -1435,6 +1436,8 @@ public class DisguiseUtilities {
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
|
||||
fancyHiddenTabs = NmsVersion.v1_19_R2.isSupported() && Bukkit.getPluginManager().getPlugin("ViaBackwards") == null;
|
||||
|
||||
GsonBuilder gsonBuilder = new GsonBuilder();
|
||||
|
||||
gsonBuilder.disableHtmlEscaping();
|
||||
|
@ -151,16 +151,15 @@ public class PacketHandlerSpawn implements IPacketHandler {
|
||||
double dist = observer.getLocation().toVector().distanceSquared(disguisedEntity.getLocation().toVector());
|
||||
|
||||
// If self disguise, or further than 50 blocks, or not in front of entity
|
||||
inLineOfSight =
|
||||
NmsVersion.v1_19_R2.isSupported() || observer == disguisedEntity || disguisedEntity.getPassengers().contains(observer) || dist > (50 * 50) ||
|
||||
(observer.getLocation().add(observer.getLocation().getDirection().normalize()).toVector()
|
||||
.distanceSquared(disguisedEntity.getLocation().toVector()) - dist) < 0.3;
|
||||
inLineOfSight = DisguiseUtilities.isFancyHiddenTabs() || observer == disguisedEntity || disguisedEntity.getPassengers().contains(observer) ||
|
||||
dist > (50 * 50) || (observer.getLocation().add(observer.getLocation().getDirection().normalize()).toVector()
|
||||
.distanceSquared(disguisedEntity.getLocation().toVector()) - dist) < 0.3;
|
||||
|
||||
int entityId = disguisedEntity.getEntityId();
|
||||
|
||||
PlayerSkinHandler.PlayerSkin skin;
|
||||
|
||||
if (NmsVersion.v1_19_R2.isSupported() || !playerDisguise.isDisplayedInTab() || !playerDisguise.isNameVisible()) {
|
||||
if (DisguiseUtilities.isFancyHiddenTabs() || !playerDisguise.isDisplayedInTab() || !playerDisguise.isNameVisible()) {
|
||||
// Send player info along with the disguise
|
||||
|
||||
for (PacketContainer sendTab : ReflectionManager.createTablistAddPackets(playerDisguise)) {
|
||||
@ -168,7 +167,7 @@ public class PacketHandlerSpawn implements IPacketHandler {
|
||||
}
|
||||
|
||||
skin = LibsDisguises.getInstance().getSkinHandler().addPlayerSkin(observer, playerDisguise);
|
||||
skin.setDoTabList(!NmsVersion.v1_19_R2.isSupported());
|
||||
skin.setDoTabList(!DisguiseUtilities.isFancyHiddenTabs());
|
||||
|
||||
if (LibsPremium.getPaidInformation() != null && !LibsPremium.getPaidInformation().getBuildNumber().matches("#\\d+")) {
|
||||
skin.getSleptPackets().computeIfAbsent(0, (a) -> new ArrayList<>()).add(new PacketContainer(PacketType.Play.Server.HELD_ITEM_SLOT));
|
||||
|
Loading…
Reference in New Issue
Block a user