From 5254f65945fa8e8dd2494e807d8a14992a30d319 Mon Sep 17 00:00:00 2001 From: fullwall Date: Sat, 10 Dec 2022 15:56:55 +0800 Subject: [PATCH] Add camel to horse types --- .../main/java/net/citizensnpcs/trait/HorseModifiers.java | 6 ++---- main/src/main/java/net/citizensnpcs/util/Util.java | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/main/src/main/java/net/citizensnpcs/trait/HorseModifiers.java b/main/src/main/java/net/citizensnpcs/trait/HorseModifiers.java index 6b0da5e4f..0d049a049 100644 --- a/main/src/main/java/net/citizensnpcs/trait/HorseModifiers.java +++ b/main/src/main/java/net/citizensnpcs/trait/HorseModifiers.java @@ -2,7 +2,7 @@ package net.citizensnpcs.trait; import java.lang.invoke.MethodHandle; -import org.bukkit.entity.EntityType; +import org.bukkit.entity.ChestedHorse; import org.bukkit.entity.Horse; import org.bukkit.entity.Horse.Color; import org.bukkit.entity.Horse.Style; @@ -113,9 +113,7 @@ public class HorseModifiers extends Trait { } if (CARRYING_CHEST_METHOD == null) return; - EntityType type = npc.getEntity().getType(); - if (type.name().equals("LLAMA") || type.name().equals("TRADER_LLAMA") || type.name().equals("DONKEY") - || type.name().equals("MULE")) { + if (npc.getEntity() instanceof ChestedHorse) { try { CARRYING_CHEST_METHOD.invoke(npc.getEntity(), carryingChest); } catch (Throwable e) { diff --git a/main/src/main/java/net/citizensnpcs/util/Util.java b/main/src/main/java/net/citizensnpcs/util/Util.java index ef52044ce..d6bff75fc 100644 --- a/main/src/main/java/net/citizensnpcs/util/Util.java +++ b/main/src/main/java/net/citizensnpcs/util/Util.java @@ -240,7 +240,7 @@ public class Util { public static boolean isHorse(EntityType type) { String name = type.name(); return type == EntityType.HORSE || name.contains("_HORSE") || name.equals("DONKEY") || name.equals("MULE") - || name.equals("LLAMA") || name.equals("TRADER_LLAMA"); + || name.equals("LLAMA") || name.equals("TRADER_LLAMA") || name.equals("CAMEL"); } public static boolean isLoaded(Location location) {