mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-01-03 06:57:41 +01:00
Simplify noDamageTicks
This commit is contained in:
parent
fb300c38fa
commit
d8cc7b6f94
@ -410,11 +410,9 @@ public class CitizensNPC extends AbstractNPC {
|
||||
} else if (data().has(NPC.Metadata.AGGRESSIVE)) {
|
||||
NMS.setAggressive(entity, data().<Boolean> get(NPC.Metadata.AGGRESSIVE));
|
||||
}
|
||||
if (SUPPORT_NODAMAGE_TICKS) {
|
||||
entity.setNoDamageTicks(data().get(NPC.Metadata.SPAWN_NODAMAGE_TICKS,
|
||||
Setting.DEFAULT_SPAWN_NODAMAGE_DURATION.asTicks()));
|
||||
}
|
||||
}
|
||||
if (requiresNameHologram() && !hasTrait(HologramTrait.class)) {
|
||||
addTrait(HologramTrait.class);
|
||||
}
|
||||
@ -614,16 +612,10 @@ public class CitizensNPC extends AbstractNPC {
|
||||
private static final SetMultimap<ChunkCoord, NPC> CHUNK_LOADERS = HashMultimap.create();
|
||||
private static boolean SUPPORT_ATTRIBUTES = false;
|
||||
private static boolean SUPPORT_GLOWING = false;
|
||||
private static boolean SUPPORT_NODAMAGE_TICKS = false;
|
||||
private static boolean SUPPORT_PICKUP_ITEMS = false;
|
||||
private static boolean SUPPORT_SILENT = false;
|
||||
private static boolean SUPPORT_USE_ITEM = true;
|
||||
static {
|
||||
try {
|
||||
Entity.class.getMethod("setNoDamageTicks", int.class);
|
||||
SUPPORT_NODAMAGE_TICKS = true;
|
||||
} catch (NoSuchMethodException | SecurityException e) {
|
||||
}
|
||||
try {
|
||||
Entity.class.getMethod("setGlowing", boolean.class);
|
||||
SUPPORT_GLOWING = true;
|
||||
|
Loading…
Reference in New Issue
Block a user