From 1c60606131b7d509a3ab1e6da88c8bb122254de7 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Sun, 18 Mar 2018 08:40:44 +1300 Subject: [PATCH] Add Eular Angles for armorstands --- pom.xml | 2 +- .../disguise/utilities/DisguiseParser.java | 12 ++++++++++++ .../disguise/utilities/ReflectionFlagWatchers.java | 5 ++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 2d56a5c6..218abd5d 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 LibsDisguises LibsDisguises - 9.5.1 + 9.5.1-SNAPSHOT src diff --git a/src/me/libraryaddict/disguise/utilities/DisguiseParser.java b/src/me/libraryaddict/disguise/utilities/DisguiseParser.java index 79bdc97d..f2111fbf 100644 --- a/src/me/libraryaddict/disguise/utilities/DisguiseParser.java +++ b/src/me/libraryaddict/disguise/utilities/DisguiseParser.java @@ -13,6 +13,7 @@ import org.bukkit.entity.*; import org.bukkit.inventory.ItemStack; import org.bukkit.permissions.PermissionAttachmentInfo; import org.bukkit.potion.PotionEffectType; +import org.bukkit.util.EulerAngle; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -759,6 +760,17 @@ public class DisguiseParser { // Parse to string value = ChatColor.translateAlternateColorCodes('&', valueString); } + } else if (param == EulerAngle.class) { + String[] split = valueString.split(","); + + if (split.length != 3) + throw parseToException(param, valueString, methodName); + + if (!isDouble(split[0]) || !isDouble(split[1]) || !isDouble(split[2])) + throw parseToException(param, valueString, methodName); + + value = new EulerAngle(Double.parseDouble(split[0]), Double.parseDouble(split[1]), + Double.parseDouble(split[2])); } else if (param == Villager.Profession.class) { try { value = Villager.Profession.valueOf(valueString.toUpperCase()); diff --git a/src/me/libraryaddict/disguise/utilities/ReflectionFlagWatchers.java b/src/me/libraryaddict/disguise/utilities/ReflectionFlagWatchers.java index 63a508b1..c44201b9 100644 --- a/src/me/libraryaddict/disguise/utilities/ReflectionFlagWatchers.java +++ b/src/me/libraryaddict/disguise/utilities/ReflectionFlagWatchers.java @@ -14,6 +14,7 @@ import org.bukkit.entity.Ocelot; import org.bukkit.entity.Villager; import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffectType; +import org.bukkit.util.EulerAngle; import javax.annotation.Nullable; import java.lang.reflect.Method; @@ -160,6 +161,7 @@ public class ReflectionFlagWatchers { "View the directions usable on player setSleeping and shulker direction"); new ParamInfo(RabbitType.class, "Rabbit Type", "View the kinds of rabbits you can turn into"); new ParamInfo(TreeSpecies.class, "Tree Species", "View the different types of tree species"); + new ParamInfo(EulerAngle.class, "Euler Angle (X,Y,Z)", "Set the X,Y,Z directions on an armorstand"); try { new ParamInfo("org.bukkit.inventory.MainHand", "Main Hand", "Set the main hand for an entity"); @@ -228,7 +230,8 @@ public class ReflectionFlagWatchers { new ParamInfo(BlockPosition.class, "Block Position (num,num,num)", "Three numbers separated by a ,"); new ParamInfo(WrappedGameProfile.class, "GameProfile", - "Get the gameprofile here https://sessionserver.mojang.com/session/minecraft/profile/PLAYER_UUID_GOES_HERE?unsigned=false"); + "Get the gameprofile here https://sessionserver.mojang" + + ".com/session/minecraft/profile/PLAYER_UUID_GOES_HERE?unsigned=false"); Collections.sort(paramList, new Comparator() { @Override