Add Eular Angles for armorstands

This commit is contained in:
libraryaddict 2018-03-18 08:40:44 +13:00
parent d1b206fe0a
commit 1c60606131
3 changed files with 17 additions and 2 deletions

View file

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>LibsDisguises</groupId>
<artifactId>LibsDisguises</artifactId>
<version>9.5.1</version>
<version>9.5.1-SNAPSHOT</version>
<build>
<sourceDirectory>src</sourceDirectory>

View file

@ -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());

View file

@ -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<ParamInfo>() {
@Override