Add support for 1.8 disguises
This commit is contained in:
parent
3d99e4975a
commit
8cecfe98d6
@ -10,11 +10,14 @@ import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import me.libraryaddict.disguise.commands.*;
|
||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
|
||||
import me.libraryaddict.disguise.disguisetypes.FutureDisguiseType;
|
||||
import me.libraryaddict.disguise.disguisetypes.watchers.AgeableWatcher;
|
||||
import me.libraryaddict.disguise.disguisetypes.watchers.GuardianWatcher;
|
||||
import me.libraryaddict.disguise.disguisetypes.watchers.HorseWatcher;
|
||||
import me.libraryaddict.disguise.disguisetypes.watchers.LivingWatcher;
|
||||
import me.libraryaddict.disguise.disguisetypes.watchers.MinecartWatcher;
|
||||
@ -23,9 +26,11 @@ import me.libraryaddict.disguise.disguisetypes.watchers.TameableWatcher;
|
||||
import me.libraryaddict.disguise.disguisetypes.watchers.ZombieWatcher;
|
||||
import me.libraryaddict.disguise.utilities.DisguiseSound;
|
||||
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
||||
import me.libraryaddict.disguise.utilities.FakeBoundingBox;
|
||||
import me.libraryaddict.disguise.utilities.PacketsManager;
|
||||
import me.libraryaddict.disguise.utilities.ReflectionManager;
|
||||
import me.libraryaddict.disguise.utilities.DisguiseValues;
|
||||
import me.libraryaddict.disguise.utilities.ReflectionManager.LibVersion;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Ageable;
|
||||
@ -149,7 +154,7 @@ public class LibsDisguises extends JavaPlugin {
|
||||
*/
|
||||
private void registerValues() {
|
||||
for (DisguiseType disguiseType : DisguiseType.values()) {
|
||||
if (disguiseType.getEntityType() == null) {
|
||||
if (disguiseType.getEntityType() == null && !(disguiseType.is1_8() && LibVersion.is1_8())) {
|
||||
continue;
|
||||
}
|
||||
Class watcherClass = null;
|
||||
@ -176,6 +181,9 @@ public class LibsDisguises extends JavaPlugin {
|
||||
case MAGMA_CUBE:
|
||||
watcherClass = SlimeWatcher.class;
|
||||
break;
|
||||
case ELDER_GUARDIAN:
|
||||
watcherClass = GuardianWatcher.class;
|
||||
break;
|
||||
default:
|
||||
watcherClass = Class.forName("me.libraryaddict.disguise.disguisetypes.watchers."
|
||||
+ toReadable(disguiseType.name()) + "Watcher");
|
||||
@ -195,6 +203,28 @@ public class LibsDisguises extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
disguiseType.setWatcherClass(watcherClass);
|
||||
if (DisguiseValues.getDisguiseValues(disguiseType) != null) {
|
||||
continue;
|
||||
}
|
||||
if (disguiseType.is1_8()) {
|
||||
int entitySize = 0;
|
||||
FutureDisguiseType futureType = disguiseType.getFutureType();
|
||||
DisguiseValues disguiseValues = new DisguiseValues(disguiseType, null, entitySize, futureType.getMaxHealth());
|
||||
Object[] objs = disguiseType.getFutureType().getDataWatcher();
|
||||
for (int i = 0; i < objs.length; i += 2) {
|
||||
disguiseValues.setMetaValue((Integer) objs[i], objs[i + 1]);
|
||||
}
|
||||
|
||||
// Get the bounding box
|
||||
float[] box = futureType.getBoundingBox();
|
||||
disguiseValues.setAdultBox(new FakeBoundingBox(box[0], box[1], box[2]));
|
||||
/* if (disguiseType == DisguiseType.RABBIT) {
|
||||
((Ageable) bukkitEntity).setBaby();
|
||||
disguiseValues.setBabyBox(ReflectionManager.getBoundingBox(bukkitEntity));
|
||||
}
|
||||
disguiseValues.setEntitySize(ReflectionManager.getSize(bukkitEntity));*/
|
||||
continue;
|
||||
}
|
||||
String nmsEntityName = toReadable(disguiseType.name());
|
||||
switch (disguiseType) {
|
||||
case WITHER_SKELETON:
|
||||
@ -234,9 +264,6 @@ public class LibsDisguises extends JavaPlugin {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (DisguiseValues.getDisguiseValues(disguiseType) != null) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
Object nmsEntity = ReflectionManager.createEntityInstance(nmsEntityName);
|
||||
if (nmsEntity == null) {
|
||||
@ -292,7 +319,6 @@ public class LibsDisguises extends JavaPlugin {
|
||||
.print("[LibsDisguises] Development builds are available at (ProtocolLib) "
|
||||
+ "http://assets.comphenix.net/job/ProtocolLib/ and (LibsDisguises) http://ci.md-5.net/job/LibsDisguises/");
|
||||
}
|
||||
System.out.print("[LibsDisguises] Note that these builds have not been reviewed by Bukkit for safety.");
|
||||
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
||||
import me.libraryaddict.disguise.utilities.PacketsManager;
|
||||
import me.libraryaddict.disguise.utilities.ReflectionManager;
|
||||
import me.libraryaddict.disguise.utilities.DisguiseValues;
|
||||
import me.libraryaddict.disguise.utilities.ReflectionManager.LibVersion;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@ -63,7 +64,7 @@ public abstract class Disguise {
|
||||
protected void createDisguise(DisguiseType newType) {
|
||||
if (getWatcher() != null)
|
||||
return;
|
||||
if (newType.getEntityType() == null) {
|
||||
if (!(LibVersion.is1_8() && newType.is1_8()) && newType.getEntityType() == null) {
|
||||
throw new RuntimeException(
|
||||
"DisguiseType "
|
||||
+ newType
|
||||
@ -634,16 +635,19 @@ public abstract class Disguise {
|
||||
}
|
||||
Class nmsEntityClass = ReflectionManager.getNmsEntity(getEntity()).getClass();
|
||||
Class nmsDisguiseClass = DisguiseValues.getNmsEntityClass(getType());
|
||||
// If they both extend the same base class. They OBVIOUSLY share the same datavalue. Right..?
|
||||
if (baseClass != null && baseClass.isAssignableFrom(nmsDisguiseClass) && baseClass.isAssignableFrom(nmsEntityClass))
|
||||
continue;
|
||||
if (nmsDisguiseClass != null) {
|
||||
// If they both extend the same base class. They OBVIOUSLY share the same datavalue. Right..?
|
||||
if (baseClass != null && baseClass.isAssignableFrom(nmsDisguiseClass)
|
||||
&& baseClass.isAssignableFrom(nmsEntityClass))
|
||||
continue;
|
||||
|
||||
// So they don't extend a basic class.
|
||||
// Maybe if I check that they extend each other..
|
||||
// Seeing as I only store the finished forms of entitys. This should raise no problems and allow for more shared
|
||||
// datawatchers.
|
||||
if (nmsEntityClass.isAssignableFrom(nmsDisguiseClass) || nmsDisguiseClass.isAssignableFrom(nmsEntityClass))
|
||||
continue;
|
||||
// So they don't extend a basic class.
|
||||
// Maybe if I check that they extend each other..
|
||||
// Seeing as I only store the finished forms of entitys. This should raise no problems and allow for more shared
|
||||
// datawatchers.
|
||||
if (nmsEntityClass.isAssignableFrom(nmsDisguiseClass) || nmsDisguiseClass.isAssignableFrom(nmsEntityClass))
|
||||
continue;
|
||||
}
|
||||
// Well I can't find a reason I should leave it alone. They will probably conflict.
|
||||
// Time to set the value to the disguises value so no conflicts!
|
||||
getWatcher().setBackupValue(dataNo, disguiseValues.get(dataNo));
|
||||
|
@ -2,6 +2,8 @@ package me.libraryaddict.disguise.disguisetypes;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import me.libraryaddict.disguise.utilities.ReflectionManager.LibVersion;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
@ -10,6 +12,8 @@ import org.bukkit.entity.Skeleton;
|
||||
import org.bukkit.entity.Zombie;
|
||||
|
||||
public enum DisguiseType {
|
||||
ARMOR_STAND(FutureDisguiseType.ARMOR_STAND),
|
||||
|
||||
ARROW(60),
|
||||
|
||||
BAT,
|
||||
@ -32,6 +36,8 @@ public enum DisguiseType {
|
||||
|
||||
EGG(62),
|
||||
|
||||
ELDER_GUARDIAN(FutureDisguiseType.ELDER_GUARDIAN),
|
||||
|
||||
ENDER_CRYSTAL(51),
|
||||
|
||||
ENDER_DRAGON,
|
||||
@ -42,6 +48,8 @@ public enum DisguiseType {
|
||||
|
||||
ENDERMAN,
|
||||
|
||||
ENDERMITE(FutureDisguiseType.ENDERMITE),
|
||||
|
||||
EXPERIENCE_ORB,
|
||||
|
||||
FALLING_BLOCK(70, 1),
|
||||
@ -56,6 +64,8 @@ public enum DisguiseType {
|
||||
|
||||
GIANT,
|
||||
|
||||
GUARDIAN(FutureDisguiseType.GUARDIAN),
|
||||
|
||||
HORSE,
|
||||
|
||||
IRON_GOLEM,
|
||||
@ -96,6 +106,8 @@ public enum DisguiseType {
|
||||
|
||||
PRIMED_TNT(50),
|
||||
|
||||
RABBIT(FutureDisguiseType.RABBIT),
|
||||
|
||||
SHEEP,
|
||||
|
||||
SILVERFISH,
|
||||
@ -232,9 +244,10 @@ public enum DisguiseType {
|
||||
|
||||
private int defaultId, entityId;
|
||||
private EntityType entityType;
|
||||
private FutureDisguiseType futureType;
|
||||
private Class<? extends FlagWatcher> watcherClass;
|
||||
|
||||
private DisguiseType(int... ints) {
|
||||
private DisguiseType(FutureDisguiseType disguiseType, int... ints) {
|
||||
for (int i = 0; i < ints.length; i++) {
|
||||
int value = ints[i];
|
||||
switch (i) {
|
||||
@ -248,12 +261,29 @@ public enum DisguiseType {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (LibVersion.is1_8()) {
|
||||
futureType = disguiseType;
|
||||
}
|
||||
}
|
||||
|
||||
private DisguiseType(int... ints) {
|
||||
this(null, ints);
|
||||
}
|
||||
|
||||
public int getDefaultId() {
|
||||
return defaultId;
|
||||
}
|
||||
|
||||
public Class<? extends Entity> getEntityClass() {
|
||||
if (futureType != null) {
|
||||
return futureType.getEntityClass();
|
||||
}
|
||||
if (entityType != null) {
|
||||
return getEntityType().getEntityClass();
|
||||
}
|
||||
return Entity.class;
|
||||
}
|
||||
|
||||
public int getEntityId() {
|
||||
return entityId;
|
||||
}
|
||||
@ -262,16 +292,28 @@ public enum DisguiseType {
|
||||
return entityType;
|
||||
}
|
||||
|
||||
public FutureDisguiseType getFutureType() {
|
||||
return futureType;
|
||||
}
|
||||
|
||||
public int getTypeId() {
|
||||
return is1_8() ? futureType.getEntityId() : (int) getEntityType().getTypeId();
|
||||
}
|
||||
|
||||
public Class getWatcherClass() {
|
||||
return watcherClass;
|
||||
}
|
||||
|
||||
public boolean is1_8() {
|
||||
return futureType != null;
|
||||
}
|
||||
|
||||
public boolean isMisc() {
|
||||
return !getEntityType().isAlive();
|
||||
return is1_8() ? !futureType.isAlive() : getEntityType() != null && !getEntityType().isAlive();
|
||||
}
|
||||
|
||||
public boolean isMob() {
|
||||
return getEntityType().isAlive() && this != DisguiseType.PLAYER;
|
||||
return is1_8() ? futureType.isAlive() : getEntityType() != null && getEntityType().isAlive() && !isPlayer();
|
||||
}
|
||||
|
||||
public boolean isPlayer() {
|
||||
|
@ -0,0 +1,178 @@
|
||||
package me.libraryaddict.disguise.disguisetypes;
|
||||
|
||||
import org.bukkit.entity.Animals;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Monster;
|
||||
|
||||
public enum FutureDisguiseType {
|
||||
|
||||
ARMOR_STAND(Entity.class, 30, 2, new float[] { 0F, 0F, 0F }, new Object[] {
|
||||
|
||||
1, (short) 300,
|
||||
|
||||
2, "",
|
||||
|
||||
3, (byte) 0,
|
||||
|
||||
4, (byte) 0,
|
||||
|
||||
6, 1F,
|
||||
|
||||
7, 0,
|
||||
|
||||
8, (byte) 0,
|
||||
|
||||
9, (byte) 0,
|
||||
|
||||
10, (byte) 0,
|
||||
|
||||
// 11,
|
||||
// 12,
|
||||
// 13,
|
||||
// 14,
|
||||
// 15,
|
||||
// 16
|
||||
}),
|
||||
|
||||
ELDER_GUARDIAN(Monster.class, 68, 80, new float[] { 0F, 0F, 0F }, new Object[] {
|
||||
|
||||
1, (short) 300,
|
||||
|
||||
2, "",
|
||||
|
||||
3, (byte) 0,
|
||||
|
||||
4, (byte) 0,
|
||||
|
||||
6, 1F,
|
||||
|
||||
7, 0,
|
||||
|
||||
8, (byte) 0,
|
||||
|
||||
9, (byte) 0,
|
||||
|
||||
15, (byte) 0,
|
||||
|
||||
16, 0 | 4,
|
||||
|
||||
17, 0
|
||||
|
||||
}),
|
||||
|
||||
ENDERMITE(Monster.class, 67, 8, new float[] { 0F, 0F, 0F }, new Object[] {
|
||||
|
||||
0, (byte) 0,
|
||||
|
||||
1, (short) 300,
|
||||
|
||||
2, "",
|
||||
|
||||
3, (byte) 0,
|
||||
|
||||
4, (byte) 0,
|
||||
|
||||
6, 1F,
|
||||
|
||||
7, 0,
|
||||
|
||||
8, (byte) 0,
|
||||
|
||||
9, (byte) 0,
|
||||
|
||||
15, (byte) 0
|
||||
|
||||
}),
|
||||
|
||||
GUARDIAN(Monster.class, 68, 30, new float[] { 0F, 0F, 0F }, new Object[] {
|
||||
|
||||
1, (short) 300,
|
||||
|
||||
2, "",
|
||||
|
||||
3, (byte) 0,
|
||||
|
||||
4, (byte) 0,
|
||||
|
||||
6, 1F,
|
||||
|
||||
7, 0,
|
||||
|
||||
8, (byte) 0,
|
||||
|
||||
9, (byte) 0,
|
||||
|
||||
15, (byte) 0,
|
||||
|
||||
16, 0,
|
||||
|
||||
17, 0
|
||||
|
||||
}),
|
||||
|
||||
RABBIT(Animals.class, 101, 10, new float[] { 0F, 0F, 0F }, new Object[] { 1, (short) 300,
|
||||
|
||||
2, "",
|
||||
|
||||
3, (byte) 0,
|
||||
|
||||
4, (byte) 0,
|
||||
|
||||
6, 1F,
|
||||
|
||||
7, 0,
|
||||
|
||||
8, (byte) 0,
|
||||
|
||||
9, (byte) 0,
|
||||
|
||||
12, (byte) 0,
|
||||
|
||||
15, (byte) 0,
|
||||
|
||||
18, (byte) 0
|
||||
|
||||
});
|
||||
|
||||
private float[] boundingBox;
|
||||
private Object[] dataWatcher;
|
||||
private Class<? extends Entity> entityClass;
|
||||
private int entityId;
|
||||
private float maxHealth;
|
||||
|
||||
private FutureDisguiseType(Class<? extends Entity> entityClass, int entityId, float maxHealth, float[] boundingBox,
|
||||
Object[] watcherValues) {
|
||||
this.entityClass = entityClass;
|
||||
this.dataWatcher = watcherValues;
|
||||
this.boundingBox = boundingBox;
|
||||
if (watcherValues.length % 2 != 0) {
|
||||
System.out.print("Error! " + name() + " has odd number of params!");
|
||||
}
|
||||
this.entityId = entityId;
|
||||
}
|
||||
|
||||
public float[] getBoundingBox() {
|
||||
return boundingBox;
|
||||
}
|
||||
|
||||
public Object[] getDataWatcher() {
|
||||
return dataWatcher;
|
||||
}
|
||||
|
||||
public Class<? extends Entity> getEntityClass() {
|
||||
return entityClass;
|
||||
}
|
||||
|
||||
public int getEntityId() {
|
||||
return entityId;
|
||||
}
|
||||
|
||||
public float getMaxHealth() {
|
||||
return maxHealth;
|
||||
}
|
||||
|
||||
public boolean isAlive() {
|
||||
return this != ARMOR_STAND;
|
||||
}
|
||||
|
||||
}
|
@ -6,7 +6,7 @@ import java.util.List;
|
||||
|
||||
import me.libraryaddict.disguise.DisguiseAPI;
|
||||
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
||||
|
||||
import me.libraryaddict.disguise.utilities.ReflectionManager;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public abstract class TargetedDisguise extends Disguise {
|
||||
@ -34,6 +34,8 @@ public abstract class TargetedDisguise extends Disguise {
|
||||
}
|
||||
|
||||
public boolean canSee(Player player) {
|
||||
if (getType() != null && (getType().is1_8() && !ReflectionManager.is1_8(player)))
|
||||
return false;
|
||||
return canSee(player.getName());
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,11 @@
|
||||
package me.libraryaddict.disguise.disguisetypes.watchers;
|
||||
|
||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||
|
||||
public class ArmorStandWatcher extends LivingWatcher {
|
||||
|
||||
public ArmorStandWatcher(Disguise disguise) {
|
||||
super(disguise);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package me.libraryaddict.disguise.disguisetypes.watchers;
|
||||
|
||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||
|
||||
public class EndermiteWatcher extends LivingWatcher {
|
||||
|
||||
public EndermiteWatcher(Disguise disguise) {
|
||||
super(disguise);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package me.libraryaddict.disguise.disguisetypes.watchers;
|
||||
|
||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||
|
||||
public class GuardianWatcher extends LivingWatcher {
|
||||
|
||||
public GuardianWatcher(Disguise disguise) {
|
||||
super(disguise);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package me.libraryaddict.disguise.disguisetypes.watchers;
|
||||
|
||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||
|
||||
public class RabbitWatcher extends AgeableWatcher {
|
||||
|
||||
public RabbitWatcher(Disguise disguise) {
|
||||
super(disguise);
|
||||
}
|
||||
|
||||
}
|
@ -14,6 +14,7 @@ import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
|
||||
import me.libraryaddict.disguise.disguisetypes.MiscDisguise;
|
||||
import me.libraryaddict.disguise.disguisetypes.MobDisguise;
|
||||
import me.libraryaddict.disguise.disguisetypes.PlayerDisguise;
|
||||
import me.libraryaddict.disguise.utilities.ReflectionManager.LibVersion;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
@ -22,7 +23,6 @@ import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Ageable;
|
||||
import org.bukkit.entity.Animals;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Monster;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||
@ -31,15 +31,15 @@ import org.bukkit.potion.PotionEffectType;
|
||||
public abstract class BaseDisguiseCommand implements CommandExecutor {
|
||||
|
||||
public class DisguiseParseException extends Exception {
|
||||
public DisguiseParseException(String string) {
|
||||
super(string);
|
||||
}
|
||||
private static final long serialVersionUID = 1276971370793124510L;
|
||||
|
||||
public DisguiseParseException() {
|
||||
super();
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 1276971370793124510L;
|
||||
public DisguiseParseException(String string) {
|
||||
super(string);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -147,7 +147,7 @@ public abstract class BaseDisguiseCommand implements CommandExecutor {
|
||||
} else {
|
||||
for (DisguiseType type : DisguiseType.values()) {
|
||||
HashMap<ArrayList<String>, Boolean> options = null;
|
||||
Class entityClass = type.getEntityType() == null ? Entity.class : type.getEntityType().getEntityClass();
|
||||
Class entityClass = type.getEntityClass();
|
||||
if (disguiseType.equals("mob")) {
|
||||
if (type.isMob()) {
|
||||
options = getOptions(perm);
|
||||
@ -203,7 +203,7 @@ public abstract class BaseDisguiseCommand implements CommandExecutor {
|
||||
} else {
|
||||
for (DisguiseType type : DisguiseType.values()) {
|
||||
boolean foundHim = false;
|
||||
Class entityClass = type.getEntityType() == null ? Entity.class : type.getEntityType().getEntityClass();
|
||||
Class entityClass = type.getEntityClass();
|
||||
if (disguiseType.equals("mob")) {
|
||||
if (type.isMob()) {
|
||||
foundHim = true;
|
||||
@ -337,7 +337,7 @@ public abstract class BaseDisguiseCommand implements CommandExecutor {
|
||||
throw new DisguiseParseException(ChatColor.RED + "Error! The disguise " + ChatColor.GREEN + args[0]
|
||||
+ ChatColor.RED + " doesn't exist!");
|
||||
}
|
||||
if (disguiseType.getEntityType() == null) {
|
||||
if (!(LibVersion.is1_8() && disguiseType.is1_8()) && disguiseType.getEntityType() == null) {
|
||||
throw new DisguiseParseException(ChatColor.RED + "Error! This version of minecraft does not have that disguise!");
|
||||
}
|
||||
if (!map.containsKey(disguiseType)) {
|
||||
|
@ -264,7 +264,7 @@ public class DisguiseUtilities {
|
||||
destroyPacket.getIntegerArrays().write(0, new int[] { disguise.getEntity().getEntityId() });
|
||||
for (Object p : cloned) {
|
||||
Player player = (Player) ReflectionManager.getBukkitEntity(p);
|
||||
if (player == disguise.getEntity() || disguise.canSee(player.getName())) {
|
||||
if (player == disguise.getEntity() || disguise.canSee(player)) {
|
||||
ProtocolLibrary.getProtocolManager().sendServerPacket(player, destroyPacket);
|
||||
}
|
||||
}
|
||||
@ -787,7 +787,7 @@ public class DisguiseUtilities {
|
||||
HashSet cloned = (HashSet) trackedPlayers.clone();
|
||||
for (final Object p : cloned) {
|
||||
Player player = (Player) ReflectionManager.getBukkitEntity(p);
|
||||
if (disguise.getEntity() != player && disguise.canSee(player.getName())) {
|
||||
if (disguise.getEntity() != player && disguise.canSee(player)) {
|
||||
clear.invoke(entityTrackerEntry, p);
|
||||
ProtocolLibrary.getProtocolManager().sendServerPacket(player, destroyPacket);
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(libsDisguises, new Runnable() {
|
||||
|
@ -277,14 +277,14 @@ public class PacketsManager {
|
||||
delayedPackets = new PacketContainer[] { delayedPacket };
|
||||
}
|
||||
|
||||
} else if (disguise.getType().isMob()) {
|
||||
} else if (disguise.getType().isMob() || disguise.getType() == DisguiseType.ARMOR_STAND) {
|
||||
|
||||
DisguiseValues values = DisguiseValues.getDisguiseValues(disguise.getType());
|
||||
Vector vec = disguisedEntity.getVelocity();
|
||||
spawnPackets[0] = new PacketContainer(PacketType.Play.Server.SPAWN_ENTITY_LIVING);
|
||||
StructureModifier<Object> mods = spawnPackets[0].getModifier();
|
||||
mods.write(0, disguisedEntity.getEntityId());
|
||||
mods.write(1, (int) disguise.getType().getEntityType().getTypeId());
|
||||
mods.write(1, disguise.getType().getTypeId()); // TODO
|
||||
double d1 = 3.9D;
|
||||
double d2 = vec.getX();
|
||||
double d3 = vec.getY();
|
||||
@ -421,7 +421,7 @@ public class PacketsManager {
|
||||
value = (byte) -(value + 128);
|
||||
break;
|
||||
default:
|
||||
if (disguiseType.isMisc()) {
|
||||
if (disguiseType.isMisc() && disguiseType != DisguiseType.ARMOR_STAND) {
|
||||
value -= 64;
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user