Class DisguiseUtilities
java.lang.Object
me.libraryaddict.disguise.utilities.DisguiseUtilities
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
addClonedDisguise
(String key, Disguise disguise) static void
addDisguise
(Integer entityId, TargetedDisguise disguise) static void
addFutureDisguise
(int entityId, TargetedDisguise disguise) static void
Only allow saves every 2 minutesstatic void
addUserProfile
(String string, com.github.retrooper.packetevents.protocol.player.UserProfile userProfile) static @Nullable List
<com.github.retrooper.packetevents.wrapper.PacketWrapper> adjustNamePositions
(Disguise disguise, List<com.github.retrooper.packetevents.wrapper.PacketWrapper> packets) static void
adjustNamePositions
(Disguise disguise, me.libraryaddict.disguise.utilities.packets.LibsPackets<? extends com.github.retrooper.packetevents.wrapper.PacketWrapper> packets) static void
checkConflicts
(TargetedDisguise disguise, String name) If name isn't null.static void
checkFutureDisguises
(org.bukkit.entity.Entity entity, boolean failedToSpawn) static void
clearPlayerVelocity
(org.bukkit.entity.Player player) static com.github.retrooper.packetevents.protocol.entity.EntityPositionData
clone
(com.github.retrooper.packetevents.protocol.entity.EntityPositionData data) static com.github.retrooper.packetevents.wrapper.PacketWrapper
constructWrapper
(com.github.retrooper.packetevents.event.simple.PacketPlaySendEvent event) static void
createClonedDisguise
(org.bukkit.entity.Player player, org.bukkit.entity.Entity toClone, Boolean[] options) static List
<com.github.retrooper.packetevents.protocol.entity.data.EntityData<?>> createDatawatcher
(List<me.libraryaddict.disguise.utilities.reflection.WatcherValue> watcherValues) static DisguiseUtilities.DScoreTeam
createExtendedName
(PlayerDisguise disguise) static List
<me.libraryaddict.disguise.utilities.reflection.WatcherValue> createSanitizedWatcherValues
(org.bukkit.entity.Player player, org.bukkit.entity.Entity disguisedEntity, FlagWatcher flagWatcher) static com.github.retrooper.packetevents.wrapper.PacketWrapper
<?> createTablistAddPackets
(PlayerDisguise disguise) static com.github.retrooper.packetevents.wrapper.PacketWrapper
<?> createTablistPacket
(PlayerDisguise disguise, com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerInfo.Action action) static void
destroyEntity
(TargetedDisguise disguise) Sends entity removal packets, as this disguise was removedstatic void
doBoundingBox
(TargetedDisguise disguise) static void
doSkinUUIDWarning
(org.bukkit.command.CommandSender sender) static com.github.retrooper.packetevents.protocol.item.ItemStack
fromBukkitItemStack
(org.bukkit.inventory.ItemStack itemStack) static net.kyori.adventure.text.Component
getAdventureChat
(String message) static List
<org.bukkit.scoreboard.Scoreboard> static int
getChunkCord
(int blockCord) static double
getClampedScale
(double scale) static Disguise
getClonedDisguise
(String key) static net.md_5.bungee.api.chat.BaseComponent[]
getColoredChat
(String message) static com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerDestroyEntities
getDestroyPacket
(int... ids) static Disguise
getDisguise
(org.bukkit.entity.Player observer, int entityId) static TargetedDisguise
getDisguise
(org.bukkit.entity.Player observer, org.bukkit.entity.Entity entity) static TargetedDisguise[]
getDisguises
(Integer entityId) static String
getDisplayName
(String playerName) static String
getDisplayName
(org.bukkit.command.CommandSender commandSender) static Integer
getEntityId
(com.github.retrooper.packetevents.wrapper.PacketWrapper wrapper) 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 16static 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.static String[]
getExtendedNameSplit
(String playerName, String name) static com.github.retrooper.packetevents.protocol.world.Direction
getHangingDirection
(float yaw) static String
getHexedColors
(String string) static TargetedDisguise
getMainDisguise
(Integer entityId) static MineSkinAPI
static String
getName
(org.bukkit.ChatColor color) static List
<com.github.retrooper.packetevents.wrapper.PacketWrapper<?>> getNamePackets
(Disguise disguise, org.bukkit.entity.Player viewer, String[] internalOldNames) static double
static int[]
getNumericVersion
(String version) 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.static float
getPitch
(DisguiseType disguiseType, float value) static float
getPitch
(DisguiseType disguiseType, DisguiseType entityType, float value) static float
getPitch
(DisguiseType disguiseType, org.bukkit.entity.EntityType entityType, float value) static String
getPlayerListName
(org.bukkit.entity.Player player) static com.github.retrooper.packetevents.protocol.player.UserProfile
getProfileFromMojang
(String playerName, Runnable runnableIfCantReturn) Thread safe to use.static com.github.retrooper.packetevents.protocol.player.UserProfile
getProfileFromMojang
(String playerName, Runnable runnableIfCantReturn, boolean contactMojang) Thread safe to use.static com.github.retrooper.packetevents.protocol.player.UserProfile
getProfileFromMojang
(String playerName, LibsProfileLookup runnableIfCantReturn) Thread safe to use.static com.github.retrooper.packetevents.protocol.player.UserProfile
getProfileFromMojang
(String playerName, LibsProfileLookup runnableIfCantReturn, boolean contactMojang) Thread safe to use.static com.github.retrooper.packetevents.protocol.player.UserProfile
getProfileFromMojang
(PlayerDisguise disguise) static Disguise[]
getSavedDisguises
(UUID entityUUID) Deprecated.static Disguise[]
getSavedDisguises
(org.bukkit.entity.Entity entity) static String
getSimpleString
(net.kyori.adventure.text.Component component) static org.bukkit.inventory.EquipmentSlot
getSlot
(com.github.retrooper.packetevents.protocol.player.EquipmentSlot slot) static com.github.retrooper.packetevents.protocol.player.EquipmentSlot
getSlot
(org.bukkit.inventory.EquipmentSlot slot) static org.bukkit.inventory.ItemStack
getSlot
(org.bukkit.inventory.PlayerInventory equip, org.bukkit.inventory.EquipmentSlot slot) static String
getTeamName
(org.bukkit.ChatColor color) static String
static String
getUniqueTeam
(String prefix) static com.github.retrooper.packetevents.protocol.player.UserProfile
getUserProfile
(String playerName) static float
getYaw
(DisguiseType disguiseType, float value) Add the yaw for the disguisesstatic float
getYaw
(DisguiseType disguiseType, DisguiseType entityType, float value) static float
getYaw
(DisguiseType disguiseType, org.bukkit.entity.EntityType entityType, float value) static double
getYModifier
(Disguise disguise) Get the Y level to add to the disguise for realism.static boolean
hasUserProfile
(String playername) static boolean
hasUserProfile
(String playername, boolean checkSanityToo) static void
init()
static boolean
isDisguiseInUse
(Disguise disguise) static boolean
isDisguisesSelfScalingAttribute
(com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerUpdateAttributes.PropertyModifier modifier) static boolean
isDisguisesSelfScalingAttribute
(org.bukkit.attribute.AttributeModifier modifier) static boolean
isNotInteractable
(int entityId) static boolean
isOlderThan
(String requiredVersion, String theirVersion) Returns if "theirVersion" is older than "requiredVersion"static boolean
isPlayerVelocity
(org.bukkit.entity.Player player) Returns if this velocity is due to a PlayerVelocityEventstatic boolean
isRegistered
(com.github.retrooper.packetevents.protocol.mapper.MappedEntity mappedEntity) static boolean
static boolean
isSavedDisguise
(UUID entityUUID) static boolean
isSpecialInteract
(int entityId) static boolean
isTallDisguise
(Disguise disguise) static void
static void
static com.github.retrooper.packetevents.protocol.player.UserProfile
lookupUserProfile
(String playerName) This is called on a thread as it is thread blockingstatic void
onFutureDisguise
(org.bukkit.entity.Entity entity) static String
static String
static String
quoteNewLine
(String string) static void
static void
refreshTracker
(TargetedDisguise disguise, String player) Resends the entity to this specific playerstatic void
refreshTrackers
(TargetedDisguise disguise) Resends the entity to all the watching players, which is where the magic beginsstatic void
refreshTrackers
(org.bukkit.entity.Entity entity) A convenience method for me to refresh trackers in other pluginsstatic void
registerAllExtendedNames
(org.bukkit.scoreboard.Scoreboard scoreboard) static void
registerColors
(org.bukkit.scoreboard.Scoreboard scoreboard) static void
registerExtendedName
(PlayerDisguise disguise) static void
registerNoName
(org.bukkit.scoreboard.Scoreboard scoreboard) static boolean
removeDisguise
(TargetedDisguise disguise) static void
removeInvisibleSlime
(org.bukkit.entity.Player player) static void
removeSavedDisguise
(UUID entityUUID) static void
removeSelfDisguise
(Disguise disguise) static void
removeSelfDisguiseScale
(org.bukkit.entity.Entity entity) static void
removeUserProfile
(String string) static void
static void
static void
saveDisguises
(UUID owningEntity, Disguise[] disguise) Deprecated.static void
saveDisguises
(org.bukkit.entity.Entity owningEntity) static void
saveDisguises
(org.bukkit.entity.Entity owningEntity, Disguise[] disguise) static void
static void
static void
sendInvisibleSlime
(org.bukkit.entity.Player player, int horseId, int[] passengers) static void
sendMessage
(org.bukkit.command.CommandSender sender, String message) static void
sendMessage
(org.bukkit.command.CommandSender sender, LibsMsg msg, Object... args) static void
sendMessage
(org.bukkit.command.CommandSender sender, net.kyori.adventure.text.Component component) static void
sendPacketEventsUpdateMessage
(org.bukkit.command.CommandSender p, String version, String requiredPacketEvents) static void
sendSelfDisguise
(org.bukkit.entity.Player player, TargetedDisguise disguise) Sends the self disguise to the playerstatic String
serialize
(net.kyori.adventure.text.Component component) static void
static void
static void
setGlowColor
(UUID uuid, org.bukkit.ChatColor color) static void
setGlowColor
(Disguise disguise, org.bukkit.ChatColor color) static void
static void
static void
setPlayerVelocity
(org.bukkit.entity.Player player) static void
static void
static void
setupFakeDisguise
(Disguise disguise) Setup it so he can see their own disguise when disguisedstatic boolean
shouldBeHiddenSelfDisguise
(com.github.retrooper.packetevents.protocol.item.ItemStack itemStack) static boolean
shouldBeHiddenSelfDisguise
(org.bukkit.inventory.ItemStack itemStack) static String[]
static String[]
splitNewLine
(String string) static org.bukkit.inventory.ItemStack
toBukkitItemStack
(com.github.retrooper.packetevents.protocol.item.ItemStack itemStack) static String
translateAlternateColorCodes
(String string) static String
unquoteHex
(String string) static void
unregisterExtendedName
(PlayerDisguise removed) static com.github.retrooper.packetevents.wrapper.PacketWrapper
unsafeClone
(com.github.retrooper.packetevents.event.simple.PacketPlaySendEvent eventForConstructor, com.github.retrooper.packetevents.wrapper.PacketWrapper wrapper) static void
updateExtendedName
(PlayerDisguise disguise) static com.github.retrooper.packetevents.wrapper.PacketWrapper
<?> updateTablistVisibility
(org.bukkit.entity.Player player, boolean visible) static void
writeSelfDisguiseId
(int playerId, com.github.retrooper.packetevents.wrapper.PacketWrapper wrapper)
-
Field Details
-
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
-
doSkinUUIDWarning
public static void doSkinUUIDWarning(org.bukkit.command.CommandSender sender) -
addSaveAttempt
public static void addSaveAttempt()Only allow saves every 2 minutes -
getDisplayName
-
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
-
getHexedColors
-
getDisplayName
-
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
-
hasUserProfile
-
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
-
saveDisguises
Deprecated. -
getSavedDisguises
-
getSavedDisguises
Deprecated. -
removeSavedDisguise
-
isSavedDisguise
-
addClonedDisguise
-
addDisguise
-
onFutureDisguise
public static void onFutureDisguise(org.bukkit.entity.Entity entity) -
checkFutureDisguises
public static void checkFutureDisguises(org.bukkit.entity.Entity entity, boolean failedToSpawn) -
addFutureDisguise
-
loadSanitySkinCache
- Throws:
IOException
-
saveSanitySkinCache
public static void saveSanitySkinCache() -
addUserProfile
public static void addUserProfile(String string, com.github.retrooper.packetevents.protocol.player.UserProfile userProfile) -
checkConflicts
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
Sends entity removal packets, as this disguise was removed -
doBoundingBox
-
getChunkCord
public static int getChunkCord(int blockCord) -
getClonedDisguise
-
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
-
getUserProfile
public static com.github.retrooper.packetevents.protocol.player.UserProfile getUserProfile(String playerName) -
getMainDisguise
-
getPerverts
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
-
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
-
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
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
Resends the entity to all the watching players, which is where the magic begins -
removeDisguise
-
removeUserProfile
-
removeSelfDisguise
-
getAllScoreboards
-
createExtendedName
-
getUniqueTeam
-
getUniqueTeam
-
updateExtendedName
-
registerExtendedName
-
registerAllExtendedNames
public static void registerAllExtendedNames(org.bukkit.scoreboard.Scoreboard scoreboard) -
unregisterExtendedName
-
registerNoName
public static void registerNoName(org.bukkit.scoreboard.Scoreboard scoreboard) -
setGlowColor
-
setGlowColor
-
getTeamName
-
registerColors
public static void registerColors(org.bukkit.scoreboard.Scoreboard scoreboard) -
getExtendedNameSplit
-
quote
-
quoteNewLine
-
splitNewLine
-
split
-
getSlot
public static org.bukkit.inventory.ItemStack getSlot(org.bukkit.inventory.PlayerInventory equip, org.bukkit.inventory.EquipmentSlot slot) -
sendSelfDisguise
Sends the self disguise to the player -
isTallDisguise
-
getPlayerListName
-
quoteHex
-
unquoteHex
-
sendMessage
public static void sendMessage(org.bukkit.command.CommandSender sender, net.kyori.adventure.text.Component component) -
sendMessage
-
sendMessage
-
getNumericVersion
-
getSimpleString
-
translateAlternateColorCodes
-
getName
-
getAdventureChat
-
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
-
sendPacketEventsUpdateMessage
-
isOlderThan
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
-
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
Setup it so he can see their own disguise when disguised- Parameters:
disguise
-
-
createDatawatcher
-
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
-
getPitch
-
getYaw
public static float getYaw(DisguiseType disguiseType, org.bukkit.entity.EntityType entityType, float value) -
getYaw
-
getHangingDirection
public static com.github.retrooper.packetevents.protocol.world.Direction getHangingDirection(float yaw) -
getYaw
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
-
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
-
getYModifier
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)
-