From dc6348cf3877525490d46d19e886f522ee0e3744 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Thu, 19 Jun 2014 10:01:08 +1200 Subject: [PATCH] Get rid of the silly getData must return Integer --- .../disguise/disguisetypes/MiscDisguise.java | 5 ++--- .../disguise/utilities/PacketsManager.java | 10 +++------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/me/libraryaddict/disguise/disguisetypes/MiscDisguise.java b/src/me/libraryaddict/disguise/disguisetypes/MiscDisguise.java index 84c14b55..02c2227d 100644 --- a/src/me/libraryaddict/disguise/disguisetypes/MiscDisguise.java +++ b/src/me/libraryaddict/disguise/disguisetypes/MiscDisguise.java @@ -11,8 +11,7 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; public class MiscDisguise extends TargetedDisguise { - private Integer data; - private int id = -1; + private int id = -1, data = 0; public MiscDisguise(DisguiseType disguiseType) { this(disguiseType, -1, -1); @@ -120,7 +119,7 @@ public class MiscDisguise extends TargetedDisguise { /** * This is the getId of everything but falling block. */ - public Integer getData() { + public int getData() { switch (getType()) { case FALLING_BLOCK: return (int) ((FallingBlockWatcher) getWatcher()).getBlock().getDurability(); diff --git a/src/me/libraryaddict/disguise/utilities/PacketsManager.java b/src/me/libraryaddict/disguise/utilities/PacketsManager.java index 96c94be6..4450566c 100644 --- a/src/me/libraryaddict/disguise/utilities/PacketsManager.java +++ b/src/me/libraryaddict/disguise/utilities/PacketsManager.java @@ -294,16 +294,12 @@ public class PacketsManager { } else if (disguise.getType().isMisc()) { int id = disguise.getType().getEntityId(); - Integer data = ((MiscDisguise) disguise).getData(); + int data = ((MiscDisguise) disguise).getData(); if (disguise.getType() == DisguiseType.FALLING_BLOCK) { data = (((MiscDisguise) disguise).getId() | data << 16); - } else if (disguise.getType() == DisguiseType.FISHING_HOOK) { + } else if (disguise.getType() == DisguiseType.FISHING_HOOK && data == 0) { // 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; + data = disguisedEntity.getEntityId(); } /* else if (disguise.getType() == DisguiseType.ITEM_FRAME) { data = (int) loc.getYaw();