mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-22 10:36:10 +01:00
Don't persist armor stands from PlayerAnimation.SIT
This commit is contained in:
parent
221eb4b8d5
commit
e4f059683a
@ -10,7 +10,9 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import net.citizensnpcs.api.CitizensAPI;
|
||||
import net.citizensnpcs.api.npc.MemoryNPCDataStore;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.api.npc.NPCRegistry;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.trait.ArmorStandTrait;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
@ -35,7 +37,11 @@ public class PlayerAnimationImpl {
|
||||
case SIT:
|
||||
player.getBukkitEntity().setMetadata("citizens.sitting",
|
||||
new FixedMetadataValue(CitizensAPI.getPlugin(), true));
|
||||
final NPC holder = CitizensAPI.getNPCRegistry().createNPC(EntityType.ARMOR_STAND, "");
|
||||
NPCRegistry registry = CitizensAPI.getNamedNPCRegistry("PlayerAnimationImpl");
|
||||
if (registry == null) {
|
||||
registry = CitizensAPI.createNamedNPCRegistry("PlayerAnimationImpl", new MemoryNPCDataStore());
|
||||
}
|
||||
final NPC holder = registry.createNPC(EntityType.ARMOR_STAND, "");
|
||||
holder.spawn(player.getBukkitEntity().getLocation());
|
||||
ArmorStandTrait trait = holder.getTrait(ArmorStandTrait.class);
|
||||
trait.setGravity(false);
|
||||
|
@ -10,7 +10,9 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import net.citizensnpcs.api.CitizensAPI;
|
||||
import net.citizensnpcs.api.npc.MemoryNPCDataStore;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.api.npc.NPCRegistry;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.trait.ArmorStandTrait;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
@ -35,7 +37,11 @@ public class PlayerAnimationImpl {
|
||||
case SIT:
|
||||
player.getBukkitEntity().setMetadata("citizens.sitting",
|
||||
new FixedMetadataValue(CitizensAPI.getPlugin(), true));
|
||||
final NPC holder = CitizensAPI.getNPCRegistry().createNPC(EntityType.ARMOR_STAND, "");
|
||||
NPCRegistry registry = CitizensAPI.getNamedNPCRegistry("PlayerAnimationImpl");
|
||||
if (registry == null) {
|
||||
registry = CitizensAPI.createNamedNPCRegistry("PlayerAnimationImpl", new MemoryNPCDataStore());
|
||||
}
|
||||
final NPC holder = registry.createNPC(EntityType.ARMOR_STAND, "");
|
||||
holder.spawn(player.getBukkitEntity().getLocation());
|
||||
ArmorStandTrait trait = holder.getTrait(ArmorStandTrait.class);
|
||||
trait.setGravity(false);
|
||||
|
@ -10,7 +10,9 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import net.citizensnpcs.api.CitizensAPI;
|
||||
import net.citizensnpcs.api.npc.MemoryNPCDataStore;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.api.npc.NPCRegistry;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.trait.ArmorStandTrait;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
@ -35,7 +37,11 @@ public class PlayerAnimationImpl {
|
||||
case SIT:
|
||||
player.getBukkitEntity().setMetadata("citizens.sitting",
|
||||
new FixedMetadataValue(CitizensAPI.getPlugin(), true));
|
||||
final NPC holder = CitizensAPI.getNPCRegistry().createNPC(EntityType.ARMOR_STAND, "");
|
||||
NPCRegistry registry = CitizensAPI.getNamedNPCRegistry("PlayerAnimationImpl");
|
||||
if (registry == null) {
|
||||
registry = CitizensAPI.createNamedNPCRegistry("PlayerAnimationImpl", new MemoryNPCDataStore());
|
||||
}
|
||||
final NPC holder = registry.createNPC(EntityType.ARMOR_STAND, "");
|
||||
holder.spawn(player.getBukkitEntity().getLocation());
|
||||
ArmorStandTrait trait = holder.getTrait(ArmorStandTrait.class);
|
||||
trait.setGravity(false);
|
||||
@ -44,7 +50,6 @@ public class PlayerAnimationImpl {
|
||||
trait.setSmall(true);
|
||||
trait.setMarker(true);
|
||||
trait.setVisible(false);
|
||||
holder.getTrait(ArmorStandTrait.class).setVisible(false);
|
||||
holder.data().set(NPC.NAMEPLATE_VISIBLE_METADATA, false);
|
||||
holder.data().set(NPC.DEFAULT_PROTECTED_METADATA, true);
|
||||
new BukkitRunnable() {
|
||||
|
@ -10,7 +10,9 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import net.citizensnpcs.api.CitizensAPI;
|
||||
import net.citizensnpcs.api.npc.MemoryNPCDataStore;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.api.npc.NPCRegistry;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.trait.ArmorStandTrait;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
@ -34,7 +36,11 @@ public class PlayerAnimationImpl {
|
||||
case SIT:
|
||||
player.getBukkitEntity().setMetadata("citizens.sitting",
|
||||
new FixedMetadataValue(CitizensAPI.getPlugin(), true));
|
||||
final NPC holder = CitizensAPI.getNPCRegistry().createNPC(EntityType.ARMOR_STAND, "");
|
||||
NPCRegistry registry = CitizensAPI.getNamedNPCRegistry("PlayerAnimationImpl");
|
||||
if (registry == null) {
|
||||
registry = CitizensAPI.createNamedNPCRegistry("PlayerAnimationImpl", new MemoryNPCDataStore());
|
||||
}
|
||||
final NPC holder = registry.createNPC(EntityType.ARMOR_STAND, "");
|
||||
holder.spawn(player.getBukkitEntity().getLocation());
|
||||
ArmorStandTrait trait = holder.getTrait(ArmorStandTrait.class);
|
||||
trait.setGravity(false);
|
||||
@ -43,7 +49,6 @@ public class PlayerAnimationImpl {
|
||||
trait.setSmall(true);
|
||||
trait.setMarker(true);
|
||||
trait.setVisible(false);
|
||||
holder.getTrait(ArmorStandTrait.class).setVisible(false);
|
||||
holder.data().set(NPC.NAMEPLATE_VISIBLE_METADATA, false);
|
||||
holder.data().set(NPC.DEFAULT_PROTECTED_METADATA, true);
|
||||
new BukkitRunnable() {
|
||||
|
Loading…
Reference in New Issue
Block a user