Permalink
Browse files

Fixed some errors caused by removed parts of the Spigot API.

  • Loading branch information...
me4502 committed Oct 2, 2017
1 parent f5d117e commit 6f8e5ba359f67bf7d9e006c334981ec647acf729
Showing with 5 additions and 21 deletions.
  1. +5 −21 src/main/java/com/sk89q/craftbook/util/EntityUtil.java
@@ -4,12 +4,11 @@
import org.bukkit.Bukkit;
import org.bukkit.DyeColor;
import org.bukkit.Location;
import org.bukkit.attribute.Attribute;
import org.bukkit.block.Block;
import org.bukkit.entity.*;
import org.bukkit.entity.Horse.Color;
import org.bukkit.entity.Horse.Style;
import org.bukkit.entity.Horse.Variant;
import org.bukkit.entity.Skeleton.SkeletonType;
import org.bukkit.material.MaterialData;
import java.util.ArrayList;
@@ -134,8 +133,8 @@ public static void setEntityData(Entity ent, String bit) {
if (ent instanceof LivingEntity && data[0].equalsIgnoreCase("health")) {
try {
double health = Double.parseDouble(data[1]);
if(((LivingEntity) ent).getMaxHealth() < health)
((LivingEntity) ent).setMaxHealth(health);
if(((LivingEntity) ent).getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue() < health)
((LivingEntity) ent).getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(health);
((LivingEntity) ent).setHealth(health);
} catch (Exception ignored) {
}
@@ -193,11 +192,6 @@ public static void setEntityData(Entity ent, String bit) {
((Wolf) ent).setCollarColor(DyeColor.valueOf(data[1]));
}
break;
case SKELETON:
if (data[0].equalsIgnoreCase("wither")) {
((Skeleton) ent).setSkeletonType(SkeletonType.WITHER);
}
break;
case ENDERMAN:
if (data[0].equalsIgnoreCase("block")) {
try {
@@ -307,18 +301,8 @@ public static void setEntityData(Entity ent, String bit) {
}
break;
case HORSE:
if(data[0].equalsIgnoreCase("horse"))
((Horse)ent).setVariant(Variant.HORSE);
else if (data[0].equalsIgnoreCase("donkey"))
((Horse)ent).setVariant(Variant.DONKEY);
else if (data[0].equalsIgnoreCase("mule"))
((Horse)ent).setVariant(Variant.MULE);
else if (data[0].equalsIgnoreCase("skeleton"))
((Horse)ent).setVariant(Variant.SKELETON_HORSE);
else if (data[0].equalsIgnoreCase("zombie"))
((Horse)ent).setVariant(Variant.UNDEAD_HORSE);
else if (data[0].equalsIgnoreCase("chest"))
((Horse)ent).setCarryingChest(true);
if (ent instanceof ChestedHorse && data[0].equalsIgnoreCase("chest"))
((ChestedHorse)ent).setCarryingChest(true);
else if (data[0].equalsIgnoreCase("domestic"))
try {
((Horse)ent).setDomestication(Integer.parseInt(data[1]));

0 comments on commit 6f8e5ba

Please sign in to comment.