Java Code Examples for org.bukkit.entity.ArmorStand#setMarker()

The following examples show how to use org.bukkit.entity.ArmorStand#setMarker() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ArmorStandFactory.java    From CS-CoreLib with GNU General Public License v3.0 6 votes vote down vote up
public static ArmorStand createSmall(Location l, ItemStack item, EulerAngle arm, float yaw) {
	l.setYaw(yaw);
	ArmorStand armorStand = (ArmorStand) l.getWorld().spawnEntity(l, EntityType.ARMOR_STAND);
	armorStand.getEquipment().setItemInMainHand(item);
	armorStand.setVisible(false);
	armorStand.setSilent(true);
	armorStand.setMarker(true);
	armorStand.setGravity(false);
	armorStand.setSmall(true);
	armorStand.setArms(true);
	armorStand.setRightArmPose(arm);
	armorStand.setBasePlate(false);
	armorStand.setRemoveWhenFarAway(false);
	
	return armorStand;
}
 
Example 2
Source File: ArmorStandFactory.java    From CS-CoreLib with GNU General Public License v3.0 5 votes vote down vote up
public static ArmorStand createHidden(Location l) {
	ArmorStand armorStand = (ArmorStand) l.getWorld().spawnEntity(l, EntityType.ARMOR_STAND);
	armorStand.setVisible(false);
	armorStand.setSilent(true);
	armorStand.setMarker(true);
	armorStand.setGravity(false);
	armorStand.setBasePlate(false);
	armorStand.setCustomNameVisible(true);
	armorStand.setRemoveWhenFarAway(false);
	
	return armorStand;
}
 
Example 3
Source File: ArmorStandFactory.java    From CS-CoreLib with GNU General Public License v3.0 5 votes vote down vote up
public static ArmorStand createSmall(Location l, ItemStack head, float yaw) {
	l.setYaw(yaw);
	ArmorStand armorStand = (ArmorStand) l.getWorld().spawnEntity(l, EntityType.ARMOR_STAND);
	armorStand.getEquipment().setHelmet(head);
	armorStand.setVisible(false);
	armorStand.setSilent(true);
	armorStand.setMarker(true);
	armorStand.setGravity(false);
	armorStand.setSmall(true);
	armorStand.setBasePlate(false);
	armorStand.setRemoveWhenFarAway(false);
	
	return armorStand;
}
 
Example 4
Source File: SimpleHologram.java    From Slimefun4 with GNU General Public License v3.0 5 votes vote down vote up
public static ArmorStand create(Location l) {
    ArmorStand armorStand = (ArmorStand) l.getWorld().spawnEntity(l, EntityType.ARMOR_STAND);
    armorStand.setVisible(false);
    armorStand.setSilent(true);
    armorStand.setMarker(true);
    armorStand.setGravity(false);
    armorStand.setBasePlate(false);
    armorStand.setCustomNameVisible(true);
    armorStand.setRemoveWhenFarAway(false);
    return armorStand;
}
 
Example 5
Source File: DamageDisplay.java    From EliteMobs with GNU General Public License v3.0 4 votes vote down vote up
public static void displayDamage(Entity entity, double damage) {

        if (!ConfigValues.mobCombatSettingsConfig.getBoolean(MobCombatSettingsConfig.DISPLAY_DAMAGE_ON_HIT)) return;

        Location entityLocation = entity.getLocation();

        Random random = new Random();
        double randomCoordX = (random.nextDouble() * 2) - 1 + entityLocation.getX();
        double randomCoordZ = (random.nextDouble() * 2) - 1 + entityLocation.getZ();

        Location newLocation = new Location(entityLocation.getWorld(), randomCoordX, entityLocation.getY() + 1.7, randomCoordZ);

         /*
        Dirty fix: armorstands don't render invisibly on their first tick, so it gets moved elsewhere temporarily
         */
        ArmorStand armorStand = (ArmorStand) newLocation.getWorld().spawnEntity(newLocation.add(new Vector(0, -50, 0)), EntityType.ARMOR_STAND);

        armorStand.setVisible(false);
        armorStand.setMarker(true);
        int newDisplayDamage = (int) damage;
        armorStand.setCustomName(ChatColor.RED + "" + ChatColor.BOLD + "" + newDisplayDamage + "");
        armorStand.setGravity(false);
        EntityTracker.registerArmorStands(armorStand);
        armorStand.setCustomNameVisible(false);

        new BukkitRunnable() {

            int taskTimer = 0;

            @Override
            public void run() {

                if (taskTimer == 0) {
                    armorStand.teleport(new Location(armorStand.getWorld(), armorStand.getLocation().getX(),
                            armorStand.getLocation().getY() + 50, armorStand.getLocation().getZ()));
                } else
                    armorStand.teleport(new Location(armorStand.getWorld(), armorStand.getLocation().getX(),
                            armorStand.getLocation().getY() + 0.1, armorStand.getLocation().getZ()));

                if (taskTimer == 1)
                    armorStand.setCustomNameVisible(true);

                taskTimer++;

                if (taskTimer > 15) {

                    EntityTracker.unregisterArmorStand(armorStand);
                    cancel();

                }

            }

        }.runTaskTimer(Bukkit.getPluginManager().getPlugin(MetadataHandler.ELITE_MOBS), 0, 1);

    }
 
Example 6
Source File: NPCChatBubble.java    From EliteMobs with GNU General Public License v3.0 4 votes vote down vote up
public NPCChatBubble(String message, NPCEntity npcEntity, Player player) {

        if (npcEntity.getVillager().hasPotionEffect(PotionEffectType.INVISIBILITY)) return;
        if (npcEntity.getIsTalking()) return;
        npcEntity.startTalkingCooldown();

        int lineCounter = 0;

        for (String substring : message.split("\\\\n")) {

            Location newLocation = npcEntity.getVillager().getEyeLocation().clone()
                    .add(player.getLocation().clone().subtract(npcEntity.getVillager().getLocation()).toVector().normalize().multiply(0.5))
                    .add(new Vector(0, -50 - (0.2 * lineCounter), 0));

            ArmorStand messageBubble = (ArmorStand) newLocation.getWorld().spawnEntity(newLocation, EntityType.ARMOR_STAND);
            EntityTracker.registerArmorStands(messageBubble);
            messageBubble.setVisible(false);
            messageBubble.setMarker(true);
            messageBubble.setCustomName(ChatColorConverter.convert(substring));
            messageBubble.setCustomNameVisible(true);
            messageBubble.setGravity(false);

            new BukkitRunnable() {
                int counter = 0;

                @Override
                public void run() {
                    if (counter > 20 * 3) {
                        messageBubble.remove();
                        cancel();
                        return;
                    }

                    if (counter == 1)
                        messageBubble.teleport(messageBubble.getLocation().add(new Vector(0, 49.2, 0)));

                    if (counter > 1)
                        messageBubble.teleport(messageBubble.getLocation().clone().add(new Vector(0, 0.01, 0)));

                    counter++;
                }
            }.runTaskTimer(MetadataHandler.PLUGIN, 0, 1);

            lineCounter++;

        }

    }
 
Example 7
Source File: HealthDisplay.java    From EliteMobs with GNU General Public License v3.0 2 votes vote down vote up
public static void displayHealth(LivingEntity livingEntity, double damage) {

        if (!ConfigValues.mobCombatSettingsConfig.getBoolean(MobCombatSettingsConfig.DISPLAY_HEALTH_ON_HIT)) return;

        int maxHealth = (int) livingEntity.getMaxHealth();
        int currentHealth = (int) (livingEntity.getHealth() - damage);

        Location entityLocation = new Location(livingEntity.getWorld(), livingEntity.getLocation().getX(),
                livingEntity.getLocation().getY() + livingEntity.getEyeHeight() + 0.5, livingEntity.getLocation().getZ());

        /*
        Dirty fix: armorstands don't render invisibly on their first tick, so it gets moved elsewhere temporarily
         */
        ArmorStand armorStand = (ArmorStand) entityLocation.getWorld().spawnEntity(entityLocation.add(new Vector(0, -50, 0)), EntityType.ARMOR_STAND);

        armorStand.setVisible(false);
        armorStand.setMarker(true);
        armorStand.setCustomName(setHealthColor(currentHealth, maxHealth) + "" + currentHealth + "/" + maxHealth);
        armorStand.setGravity(false);
        EntityTracker.registerArmorStands(armorStand);
        armorStand.setCustomNameVisible(false);


        new BukkitRunnable() {

            int taskTimer = 0;

            @Override
            public void run() {

                Location newLocation = new Location(livingEntity.getWorld(), livingEntity.getLocation().getX(),
                        livingEntity.getLocation().getY() + livingEntity.getEyeHeight() + 0.5, livingEntity.getLocation().getZ());

                armorStand.teleport(newLocation);

                if (taskTimer == 1)
                    armorStand.setCustomNameVisible(true);

                taskTimer++;

                if (taskTimer > 15) {

                    EntityTracker.unregisterArmorStand(armorStand);
                    cancel();

                }

            }

        }.runTaskTimer(Bukkit.getPluginManager().getPlugin(MetadataHandler.ELITE_MOBS), 0, 1L);

    }