diff --git a/pom.xml b/pom.xml
index cac100da..8ed9d01b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -37,7 +37,7 @@
com.comphenix.protocol
ProtocolLib
- 4.0.0-SNAPSHOT
+ 4.1.0-SNAPSHOT
org.spigotmc
diff --git a/src/me/libraryaddict/disguise/commands/BaseDisguiseCommand.java b/src/me/libraryaddict/disguise/commands/BaseDisguiseCommand.java
index 52e2b218..cdc06b16 100644
--- a/src/me/libraryaddict/disguise/commands/BaseDisguiseCommand.java
+++ b/src/me/libraryaddict/disguise/commands/BaseDisguiseCommand.java
@@ -23,6 +23,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.potion.PotionEffectType;
+import com.comphenix.protocol.wrappers.BlockPosition;
import com.comphenix.protocol.wrappers.WrappedGameProfile;
import com.comphenix.protocol.wrappers.WrappedSignedProperty;
import com.google.gson.Gson;
@@ -952,7 +953,7 @@ public abstract class BaseDisguiseCommand implements CommandExecutor
{
BlockFace face = BlockFace.valueOf(valueString.toUpperCase());
- if (face.ordinal() > 4)
+ if (face.ordinal() > 5)
{
throw new DisguiseParseException();
}
@@ -961,7 +962,8 @@ public abstract class BaseDisguiseCommand implements CommandExecutor
}
catch (Exception ex)
{
- throw parseToException("a direction (north, east, south, west, up)", valueString, methodName);
+ throw parseToException("a direction (north, east, south, west, up, down)", valueString,
+ methodName);
}
}
else if (param == RabbitType.class)
@@ -988,6 +990,23 @@ public abstract class BaseDisguiseCommand implements CommandExecutor
throw parseToException("rabbit type (white, brown, patches...)", valueString, methodName);
}
}
+ else if (param == BlockPosition.class)
+ {
+ try
+ {
+ String[] split = valueString.split(",");
+
+ assert split.length == 3;
+
+ value = new BlockPosition(Integer.parseInt(split[0]), Integer.parseInt(split[1]),
+ Integer.parseInt(split[2]));
+ }
+ catch (Exception ex)
+ {
+ throw parseToException("three numbers Number,Number,Number", valueString,
+ methodName);
+ }
+ }
}
if (value == null && boolean.class == param)
diff --git a/src/me/libraryaddict/disguise/commands/HelpDisguiseCommand.java b/src/me/libraryaddict/disguise/commands/HelpDisguiseCommand.java
index 41f12620..2a42efd4 100644
--- a/src/me/libraryaddict/disguise/commands/HelpDisguiseCommand.java
+++ b/src/me/libraryaddict/disguise/commands/HelpDisguiseCommand.java
@@ -14,6 +14,9 @@ import org.bukkit.command.CommandSender;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffectType;
+import com.comphenix.protocol.wrappers.BlockPosition;
+import com.comphenix.protocol.wrappers.WrappedGameProfile;
+
import me.libraryaddict.disguise.disguisetypes.AnimalColor;
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
@@ -316,6 +319,15 @@ public class HelpDisguiseCommand extends BaseDisguiseCommand
{
valueType = "rabbit type";
}
+ else if (c == BlockPosition.class)
+ {
+ valueType = "three numbers";
+ }
+ else if (c == WrappedGameProfile.class)
+ {
+ valueType = "gameprofile";
+ }
+
if (valueType != null)
{
ChatColor methodColor = ChatColor.YELLOW;
diff --git a/src/me/libraryaddict/disguise/disguisetypes/FlagType.java b/src/me/libraryaddict/disguise/disguisetypes/FlagType.java
index 7a2baae7..d9d58b77 100644
--- a/src/me/libraryaddict/disguise/disguisetypes/FlagType.java
+++ b/src/me/libraryaddict/disguise/disguisetypes/FlagType.java
@@ -8,11 +8,10 @@ import java.util.UUID;
import org.bukkit.Color;
import org.bukkit.Material;
-import org.bukkit.block.BlockFace;
import org.bukkit.inventory.ItemStack;
-import org.bukkit.util.EulerAngle;
-
import com.comphenix.protocol.wrappers.BlockPosition;
+import com.comphenix.protocol.wrappers.EnumWrappers.Direction;
+import com.comphenix.protocol.wrappers.Vector3F;
import com.comphenix.protocol.wrappers.WrappedBlockData;
import com.google.common.base.Optional;
@@ -79,23 +78,23 @@ public class FlagType
public static FlagType AREA_EFFECT_RADIUS = new FlagType(AreaEffectCloudWatcher.class, 0, 0F);
- public static FlagType ARMORSTAND_BODY = new FlagType(ArmorStandWatcher.class, 2,
- new EulerAngle(0, 0, 0));
+ public static FlagType ARMORSTAND_BODY = new FlagType(ArmorStandWatcher.class, 2,
+ new Vector3F(0, 0, 0));
- public static FlagType ARMORSTAND_HEAD = new FlagType(ArmorStandWatcher.class, 1,
- new EulerAngle(0, 0, 0));
+ public static FlagType ARMORSTAND_HEAD = new FlagType(ArmorStandWatcher.class, 1,
+ new Vector3F(0, 0, 0));
- public static FlagType ARMORSTAND_LEFT_ARM = new FlagType(ArmorStandWatcher.class, 3,
- new EulerAngle(0, 0, 0));
+ public static FlagType ARMORSTAND_LEFT_ARM = new FlagType(ArmorStandWatcher.class, 3,
+ new Vector3F(0, 0, 0));
- public static FlagType ARMORSTAND_LEFT_LEG = new FlagType(ArmorStandWatcher.class, 5,
- new EulerAngle(0, 0, 0));
+ public static FlagType ARMORSTAND_LEFT_LEG = new FlagType(ArmorStandWatcher.class, 5,
+ new Vector3F(0, 0, 0));
public static FlagType ARMORSTAND_META = new FlagType(ArmorStandWatcher.class, 0, (byte) 0);
- public static FlagType ARMORSTAND_RIGHT_ARM = new FlagType(ArmorStandWatcher.class, 4, new EulerAngle(0,0,0));
+ public static FlagType ARMORSTAND_RIGHT_ARM = new FlagType(ArmorStandWatcher.class, 4, new Vector3F(0,0,0));
- public static FlagType ARMORSTAND_RIGHT_LEG = new FlagType(ArmorStandWatcher.class, 6, new EulerAngle(0,0,0));
+ public static FlagType ARMORSTAND_RIGHT_LEG = new FlagType(ArmorStandWatcher.class, 6, new Vector3F(0,0,0));
public static FlagType ARROW_CRITICAL = new FlagType(ArrowWatcher.class, 0, (byte) 0);
@@ -225,7 +224,7 @@ public class FlagType
public static FlagType> SHULKER_ATTACHED = new FlagType>(ShulkerWatcher.class,
1, Optional. absent());
- public static FlagType SHULKER_FACING = new FlagType(ShulkerWatcher.class, 0, BlockFace.DOWN);
+ public static FlagType SHULKER_FACING = new FlagType(ShulkerWatcher.class, 0, Direction.DOWN);
public static FlagType SHULKER_PEEKING = new FlagType(ShulkerWatcher.class, 2, (byte) 0);
diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/ArmorStandWatcher.java b/src/me/libraryaddict/disguise/disguisetypes/watchers/ArmorStandWatcher.java
index 6435c4da..51fba717 100644
--- a/src/me/libraryaddict/disguise/disguisetypes/watchers/ArmorStandWatcher.java
+++ b/src/me/libraryaddict/disguise/disguisetypes/watchers/ArmorStandWatcher.java
@@ -1,6 +1,9 @@
package me.libraryaddict.disguise.disguisetypes.watchers;
import org.bukkit.util.EulerAngle;
+
+import com.comphenix.protocol.wrappers.Vector3F;
+
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
@@ -36,12 +39,14 @@ public class ArmorStandWatcher extends LivingWatcher
return getPose(FlagType.ARMORSTAND_LEFT_LEG);
}
- private EulerAngle getPose(FlagType type)
+ private EulerAngle getPose(FlagType type)
{
if (!hasValue(type))
- setValue(type, new EulerAngle(0, 0, 0));
+ return new EulerAngle(0, 0, 0);
- return getValue(type);
+ Vector3F vec = getValue(type);
+
+ return new EulerAngle(vec.getX(), vec.getY(), vec.getZ());
}
public EulerAngle getRightArm()
@@ -134,9 +139,9 @@ public class ArmorStandWatcher extends LivingWatcher
sendData(FlagType.ARMORSTAND_META);
}
- private void setPose(FlagType type, EulerAngle vector)
+ private void setPose(FlagType type, EulerAngle vector)
{
- setValue(type, vector);
+ setValue(type, new Vector3F((float) vector.getX(), (float) vector.getY(), (float) vector.getZ()));
sendData(type);
}
diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/ShulkerWatcher.java b/src/me/libraryaddict/disguise/disguisetypes/watchers/ShulkerWatcher.java
index dc2fd8bc..e3a80167 100644
--- a/src/me/libraryaddict/disguise/disguisetypes/watchers/ShulkerWatcher.java
+++ b/src/me/libraryaddict/disguise/disguisetypes/watchers/ShulkerWatcher.java
@@ -3,6 +3,7 @@ package me.libraryaddict.disguise.disguisetypes.watchers;
import org.bukkit.block.BlockFace;
import com.comphenix.protocol.wrappers.BlockPosition;
+import com.comphenix.protocol.wrappers.EnumWrappers.Direction;
import com.google.common.base.Optional;
import me.libraryaddict.disguise.disguisetypes.Disguise;
@@ -21,12 +22,12 @@ public class ShulkerWatcher extends InsentientWatcher
public BlockFace getFacingDirection()
{
- return getValue(FlagType.SHULKER_FACING);
+ return BlockFace.valueOf(getValue(FlagType.SHULKER_FACING).name());
}
public void setFacingDirection(BlockFace face)
{
- setValue(FlagType.SHULKER_FACING, face);
+ setValue(FlagType.SHULKER_FACING, Direction.valueOf(face.name()));
sendData(FlagType.SHULKER_FACING);
}
diff --git a/src/me/libraryaddict/disguise/utilities/PacketsManager.java b/src/me/libraryaddict/disguise/utilities/PacketsManager.java
index d550ec99..bac5fc76 100644
--- a/src/me/libraryaddict/disguise/utilities/PacketsManager.java
+++ b/src/me/libraryaddict/disguise/utilities/PacketsManager.java
@@ -738,7 +738,6 @@ public class PacketsManager
{
packetsToListen.add(Server.ENTITY_LOOK);
packetsToListen.add(Server.REL_ENTITY_MOVE_LOOK);
- packetsToListen.add(Server.REL_ENTITY_MOVE_LOOK);
packetsToListen.add(Server.ENTITY_HEAD_ROTATION);
packetsToListen.add(Server.ENTITY_TELEPORT);
packetsToListen.add(Server.REL_ENTITY_MOVE);
diff --git a/src/me/libraryaddict/disguise/utilities/ReflectionManager.java b/src/me/libraryaddict/disguise/utilities/ReflectionManager.java
index 1736eb06..3a6b2c0d 100644
--- a/src/me/libraryaddict/disguise/utilities/ReflectionManager.java
+++ b/src/me/libraryaddict/disguise/utilities/ReflectionManager.java
@@ -15,7 +15,6 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.World;
-import org.bukkit.block.BlockFace;
import org.bukkit.entity.Ambient;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
@@ -25,10 +24,10 @@ import org.bukkit.inventory.EntityEquipment;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
-import org.bukkit.util.EulerAngle;
-
import com.comphenix.protocol.wrappers.BlockPosition;
+import com.comphenix.protocol.wrappers.EnumWrappers.Direction;
import com.comphenix.protocol.wrappers.MinecraftKey;
+import com.comphenix.protocol.wrappers.Vector3F;
import com.comphenix.protocol.wrappers.WrappedDataWatcher.Registry;
import com.comphenix.protocol.wrappers.WrappedDataWatcher.Serializer;
import com.comphenix.protocol.wrappers.WrappedDataWatcher.WrappedDataWatcherObject;
@@ -941,23 +940,30 @@ public class ReflectionManager
}
}
}
- else if (value instanceof EulerAngle)
+ else if (value instanceof Vector3F)
{
- EulerAngle angle = (EulerAngle) value;
+ Vector3F angle = (Vector3F) value;
try
{
- return getNmsConstructor("Vector3f", float.class, float.class, float.class).newInstance((float) angle.getX(),
- (float) angle.getY(), (float) angle.getZ());
+ return getNmsConstructor("Vector3f", float.class, float.class, float.class).newInstance(angle.getX(),
+ angle.getY(), angle.getZ());
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
- else if (value instanceof BlockFace)
+ else if (value instanceof Direction)
{
- return getEnumDirection(((BlockFace) value).ordinal());
+ try
+ {
+ return (Enum) getNmsMethod("EnumDirection", "fromType1", int.class).invoke(null, ((Direction) value).ordinal());
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
}
return value;