Dieser Commit ist enthalten in:
NotMyFault 2021-02-15 12:24:33 +01:00
Ursprung 0a721b18ce
Commit af987016fc
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 158F5701A6AAD00C

Datei anzeigen

@ -20,6 +20,7 @@
package com.sk89q.worldedit.bukkit;
import com.sk89q.worldedit.entity.metadata.EntityProperties;
import org.bukkit.entity.AbstractVillager;
import org.bukkit.entity.Ambient;
import org.bukkit.entity.Animals;
import org.bukkit.entity.ArmorStand;
@ -47,6 +48,19 @@ import static com.google.common.base.Preconditions.checkNotNull;
class BukkitEntityProperties implements EntityProperties {
private static final boolean HAS_ABSTRACT_VILLAGER;
static {
boolean temp;
try {
Class.forName("org.bukkit.entity.AbstractVillager");
temp = true;
} catch (ClassNotFoundException e) {
temp = false;
}
HAS_ABSTRACT_VILLAGER = temp;
}
private final Entity entity;
BukkitEntityProperties(Entity entity) {
@ -121,6 +135,9 @@ class BukkitEntityProperties implements EntityProperties {
@Override
public boolean isNPC() {
if (HAS_ABSTRACT_VILLAGER) {
return entity instanceof AbstractVillager;
}
return entity instanceof Villager;
}