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