Package org.bukkit.entity
Interface Villager
-
- All Superinterfaces:
Ageable
,Attributable
,CommandSender
,Creature
,Damageable
,Entity
,InventoryHolder
,LivingEntity
,Lootable
,Merchant
,Metadatable
,Mob
,Nameable
,NPC
,Permissible
,ProjectileSource
,ServerOperator
public interface Villager extends Ageable, NPC, InventoryHolder, Merchant
Represents a villager NPC
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Villager.Career
The Career of this Villager.static class
Villager.Profession
Represents the various different Villager professions there may be.-
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.Career
getCareer()
Get the currentVillager.Career
for this Villager.Inventory
getInventory()
Gets this villager's inventory.Villager.Profession
getProfession()
Gets the current profession of this villager.int
getRiches()
Gets this villager's riches, the number of emeralds this villager has been given.void
setCareer(Villager.Career career)
Set the newVillager.Career
for this Villager.void
setCareer(Villager.Career career, boolean resetTrades)
Set the newVillager.Career
for this Villager.void
setProfession(Villager.Profession profession)
Sets the new profession of this villager.void
setRiches(int riches)
Sets this villager's riches.-
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, getHealth, getMaxHealth, resetMaxHealth, setHealth, setMaxHealth
-
Methods inherited from interface org.bukkit.entity.Entity
addPassenger, addScoreboardTag, eject, getEntityId, getFacing, getFallDistance, getFireTicks, getHeight, getLastDamageCause, getLocation, getLocation, getMaxFireTicks, getNearbyEntities, getPassenger, getPassengers, getPistonMoveReaction, getPortalCooldown, 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, 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, getNoDamageTicks, getPotionEffect, getRemainingAir, getRemoveWhenFarAway, getTargetBlock, hasAI, hasLineOfSight, hasPotionEffect, isCollidable, isGliding, isLeashed, isRiptiding, isSwimming, removePotionEffect, setAI, setCanPickupItems, setCollidable, setGliding, setLastDamage, setLeashHolder, setMaximumAir, setMaximumNoDamageTicks, 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.projectiles.ProjectileSource
launchProjectile, launchProjectile
-
Methods inherited from interface org.bukkit.permissions.ServerOperator
isOp, setOp
-
-
-
-
Method Detail
-
getProfession
Villager.Profession getProfession()
Gets the current profession of this villager.- Returns:
- Current profession.
-
setProfession
void setProfession(Villager.Profession profession)
Sets the new profession of this villager.- Parameters:
profession
- New profession.
-
getCareer
Villager.Career getCareer()
Get the currentVillager.Career
for this Villager.- Returns:
- the
Villager.Career
-
setCareer
void setCareer(Villager.Career career)
Set the newVillager.Career
for this Villager. This method will reset the villager's trades to the new career.- Parameters:
career
- the new career, or null to clear the career to a random one- Throws:
IllegalArgumentException
- when the newVillager.Career
cannot be used with this Villager's currentVillager.Profession
.
-
setCareer
void setCareer(Villager.Career career, boolean resetTrades)
Set the newVillager.Career
for this Villager.- Parameters:
career
- the new career, or null to clear the career to a random oneresetTrades
- true to reset this Villager's trades to the new career's (if any)- Throws:
IllegalArgumentException
- when the newVillager.Career
cannot be used with this Villager's currentVillager.Profession
.
-
getInventory
Inventory getInventory()
Gets this villager's inventory.
Note that this inventory is not the Merchant inventory, rather, it is the items that a villager might have collected (from harvesting crops, etc.) Get the object's inventory.- Specified by:
getInventory
in interfaceInventoryHolder
- Returns:
- The inventory.
-
getRiches
int getRiches()
Gets this villager's riches, the number of emeralds this villager has been given.- Returns:
- the villager's riches
-
setRiches
void setRiches(int riches)
Sets this villager's riches.- Parameters:
riches
- the new riches- See Also:
getRiches()
-
-