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