Package org.bukkit.entity
Interface Villager
-
- All Superinterfaces:
AbstractVillager
,Ageable
,Attributable
,CommandSender
,Creature
,Damageable
,Entity
,InventoryHolder
,LivingEntity
,Lootable
,Merchant
,Metadatable
,Mob
,Nameable
,NPC
,Permissible
,PersistentDataHolder
,ProjectileSource
,ServerOperator
public interface Villager extends AbstractVillager
Represents a villager NPC
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Villager.Profession
Represents the various different Villager professions there may be.static class
Villager.Type
Represents Villager type, usually corresponding to what biome they spawn in.-
Nested classes/interfaces inherited from interface org.bukkit.entity.Entity
Entity.Spigot
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Villager.Profession
getProfession()
Gets the current profession of this villager.int
getVillagerExperience()
Gets the trading experience of this villager.int
getVillagerLevel()
Gets the level of this villager.Villager.Type
getVillagerType()
Gets the current type of this villager.void
setProfession(Villager.Profession profession)
Sets the new profession of this villager.void
setVillagerExperience(int experience)
Sets the trading experience of this villager.void
setVillagerLevel(int level)
Sets the level of this villager.void
setVillagerType(Villager.Type type)
Sets the new type of this villager.boolean
sleep(Location location)
Attempts to make this villager sleep at the given location.void
wakeup()
Causes this villager to wake up if he's currently sleeping.-
Methods inherited from interface org.bukkit.entity.AbstractVillager
getInventory
-
Methods inherited from interface org.bukkit.entity.Ageable
canBreed, getAge, getAgeLock, isAdult, setAdult, setAge, setAgeLock, setBaby, setBreed
-
Methods inherited from interface org.bukkit.attribute.Attributable
getAttribute
-
Methods inherited from interface org.bukkit.command.CommandSender
getName, sendMessage, sendMessage
-
Methods inherited from interface org.bukkit.entity.Damageable
damage, damage, getAbsorptionAmount, getHealth, getMaxHealth, resetMaxHealth, setAbsorptionAmount, setHealth, setMaxHealth
-
Methods inherited from interface org.bukkit.entity.Entity
addPassenger, addScoreboardTag, eject, getBoundingBox, getEntityId, getFacing, getFallDistance, getFireTicks, getHeight, getLastDamageCause, getLocation, getLocation, getMaxFireTicks, getNearbyEntities, getPassenger, getPassengers, getPistonMoveReaction, getPortalCooldown, getPose, getScoreboardTags, getServer, getTicksLived, getType, getUniqueId, getVehicle, getVelocity, getWidth, getWorld, hasGravity, isCustomNameVisible, isDead, isEmpty, isGlowing, isInsideVehicle, isInvulnerable, isOnGround, isPersistent, isSilent, isValid, leaveVehicle, playEffect, remove, removePassenger, removeScoreboardTag, setCustomNameVisible, setFallDistance, setFireTicks, setGlowing, setGravity, setInvulnerable, setLastDamageCause, setPassenger, setPersistent, setPortalCooldown, setRotation, setSilent, setTicksLived, setVelocity, spigot, teleport, teleport, teleport, teleport
-
Methods inherited from interface org.bukkit.entity.LivingEntity
addPotionEffect, addPotionEffect, addPotionEffects, getActivePotionEffects, getCanPickupItems, getEquipment, getEyeHeight, getEyeHeight, getEyeLocation, getKiller, getLastDamage, getLastTwoTargetBlocks, getLeashHolder, getLineOfSight, getMaximumAir, getMaximumNoDamageTicks, getMemory, getNoDamageTicks, getPotionEffect, getRemainingAir, getRemoveWhenFarAway, getTargetBlock, getTargetBlockExact, getTargetBlockExact, hasAI, hasLineOfSight, hasPotionEffect, isCollidable, isGliding, isLeashed, isRiptiding, isSleeping, isSwimming, rayTraceBlocks, rayTraceBlocks, removePotionEffect, setAI, setCanPickupItems, setCollidable, setGliding, setLastDamage, setLeashHolder, setMaximumAir, setMaximumNoDamageTicks, setMemory, setNoDamageTicks, setRemainingAir, setRemoveWhenFarAway, setSwimming
-
Methods inherited from interface org.bukkit.loot.Lootable
getLootTable, getSeed, setLootTable, setSeed
-
Methods inherited from interface org.bukkit.inventory.Merchant
getRecipe, getRecipeCount, getRecipes, getTrader, isTrading, setRecipe, setRecipes
-
Methods inherited from interface org.bukkit.metadata.Metadatable
getMetadata, hasMetadata, removeMetadata, setMetadata
-
Methods inherited from interface org.bukkit.Nameable
getCustomName, setCustomName
-
Methods inherited from interface org.bukkit.permissions.Permissible
addAttachment, addAttachment, addAttachment, addAttachment, getEffectivePermissions, hasPermission, hasPermission, isPermissionSet, isPermissionSet, recalculatePermissions, removeAttachment
-
Methods inherited from interface org.bukkit.persistence.PersistentDataHolder
getPersistentDataContainer
-
Methods inherited from interface org.bukkit.projectiles.ProjectileSource
launchProjectile, launchProjectile
-
Methods inherited from interface org.bukkit.permissions.ServerOperator
isOp, setOp
-
-
-
-
Method Detail
-
getProfession
@NotNull Villager.Profession getProfession()
Gets the current profession of this villager.- Returns:
- Current profession.
-
setProfession
void setProfession(@NotNull Villager.Profession profession)
Sets the new profession of this villager.- Parameters:
profession
- New profession.
-
getVillagerType
@NotNull Villager.Type getVillagerType()
Gets the current type of this villager.- Returns:
- Current type.
-
setVillagerType
void setVillagerType(@NotNull Villager.Type type)
Sets the new type of this villager.- Parameters:
type
- New type.
-
getVillagerLevel
int getVillagerLevel()
Gets the level of this villager. A villager with a level of 1 and no experience is liable to lose its profession.- Returns:
- this villager's level
-
setVillagerLevel
void setVillagerLevel(int level)
Sets the level of this villager. A villager with a level of 1 and no experience is liable to lose its profession.- Parameters:
level
- the new level- Throws:
IllegalArgumentException
- if level not between [1, 5]
-
getVillagerExperience
int getVillagerExperience()
Gets the trading experience of this villager.- Returns:
- trading experience
-
setVillagerExperience
void setVillagerExperience(int experience)
Sets the trading experience of this villager.- Parameters:
experience
- new experience- Throws:
IllegalArgumentException
- if experience < 0
-
sleep
boolean sleep(@NotNull Location location)
Attempts to make this villager sleep at the given location.
The location must be in the current world and have a bed placed at the location. The villager will put its head on the specified block while sleeping.- Parameters:
location
- the location of the bed- Returns:
- whether the sleep was successful
-
wakeup
void wakeup()
Causes this villager to wake up if he's currently sleeping.- Throws:
IllegalStateException
- if not sleeping
-
-