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

The following examples show how to use org.bukkit.entity.ArmorStand#setBasePlate() . 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: MainListener.java    From ArmorStandTools with MIT License 6 votes vote down vote up
private ArmorStand spawnArmorStand(Location l) {
    ArmorStand as = (ArmorStand) l.getWorld().spawnEntity(l, EntityType.ARMOR_STAND);
    as.setHelmet(Config.helmet);
    as.setChestplate(Config.chest);
    as.setLeggings(Config.pants);
    as.setBoots(Config.boots);
    as.getEquipment().setItemInMainHand(Config.itemInHand);
    as.getEquipment().setItemInOffHand(Config.itemInOffHand);
    as.setVisible(Config.isVisible);
    as.setSmall(Config.isSmall);
    as.setArms(Config.hasArms);
    as.setBasePlate(Config.hasBasePlate);
    as.setGravity(Config.hasGravity);
    as.setInvulnerable(Config.invulnerable);
    if(Config.defaultName.length() > 0) {
        as.setCustomName(Config.defaultName);
        as.setCustomNameVisible(true);
    }
    Main.nms.setSlotsDisabled(as, Config.equipmentLock);
    return as;
}
 
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 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 4
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 5
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 6
Source File: FlagObjective.java    From CardinalPGM with MIT License 5 votes vote down vote up
private ArmorStand createArmorStand() {
    Location loc = getCurrentFlagLocation().add(0,0.6875,0);
    ArmorStand armorStand = GameHandler.getGameHandler().getMatchWorld().spawn(loc, ArmorStand.class);
    armorStand.setGravity(false);
    armorStand.setVisible(false);
    armorStand.setSmall(true);
    armorStand.setBasePlate(false);
    armorStand.setCustomNameVisible(true);
    armorStand.setCustomName(getDisplayName());
    return armorStand;
}
 
Example 7
Source File: DeathStandsModule.java    From UHC with MIT License 4 votes vote down vote up
@EventHandler(priority = EventPriority.HIGH)
public void on(PlayerDeathEvent event) {
    if (!isEnabled()) return;

    final Player player = event.getEntity();

    // make the player invisible for the duration of their death animation
    player.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, DEATH_ANIMATION_TIME, 1));

    final Location location = player.getLocation();

    // create an armour stand at the player
    final ArmorStand stand = player.getWorld().spawn(location.clone().add(0, .2D, 0), ArmorStand.class);
    stand.setBasePlate(false);
    stand.setArms(true);

    // give the armour stand the death message as a name
    stand.setCustomName(STAND_PREFIX + event.getDeathMessage());
    stand.setCustomNameVisible(true);

    // face the same direction as the player
    stand.getLocation().setDirection(location.getDirection());

    // set the armour stand helmet to be looking at the same yaw
    stand.setHeadPose(new EulerAngle(Math.toRadians(location.getPitch()), 0, 0));

    // use the player's velocity as a base and apply it to the stand
    stand.setVelocity(
            player.getVelocity()
                    .clone()
                    .multiply(PLAYER_VELOCITY_MULTIPLIER)
                    .add(new Vector(0D, PLAYER_VELOICY_Y_ADDITIONAL, 0D))
    );

    // start with player's existing items in each slot (if exists)
    Map<EquipmentSlot, ItemStack> toSet = getItems(player.getInventory());

    // overide with any saved items in the metadata
    toSet.putAll(getSavedSlots(player));

    // filter out the invalid items
    toSet = Maps.filterValues(toSet, Predicates.not(EMPTY_ITEM));

    final List<ItemStack> drops = event.getDrops();

    for (final Map.Entry<EquipmentSlot, ItemStack> entry : toSet.entrySet()) {
        final ItemStack stack = entry.getValue();

        if (stack == null) continue;

        // remove the first matching stack in the drop list
        removeFirstEquals(drops, stack);

        // set the item on the armour stand in the correct slot
        switch (entry.getKey()) {
            case HAND:
                stand.setItemInHand(stack);
                break;
            case HEAD:
                stand.setHelmet(stack);
                break;
            case CHEST:
                stand.setChestplate(stack);
                break;
            case LEGS:
                stand.setLeggings(stack);
                break;
            case FEET:
                stand.setBoots(stack);
                break;
            default:
        }
    }
}