Class DisguiseUtilities

java.lang.Object
me.libraryaddict.disguise.utilities.DisguiseUtilities

public class DisguiseUtilities extends Object
  • Field Details

    • random

      public static final Random random
  • Constructor Details

    • DisguiseUtilities

      public DisguiseUtilities()
  • Method Details

    • isRunningPaper

      public static boolean isRunningPaper()
    • shouldBeHiddenSelfDisguise

      public static boolean shouldBeHiddenSelfDisguise(com.github.retrooper.packetevents.protocol.item.ItemStack itemStack)
    • shouldBeHiddenSelfDisguise

      public static boolean shouldBeHiddenSelfDisguise(org.bukkit.inventory.ItemStack itemStack)
    • isDisguisesSelfScalingAttribute

      public static boolean isDisguisesSelfScalingAttribute(org.bukkit.attribute.AttributeModifier modifier)
    • isDisguisesSelfScalingAttribute

      public static boolean isDisguisesSelfScalingAttribute(com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerUpdateAttributes.PropertyModifier modifier)
    • removeSelfDisguiseScale

      public static void removeSelfDisguiseScale(org.bukkit.entity.Entity entity)
    • getNameSpacing

      public static double getNameSpacing()
    • serialize

      public static String serialize(net.kyori.adventure.text.Component component)
    • doSkinUUIDWarning

      public static void doSkinUUIDWarning(org.bukkit.command.CommandSender sender)
    • addSaveAttempt

      public static void addSaveAttempt()
      Only allow saves every 2 minutes
    • getDisplayName

      public static String getDisplayName(org.bukkit.command.CommandSender commandSender)
    • adjustNamePositions

      public static void adjustNamePositions(Disguise disguise, me.libraryaddict.disguise.utilities.packets.LibsPackets<? extends com.github.retrooper.packetevents.wrapper.PacketWrapper> packets)
    • clone

      public static com.github.retrooper.packetevents.protocol.entity.EntityPositionData clone(com.github.retrooper.packetevents.protocol.entity.EntityPositionData data)
    • adjustNamePositions

      @Nullable public static @Nullable List<com.github.retrooper.packetevents.wrapper.PacketWrapper> adjustNamePositions(Disguise disguise, List<com.github.retrooper.packetevents.wrapper.PacketWrapper> packets)
    • getHexedColors

      public static String getHexedColors(String string)
    • getDisplayName

      public static String getDisplayName(String playerName)
    • saveViewPreferances

      public static void saveViewPreferances()
    • removeInvisibleSlime

      public static void removeInvisibleSlime(org.bukkit.entity.Player player)
    • sendInvisibleSlime

      public static void sendInvisibleSlime(org.bukkit.entity.Player player, int horseId, int[] passengers)
    • loadViewPreferences

      public static void loadViewPreferences()
    • setPlayerVelocity

      public static void setPlayerVelocity(org.bukkit.entity.Player player)
    • clearPlayerVelocity

      public static void clearPlayerVelocity(org.bukkit.entity.Player player)
    • isPlayerVelocity

      public static boolean isPlayerVelocity(org.bukkit.entity.Player player)
      Returns if this velocity is due to a PlayerVelocityEvent
    • setGrabSkinCommandUsed

      public static void setGrabSkinCommandUsed()
    • setGrabHeadCommandUsed

      public static void setGrabHeadCommandUsed()
    • setCopyDisguiseCommandUsed

      public static void setCopyDisguiseCommandUsed()
    • setSaveDisguiseCommandUsed

      public static void setSaveDisguiseCommandUsed()
    • isNotInteractable

      public static boolean isNotInteractable(int entityId)
    • isSpecialInteract

      public static boolean isSpecialInteract(int entityId)
    • setPluginsUsed

      public static void setPluginsUsed()
    • resetPluginTimer

      public static void resetPluginTimer()
    • setCommandsUsed

      public static void setCommandsUsed()
    • saveDisguises

      public static void saveDisguises()
    • hasUserProfile

      public static boolean hasUserProfile(String playername)
    • hasUserProfile

      public static boolean hasUserProfile(String playername, boolean checkSanityToo)
    • createClonedDisguise

      public static void createClonedDisguise(org.bukkit.entity.Player player, org.bukkit.entity.Entity toClone, Boolean[] options)
    • saveDisguises

      public static void saveDisguises(org.bukkit.entity.Entity owningEntity)
    • saveDisguises

      public static void saveDisguises(org.bukkit.entity.Entity owningEntity, Disguise[] disguise)
    • saveDisguises

      @Deprecated public static void saveDisguises(UUID owningEntity, Disguise[] disguise)
      Deprecated.
    • getSavedDisguises

      public static Disguise[] getSavedDisguises(org.bukkit.entity.Entity entity)
    • getSavedDisguises

      @Deprecated public static Disguise[] getSavedDisguises(UUID entityUUID)
      Deprecated.
    • removeSavedDisguise

      public static void removeSavedDisguise(UUID entityUUID)
    • isSavedDisguise

      public static boolean isSavedDisguise(UUID entityUUID)
    • addClonedDisguise

      public static boolean addClonedDisguise(String key, Disguise disguise)
    • addDisguise

      public static void addDisguise(Integer entityId, TargetedDisguise disguise)
    • onFutureDisguise

      public static void onFutureDisguise(org.bukkit.entity.Entity entity)
    • checkFutureDisguises

      public static void checkFutureDisguises(org.bukkit.entity.Entity entity, boolean failedToSpawn)
    • addFutureDisguise

      public static void addFutureDisguise(int entityId, TargetedDisguise disguise)
    • loadSanitySkinCache

      public static void loadSanitySkinCache() throws IOException
      Throws:
      IOException
    • saveSanitySkinCache

      public static void saveSanitySkinCache()
    • addUserProfile

      public static void addUserProfile(String string, com.github.retrooper.packetevents.protocol.player.UserProfile userProfile)
    • checkConflicts

      public static void checkConflicts(TargetedDisguise disguise, String name)
      If name isn't null. Make sure that the name doesn't see any other disguise. Else if name is null. Make sure that the observers in the disguise don't see any other disguise.
    • destroyEntity

      public static void destroyEntity(TargetedDisguise disguise)
      Sends entity removal packets, as this disguise was removed
    • doBoundingBox

      public static void doBoundingBox(TargetedDisguise disguise)
    • getChunkCord

      public static int getChunkCord(int blockCord)
    • getClonedDisguise

      public static Disguise getClonedDisguise(String key)
    • getDestroyPacket

      public static com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerDestroyEntities getDestroyPacket(int... ids)
    • getDisguise

      public static TargetedDisguise getDisguise(org.bukkit.entity.Player observer, org.bukkit.entity.Entity entity)
    • getDisguises

      public static TargetedDisguise[] getDisguises(Integer entityId)
    • getUserProfile

      public static com.github.retrooper.packetevents.protocol.player.UserProfile getUserProfile(String playerName)
    • getMainDisguise

      public static TargetedDisguise getMainDisguise(Integer entityId)
    • getPerverts

      public static List<org.bukkit.entity.Player> getPerverts(Disguise disguise)
      Get all EntityPlayers who have this entity in their Entity Tracker And they are in the targeted disguise.
      Parameters:
      disguise -
      Returns:
    • getProfileFromMojang

      public static com.github.retrooper.packetevents.protocol.player.UserProfile getProfileFromMojang(PlayerDisguise disguise)
    • getProfileFromMojang

      public static com.github.retrooper.packetevents.protocol.player.UserProfile getProfileFromMojang(String playerName, LibsProfileLookup runnableIfCantReturn)
      Thread safe to use. This returns a GameProfile. And if its GameProfile doesn't have a skin blob. Then it does a lookup using schedulers. The runnable is run once the GameProfile has been successfully dealt with
    • getProfileFromMojang

      public static com.github.retrooper.packetevents.protocol.player.UserProfile getProfileFromMojang(String playerName, LibsProfileLookup runnableIfCantReturn, boolean contactMojang)
      Thread safe to use. This returns a GameProfile. And if its GameProfile doesn't have a skin blob. Then it does a lookup using schedulers. The runnable is run once the GameProfile has been successfully dealt with
    • getMineSkinAPI

      public static MineSkinAPI getMineSkinAPI()
    • getProfileFromMojang

      public static com.github.retrooper.packetevents.protocol.player.UserProfile getProfileFromMojang(String playerName, Runnable runnableIfCantReturn)
      Thread safe to use. This returns a GameProfile. And if its GameProfile doesn't have a skin blob. Then it does a lookup using schedulers. The runnable is run once the GameProfile has been successfully dealt with
    • getProfileFromMojang

      public static com.github.retrooper.packetevents.protocol.player.UserProfile getProfileFromMojang(String playerName, Runnable runnableIfCantReturn, boolean contactMojang)
      Thread safe to use. This returns a GameProfile. And if its GameProfile doesn't have a skin blob. Then it does a lookup using schedulers. The runnable is run once the GameProfile has been successfully dealt with
    • recreateGsonSerializer

      public static void recreateGsonSerializer()
    • init

      public static void init()
    • isDisguiseInUse

      public static boolean isDisguiseInUse(Disguise disguise)
    • lookupUserProfile

      public static com.github.retrooper.packetevents.protocol.player.UserProfile lookupUserProfile(String playerName)
      This is called on a thread as it is thread blocking
    • refreshTracker

      public static void refreshTracker(TargetedDisguise disguise, String player)
      Resends the entity to this specific player
    • refreshTrackers

      public static void refreshTrackers(org.bukkit.entity.Entity entity)
      A convenience method for me to refresh trackers in other plugins
    • refreshTrackers

      public static void refreshTrackers(TargetedDisguise disguise)
      Resends the entity to all the watching players, which is where the magic begins
    • removeDisguise

      public static boolean removeDisguise(TargetedDisguise disguise)
    • removeUserProfile

      public static void removeUserProfile(String string)
    • removeSelfDisguise

      public static void removeSelfDisguise(Disguise disguise)
    • getAllScoreboards

      public static List<org.bukkit.scoreboard.Scoreboard> getAllScoreboards()
    • createExtendedName

      public static DisguiseUtilities.DScoreTeam createExtendedName(PlayerDisguise disguise)
    • getUniqueTeam

      public static String getUniqueTeam()
    • getUniqueTeam

      public static String getUniqueTeam(String prefix)
    • updateExtendedName

      public static void updateExtendedName(PlayerDisguise disguise)
    • registerExtendedName

      public static void registerExtendedName(PlayerDisguise disguise)
    • registerAllExtendedNames

      public static void registerAllExtendedNames(org.bukkit.scoreboard.Scoreboard scoreboard)
    • unregisterExtendedName

      public static void unregisterExtendedName(PlayerDisguise removed)
    • registerNoName

      public static void registerNoName(org.bukkit.scoreboard.Scoreboard scoreboard)
    • setGlowColor

      public static void setGlowColor(UUID uuid, org.bukkit.ChatColor color)
    • setGlowColor

      public static void setGlowColor(Disguise disguise, org.bukkit.ChatColor color)
    • getTeamName

      public static String getTeamName(org.bukkit.ChatColor color)
    • registerColors

      public static void registerColors(org.bukkit.scoreboard.Scoreboard scoreboard)
    • getExtendedNameSplit

      public static String[] getExtendedNameSplit(String playerName, String name)
    • quote

      public static String quote(String string)
    • quoteNewLine

      public static String quoteNewLine(String string)
    • splitNewLine

      public static String[] splitNewLine(String string)
    • split

      public static String[] split(String string)
    • getSlot

      public static org.bukkit.inventory.ItemStack getSlot(org.bukkit.inventory.PlayerInventory equip, org.bukkit.inventory.EquipmentSlot slot)
    • sendSelfDisguise

      public static void sendSelfDisguise(org.bukkit.entity.Player player, TargetedDisguise disguise)
      Sends the self disguise to the player
    • isTallDisguise

      public static boolean isTallDisguise(Disguise disguise)
    • getPlayerListName

      public static String getPlayerListName(org.bukkit.entity.Player player)
    • quoteHex

      public static String quoteHex(String string)
    • unquoteHex

      public static String unquoteHex(String string)
    • sendMessage

      public static void sendMessage(org.bukkit.command.CommandSender sender, net.kyori.adventure.text.Component component)
    • sendMessage

      public static void sendMessage(org.bukkit.command.CommandSender sender, String message)
    • sendMessage

      public static void sendMessage(org.bukkit.command.CommandSender sender, LibsMsg msg, Object... args)
    • getNumericVersion

      public static int[] getNumericVersion(String version)
    • getSimpleString

      public static String getSimpleString(net.kyori.adventure.text.Component component)
    • translateAlternateColorCodes

      public static String translateAlternateColorCodes(String string)
    • getName

      public static String getName(org.bukkit.ChatColor color)
    • getAdventureChat

      public static net.kyori.adventure.text.Component getAdventureChat(String message)
    • toBukkitItemStack

      public static org.bukkit.inventory.ItemStack toBukkitItemStack(com.github.retrooper.packetevents.protocol.item.ItemStack itemStack)
    • fromBukkitItemStack

      public static com.github.retrooper.packetevents.protocol.item.ItemStack fromBukkitItemStack(org.bukkit.inventory.ItemStack itemStack)
    • getColoredChat

      public static net.md_5.bungee.api.chat.BaseComponent[] getColoredChat(String message)
    • sendPacketEventsUpdateMessage

      public static void sendPacketEventsUpdateMessage(org.bukkit.command.CommandSender p, String version, String requiredPacketEvents)
    • isOlderThan

      public static boolean isOlderThan(String requiredVersion, String theirVersion)
      Returns if "theirVersion" is older than "requiredVersion"

      "1.0" and "1.5" will return false "1.5" and "1.0" will return true

    • unsafeClone

      public static com.github.retrooper.packetevents.wrapper.PacketWrapper unsafeClone(com.github.retrooper.packetevents.event.simple.PacketPlaySendEvent eventForConstructor, com.github.retrooper.packetevents.wrapper.PacketWrapper wrapper)
    • constructWrapper

      public static com.github.retrooper.packetevents.wrapper.PacketWrapper constructWrapper(com.github.retrooper.packetevents.event.simple.PacketPlaySendEvent event)
    • getEntityId

      public static Integer getEntityId(com.github.retrooper.packetevents.wrapper.PacketWrapper wrapper)
    • writeSelfDisguiseId

      public static void writeSelfDisguiseId(int playerId, com.github.retrooper.packetevents.wrapper.PacketWrapper wrapper)
    • isRegistered

      public static boolean isRegistered(com.github.retrooper.packetevents.protocol.mapper.MappedEntity mappedEntity)
    • setupFakeDisguise

      public static void setupFakeDisguise(Disguise disguise)
      Setup it so he can see their own disguise when disguised
      Parameters:
      disguise -
    • createDatawatcher

      public static List<com.github.retrooper.packetevents.protocol.entity.data.EntityData<?>> createDatawatcher(List<me.libraryaddict.disguise.utilities.reflection.WatcherValue> watcherValues)
    • createSanitizedWatcherValues

      public static List<me.libraryaddict.disguise.utilities.reflection.WatcherValue> createSanitizedWatcherValues(org.bukkit.entity.Player player, org.bukkit.entity.Entity disguisedEntity, FlagWatcher flagWatcher)
    • getPitch

      public static float getPitch(DisguiseType disguiseType, org.bukkit.entity.EntityType entityType, float value)
    • getPitch

      public static float getPitch(DisguiseType disguiseType, DisguiseType entityType, float value)
    • getPitch

      public static float getPitch(DisguiseType disguiseType, float value)
    • getYaw

      public static float getYaw(DisguiseType disguiseType, org.bukkit.entity.EntityType entityType, float value)
    • getYaw

      public static float getYaw(DisguiseType disguiseType, DisguiseType entityType, float value)
    • getHangingDirection

      public static com.github.retrooper.packetevents.protocol.world.Direction getHangingDirection(float yaw)
    • getYaw

      public static float getYaw(DisguiseType disguiseType, float value)
      Add the yaw for the disguises
    • getClampedScale

      public static double getClampedScale(double scale)
    • updateTablistVisibility

      public static com.github.retrooper.packetevents.wrapper.PacketWrapper<?> updateTablistVisibility(org.bukkit.entity.Player player, boolean visible)
    • createTablistAddPackets

      public static com.github.retrooper.packetevents.wrapper.PacketWrapper<?> createTablistAddPackets(PlayerDisguise disguise)
    • createTablistPacket

      public static com.github.retrooper.packetevents.wrapper.PacketWrapper<?> createTablistPacket(PlayerDisguise disguise, com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerInfo.Action action)
    • getNamePackets

      public static List<com.github.retrooper.packetevents.wrapper.PacketWrapper<?>> getNamePackets(Disguise disguise, org.bukkit.entity.Player viewer, String[] internalOldNames)
    • getEntityScaleWithoutLibsDisguises

      public static double getEntityScaleWithoutLibsDisguises(org.bukkit.entity.Entity entity)
      Grabs the scale of the entity as if the LibsDisguises: attributes did not exist, is clamped to 0.06 to 16
    • getDisguise

      public static Disguise getDisguise(org.bukkit.entity.Player observer, int entityId)
    • getYModifier

      public static double getYModifier(Disguise disguise)
      Get the Y level to add to the disguise for realism.
    • getEquipment

      public static org.bukkit.inventory.ItemStack getEquipment(org.bukkit.inventory.EquipmentSlot slot, org.bukkit.entity.Entity disguisedEntity)
      Gets equipment from this entity based on the slot given.
      Parameters:
      slot -
      Returns:
      null if the disguisedEntity is not an instance of a living entity
    • getSlot

      public static org.bukkit.inventory.EquipmentSlot getSlot(com.github.retrooper.packetevents.protocol.player.EquipmentSlot slot)
    • getSlot

      public static com.github.retrooper.packetevents.protocol.player.EquipmentSlot getSlot(org.bukkit.inventory.EquipmentSlot slot)