/** * Returns the location of the ball. * * @return location */ @Override public Location getLocation() { return this.getHitBox().getLocation(); }
public void createTimedHologram(final Location location, String text, Long timeout) { ArmorStand as = (ArmorStand) location.add(0.5, 1, 0.5).getWorld().spawnEntity(location, EntityType.ARMOR_STAND); //Spawn the ArmorStand as.setVisible(false); //Makes the ArmorStand invisible as.setGravity(false); //Make sure it doesn't fall as.setCanPickupItems(false); //I'm not sure what happens if you leave this as it is, but you might as well disable it as.setCustomName(SavageFactions.plugin.color(text)); //Set this to the text you want as.setCustomNameVisible(true); //This makes the text appear no matter if your looking at the entity or not final ArmorStand armorStand = as; Bukkit.getScheduler().scheduleSyncDelayedTask(SavageFactions.plugin, () -> { armorStand.remove(); getLogger().info("Removing Hologram."); } , timeout * 20); }
@Override public void apply(Entity entity) { if (!(entity instanceof ArmorStand)) return; ArmorStand armorStand = (ArmorStand)entity; armorStand.setItemInHand(itemInHand); armorStand.setBoots(boots); armorStand.setLeggings(leggings); armorStand.setChestplate(chestplate); armorStand.setHelmet(helmet); if (bodyPose != null) armorStand.setBodyPose(bodyPose); if (leftArmPose != null) armorStand.setLeftArmPose(leftArmPose); if (rightArmPose != null) armorStand.setRightArmPose(rightArmPose); if (leftLegPose != null) armorStand.setLeftLegPose(leftLegPose); if (rightLegPose != null) armorStand.setRightLegPose(rightLegPose); if (headPose != null) armorStand.setHeadPose(headPose); armorStand.setGravity(hasGravity); armorStand.setVisible(isVisible); armorStand.setArms(hasArms); armorStand.setSmall(isSmall); armorStand.setBasePlate(hasBasePlate); armorStand.setMarker(isMarker); CompatibilityUtils.setDisabledSlots(armorStand, disabledSlots); }
@Override public void setArmorContents(ItemStack[] arg0) { entity.setHelmet(arg0[EquipmentSlot.HELMET.index - 1]); entity.setChestplate(arg0[EquipmentSlot.CHESTPLATE.index - 1]); entity.setLeggings(arg0[EquipmentSlot.LEGGINGS.index - 1]); entity.setBoots(arg0[EquipmentSlot.BOOTS.index - 1]); }
@Override public ItemStack[] getArmorContents() { return new ItemStack[] { entity.getHelmet(), entity.getChestplate(), entity.getLeggings(), entity.getBoots() }; }
as.remove(); as.setSmall(true); as.setMarker(true); as.setArms(false); as.setBasePlate(false); as.setGravity(false); as.setVisible(false); as.setCustomName(line); as.setCustomNameVisible(true); as.setAI(false); as.setCollidable(false); as.setInvulnerable(true); if (as.getCustomName() != null && as.getCustomName().equals(line)) { continue; as.setCustomName(line);
public EntityArmorStandData(ArmorStand armorStand) { itemInHand = armorStand.getItemInHand(); if (itemInHand != null) itemInHand = itemInHand.clone(); boots = armorStand.getBoots(); if (boots != null) boots = boots.clone(); leggings = armorStand.getLeggings(); if (leggings != null) leggings = leggings.clone(); chestplate = armorStand.getChestplate(); if (chestplate != null) chestplate = chestplate.clone(); helmet = armorStand.getHelmet(); if (helmet != null) helmet = helmet.clone(); bodyPose = armorStand.getBodyPose(); leftArmPose = armorStand.getLeftArmPose(); rightArmPose = armorStand.getRightArmPose(); leftLegPose = armorStand.getLeftLegPose(); rightLegPose = armorStand.getRightLegPose(); headPose = armorStand.getHeadPose(); hasGravity = armorStand.hasGravity(); isVisible = armorStand.isVisible(); hasArms = armorStand.hasArms(); isSmall = armorStand.isSmall(); hasBasePlate = armorStand.hasBasePlate(); isMarker = armorStand.isMarker(); disabledSlots = CompatibilityUtils.getDisabledSlots(armorStand); }
asL.setCanPickupItems(false); asL.setMarker(true); asL.setPersistent(false); asL.setSmall(true); asL.setCustomNameVisible(false); asL.setGravity(false); asL.setVisible(false); asL.setLeftArmPose(new EulerAngle(90 * Math.PI / 180, 60 * Math.PI / 180, 0)); asL.getEquipment().setItemInOffHand(new ItemStack(Material.SHIELD)); asR.setCanPickupItems(false); asR.setMarker(true); asR.setPersistent(false); asR.setSmall(true); asR.setCustomNameVisible(false); asR.setGravity(false); asR.setVisible(false); asR.setRightArmPose(new EulerAngle(90 * Math.PI / 180, 300 * Math.PI / 180, 0)); asR.getEquipment().setItemInMainHand(new ItemStack(Material.SHIELD)); asB.setCanPickupItems(false); asB.setMarker(true); asB.setPersistent(false); asB.setSmall(true); asB.setCustomNameVisible(false); asB.setGravity(false); asB.setVisible(false); asB.setLeftArmPose(new EulerAngle(90 * Math.PI / 180, 270 * Math.PI / 180, 0)); asB.getEquipment().setItemInOffHand(new ItemStack(Material.SHIELD));
final TempArmorStand tas = new TempArmorStand(this.target.getLocation()); this.trap = tas.getArmorStand(); this.trap.setVisible(false); this.trap.setInvulnerable(false); this.trap.setSmall(true); this.trap.setHelmet(new ItemStack(m)); this.trap.setHealth(this.trapHP); this.trap.setMetadata("earthgrab:trap", new FixedMetadataValue(ProjectKorra.plugin, this)); if (this.trap.getLocation().clone().subtract(0, 0.1, 0).getBlock().getType() != Material.AIR) { this.trap.setGravity(false); } else { this.trap.setGravity(true); if (this.trap.getLocation().distance(this.target.getLocation()) > 2) { this.remove(); return; if (this.trap.isDead()) { this.remove(); return;
public static ArmorStand getArmorStand(Location reactor) { Location l = new Location(reactor.getWorld(), reactor.getX() + 0.5, reactor.getY(), reactor.getZ() + 0.5); for (Entity n : l.getChunk().getEntities()) { if (n instanceof ArmorStand) { if (l.distanceSquared(n.getLocation()) < 0.4D) return (ArmorStand) n; } } ArmorStand hologram = ArmorStandFactory.createHidden(l); hologram.setCustomNameVisible(false); hologram.setCustomName(null); return hologram; }
ArmorStand armorStand = CompatibilityUtils.createArmorStand(mage.getLocation()); armorStand.setHealth(armorStandHealth); CompatibilityUtils.setMaxHealth(armorStand, armorStandHealth); if (armorStandInvisible) { armorStand.setMarker(true); armorStand.setGravity(false); armorStand.setSmall(true); armorStand.setHelmet(item); } else if (helmetItem != null) { armorStand.setHelmet(helmetItem); armorStand.setCustomName(mountName);
@Override public SpellResult start(CastContext context) { MageController controller = context.getController(); Location location = adjustLocation(sourceLocation.getLocation(context)); ArmorStand armorStand = (ArmorStand)setEntity(controller, CompatibilityUtils.createArmorStand(location)); armorStand.setMarker(armorStandMarker); armorStand.setVisible(!armorStandInvisible); armorStand.setBasePlate(showArmorStandBaseplate); armorStand.setGravity(armorStandGravity); armorStand.setSmall(smallArmorStand); armorStand.setArms(showArmorStandArms); CompatibilityUtils.setSilent(armorStand, true); CompatibilityUtils.setDisabledSlots(armorStand, 2039552); update(armorStand); CompatibilityUtils.addToWorld(location.getWorld(), armorStand, spawnReason); return super.start(context); }
protected void configureArmorStand(ArmorStand armorStand) { if (useHelmet) { armorStand.setHelmet(heldItem); } else { armorStand.setItemInHand(heldItem); armorStand.setMetadata("notarget", new FixedMetadataValue(controller.getPlugin(), true)); armorStand.setMetadata("broom", new FixedMetadataValue(controller.getPlugin(), true)); if (mountInvisible) { CompatibilityUtils.setInvisible(armorStand, true); armorStand.setMarker(true); armorStand.setRightArmPose(new EulerAngle(armorStandArm.getX(), armorStandArm.getY(), armorStandArm.getZ())); armorStand.setHeadPose(new EulerAngle(armorStandHead.getX(), armorStandHead.getY(), armorStandHead.getZ())); armorStand.setBodyPose(new EulerAngle(armorStandBody.getX(), armorStandBody.getY(), armorStandBody.getZ())); armorStand.setSmall(true);
@SuppressWarnings("deprecation") @Override public void run() { if (arrow.isDead() || !arrow.isValid()) { cancel(); return; } if (arrow.isInBlock() || arrow.isOnGround()) { translocatorPlayerMap.invalidate(arrow.getUniqueId()); playerTranslocatorMap.invalidate(player.getUniqueId()); Location location = arrow.getLocation(); arrow.remove(); ArmorStand armorStand = location.getWorld().spawn(location, ArmorStand.class); armorStand.setCanPickupItems(false); armorStand.setSmall(true); armorStand.setMarker(false); armorStand.setPersistent(false); armorStand.setCustomName(I18n.format("message.translocator", player.getName())); armorStand.setCustomNameVisible(true); playerTranslocatorMap.put(player.getUniqueId(), armorStand.getUniqueId()); translocatorPlayerMap.put(armorStand.getUniqueId(), player.getUniqueId()); cancel(); } } }.runTaskTimer(plugin, 0L, 5L);
@Override public void run() { ArmorStand hologram = getArmorStand(b); hologram.remove(); } });
/** * Saves the ball asynchronously when it is inside of a chunk which gets unloaded. Replaces the entity with an invisible armorstands which holds the * ball information for respawning. * * @param event event */ @EventHandler public void onChunkSaveEvent(ChunkUnloadEvent event) { for (final Entity entity : event.getChunk().getEntities()) { final Optional<BukkitBall> ball; if (entity instanceof LivingEntity) { if ((ball = this.ballController.getBallFromEntity((LivingEntity) entity)).isPresent()) { if (ball.get().isPersistent()) { this.pushToCache(ball.get()); this.ballController.remove(ball.get()); this.ballController.saveAndDestroy(ball.get(), true); final ArmorStand armorStand = (ArmorStand) event.getWorld().spawnEntity(((Location) ball.get().getLocation()), EntityType.ARMOR_STAND); armorStand.setCustomNameVisible(false); armorStand.setRemoveWhenFarAway(false); armorStand.setVisible(false); armorStand.setCustomName("balluuid-" + ball.get().getUUID().toString()); } else { ball.get().remove(); } } } } }
spawnPacket.getUUIDs().write(0, entity.getArmorStand().getUniqueId()); Location loc = entity.getArmorStand().getLocation(); spawnPacket.getDoubles().write(0, loc.getX()); spawnPacket.getDoubles().write(1, loc.getY());
@Override public void run() { ArmorStand hologram = getArmorStand(l); if (!hologram.isCustomNameVisible()) hologram.setCustomNameVisible(true); hologram.setCustomName(ChatColor.translateAlternateColorCodes('&', name)); } });
@Override public ItemStack getHelmet() { return entity.getHelmet(); }