mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2024-09-11 01:38:07 +02:00
Cleaned up code
This commit is contained in:
parent
eac07595ee
commit
321ecdb3c2
@ -1,16 +1,14 @@
|
||||
package me.libraryaddict.disguise.disguisetypes;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.comphenix.protocol.wrappers.WrappedGameProfile;
|
||||
import me.libraryaddict.disguise.LibsDisguises;
|
||||
|
||||
import me.libraryaddict.disguise.disguisetypes.watchers.PlayerWatcher;
|
||||
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
||||
import me.libraryaddict.disguise.utilities.LibsProfileLookup;
|
||||
import me.libraryaddict.disguise.utilities.ReflectionManager;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class PlayerDisguise extends TargetedDisguise {
|
||||
|
||||
|
@ -90,8 +90,7 @@ public class DisguiseUtilities {
|
||||
block = ReflectionManager.getNmsClass("Block").getMethod("getById", int.class)
|
||||
.invoke(null, Material.BED_BLOCK.getId());
|
||||
} catch (Exception ex) {
|
||||
block = ((Object[]) ReflectionManager.getNmsField(ReflectionManager.getNmsClass("Block"), "byId").get(null))[Material.BED_BLOCK
|
||||
.getId()];
|
||||
block = ((Object[]) ReflectionManager.getNmsField(ReflectionManager.getNmsClass("Block"), "byId").get(null))[Material.BED_BLOCK.getId()];
|
||||
}
|
||||
Method fromLegacyData = block.getClass().getMethod("fromLegacyData", int.class);
|
||||
Method setType = chunkSection.getClass().getMethod("setType", int.class, int.class, int.class,
|
||||
@ -251,9 +250,7 @@ public class DisguiseUtilities {
|
||||
try {
|
||||
Object entityTrackerEntry = ReflectionManager.getEntityTrackerEntry(disguise.getEntity());
|
||||
if (entityTrackerEntry != null) {
|
||||
Set trackedPlayers = (Set) ReflectionManager.getNmsField("EntityTrackerEntry", "trackedPlayers").get(
|
||||
entityTrackerEntry);
|
||||
Object trackedPlayersObj = ReflectionManager.getNmsField("EntityTrackerEntry", "trackedPlayers").get(entityTrackerEntry);
|
||||
Set trackedPlayers = (Set) ReflectionManager.getNmsField("EntityTrackerEntry", "trackedPlayers").get(entityTrackerEntry);
|
||||
// If the tracker exists. Remove himself from his tracker
|
||||
trackedPlayers = new HashSet(trackedPlayers); //Copy before iterating to prevent ConcurrentModificationException
|
||||
PacketContainer destroyPacket = new PacketContainer(PacketType.Play.Server.ENTITY_DESTROY);
|
||||
@ -481,6 +478,7 @@ public class DisguiseUtilities {
|
||||
* Pass in a set, check if it's a hashset.
|
||||
* If it's not, return false.
|
||||
* If you pass in something else, you failed.
|
||||
*
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
@ -794,11 +792,6 @@ public class DisguiseUtilities {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static void removeGameprofile(String string) {
|
||||
removeGameProfile(string);
|
||||
}
|
||||
|
||||
public static void removeGameProfile(String string) {
|
||||
gameProfiles.remove(string.toLowerCase());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user