mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
Fixes #910
This commit is contained in:
parent
0a721b18ce
commit
af987016fc
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user