Change MiscDisguise thing to Integer instead of int so I can use nulls, this lets me know if a int was set.
This commit is contained in:
		@@ -228,7 +228,7 @@ public enum DisguiseType {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private int defaultId;
 | 
			
		||||
    private Integer defaultId;
 | 
			
		||||
    private int entityId;
 | 
			
		||||
    private EntityType entityType;
 | 
			
		||||
    private Class<? extends FlagWatcher> watcherClass;
 | 
			
		||||
@@ -249,7 +249,7 @@ public enum DisguiseType {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public int getDefaultId() {
 | 
			
		||||
    public Integer getDefaultId() {
 | 
			
		||||
        return defaultId;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -11,7 +11,7 @@ import org.bukkit.entity.EntityType;
 | 
			
		||||
import org.bukkit.inventory.ItemStack;
 | 
			
		||||
 | 
			
		||||
public class MiscDisguise extends TargetedDisguise {
 | 
			
		||||
    private int data = -1;
 | 
			
		||||
    private Integer data;
 | 
			
		||||
    private int id = -1;
 | 
			
		||||
 | 
			
		||||
    public MiscDisguise(DisguiseType disguiseType) {
 | 
			
		||||
@@ -120,10 +120,10 @@ public class MiscDisguise extends TargetedDisguise {
 | 
			
		||||
    /**
 | 
			
		||||
     * This is the getId of everything but falling block.
 | 
			
		||||
     */
 | 
			
		||||
    public int getData() {
 | 
			
		||||
    public Integer getData() {
 | 
			
		||||
        switch (getType()) {
 | 
			
		||||
        case FALLING_BLOCK:
 | 
			
		||||
            return ((FallingBlockWatcher) getWatcher()).getBlock().getDurability();
 | 
			
		||||
            return (int) ((FallingBlockWatcher) getWatcher()).getBlock().getDurability();
 | 
			
		||||
        case PAINTING:
 | 
			
		||||
            return ((PaintingWatcher) getWatcher()).getArt().getId();
 | 
			
		||||
        case SPLASH_POTION:
 | 
			
		||||
 
 | 
			
		||||
@@ -294,16 +294,17 @@ public class PacketsManager {
 | 
			
		||||
        } else if (disguise.getType().isMisc()) {
 | 
			
		||||
 | 
			
		||||
            int id = disguise.getType().getEntityId();
 | 
			
		||||
            int data = ((MiscDisguise) disguise).getData();
 | 
			
		||||
            Integer data = ((MiscDisguise) disguise).getData();
 | 
			
		||||
            if (disguise.getType() == DisguiseType.FALLING_BLOCK) {
 | 
			
		||||
                data = (((MiscDisguise) disguise).getId() | data << 16);
 | 
			
		||||
            } else if (data < 0) {
 | 
			
		||||
            } else if (disguise.getType() == DisguiseType.FISHING_HOOK) {
 | 
			
		||||
                // If the MiscDisguise data isn't set. Then no entity id was provided, so default to the owners entity id
 | 
			
		||||
                if (data == null) {
 | 
			
		||||
                    data = disguisedEntity.getEntityId();
 | 
			
		||||
                }
 | 
			
		||||
            } else if (data == null) {
 | 
			
		||||
                data = 0;
 | 
			
		||||
            }
 | 
			
		||||
            // If the MiscDisguise data isn't set. Then no entity id was provided, so default to the owners entity id
 | 
			
		||||
            if (disguise.getType() == DisguiseType.FISHING_HOOK && data == 0) {
 | 
			
		||||
                data = disguisedEntity.getEntityId();
 | 
			
		||||
            }
 | 
			
		||||
            /*     else if (disguise.getType() == DisguiseType.ITEM_FRAME) {
 | 
			
		||||
                     data = (int) loc.getYaw();
 | 
			
		||||
                     if (data < 0)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user