Java Code Examples for org.bukkit.inventory.EntityEquipment#setBoots()

The following examples show how to use org.bukkit.inventory.EntityEquipment#setBoots() . 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: PlayersManager.java    From UhcCore with GNU General Public License v3.0 5 votes vote down vote up
public void spawnOfflineZombieFor(Player player){
	UhcPlayer uhcPlayer = getUhcPlayer(player);

	Zombie zombie = (Zombie) player.getWorld().spawnEntity(player.getLocation(), EntityType.ZOMBIE);
	zombie.setCustomName(uhcPlayer.getDisplayName());
	zombie.setCustomNameVisible(true);
	// 1.8 doesn't have setAI method so use VersionUtils.
	VersionUtils.getVersionUtils().setEntityAI(zombie, false);
	zombie.setBaby(false);
	zombie.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 999999, 1, true, true));

	EntityEquipment equipment = zombie.getEquipment();
	equipment.setHelmet(VersionUtils.getVersionUtils().createPlayerSkull(player.getName(), player.getUniqueId()));
	equipment.setChestplate(player.getInventory().getChestplate());
	equipment.setLeggings(player.getInventory().getLeggings());
	equipment.setBoots(player.getInventory().getBoots());
	equipment.setItemInHand(player.getItemInHand());

	uhcPlayer.getStoredItems().clear();
	for (ItemStack item : player.getInventory().getContents()){
		if (item != null){
			uhcPlayer.getStoredItems().add(item);
		}
	}

	uhcPlayer.setOfflineZombie(zombie);
}
 
Example 2
Source File: SpawnMobEvent.java    From BetonQuest with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected Void execute(String playerID) throws QuestRuntimeException {
    Location location = loc.getLocation(playerID);
    int a = amount.getInt(playerID);
    for (int i = 0; i < a; i++) {
        Entity entity = location.getWorld().spawnEntity(location, type);
        if (entity instanceof LivingEntity) {
            LivingEntity living = (LivingEntity) entity;
            EntityEquipment eq = living.getEquipment();
            eq.setHelmet(helmet == null ? null : helmet.generate(1));
            eq.setHelmetDropChance(0);
            eq.setChestplate(chestplate == null ? null : chestplate.generate(1));
            eq.setChestplateDropChance(0);
            eq.setLeggings(leggings == null ? null : leggings.generate(1));
            eq.setLeggingsDropChance(0);
            eq.setBoots(boots == null ? null : boots.generate(1));
            eq.setBootsDropChance(0);
            eq.setItemInMainHand(mainHand == null ? null : mainHand.generate(1));
            eq.setItemInMainHandDropChance(0);
            eq.setItemInOffHand(offHand == null ? null : offHand.generate(1));
            eq.setItemInOffHandDropChance(0);
        }
        int j = 0;
        for (Item item : drops) {
            entity.setMetadata("betonquest-drops-" + j,
                    new FixedMetadataValue(BetonQuest.getInstance(), item.getID().getFullID() + ":"
                            + item.getAmount().getInt(playerID)));
            j++;
        }
        if (name != null && entity instanceof LivingEntity) {
            LivingEntity livingEntity = (LivingEntity) entity;
            livingEntity.setCustomName(name);
        }
        if (marked != null) {
            entity.setMetadata("betonquest-marked", new FixedMetadataValue(BetonQuest.getInstance(), marked));
        }
    }
    return null;
}
 
Example 3
Source File: EquipmentSlot.java    From Skript with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void set(final EntityEquipment e, final @Nullable ItemStack item) {
	e.setBoots(item);
}