Interface Villager
- All Superinterfaces:
- AbstractVillager,- Ageable,- Attributable,- Breedable,- CommandSender,- Creature,- Damageable,- Entity,- InventoryHolder,- LivingEntity,- Lootable,- Merchant,- Metadatable,- Mob,- Nameable,- NPC,- Permissible,- PersistentDataHolder,- ProjectileSource,- ServerOperator
- 
Nested Class SummaryNested ClassesModifier and TypeInterfaceDescriptionstatic interfaceRepresents the various different Villager professions there may be.static interfaceReputation change reason.static interfaceReputation type used in gossips.static interfaceRepresents Villager type, usually corresponding to what biome they spawn in.Nested classes/interfaces inherited from interface org.bukkit.entity.EntityEntity.Spigot
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddReputation(UUID uuid, Villager.ReputationType reputationType, int amount) Add reputation of a given type towards a given entity.voidaddReputation(UUID uuid, Villager.ReputationType reputationType, int amount, Villager.ReputationEvent changeReason) Add reputation of a given type towards a given entity, with a specific change reason.longGets the reputation decay time for this villager.Gets the current profession of this villager.intgetReputation(UUID uuid) Gets the reputation of an entity.intgetReputation(UUID uuid, Villager.ReputationType reputationType) Gets the reputation of an entity for a given type.intGets the trading experience of this villager.intGets the level of this villager.Gets the current type of this villager.intgetWeightedReputation(UUID uuid, Villager.ReputationType reputationType) Gets the weighted reputation of an entity for a given type.voidremoveReputation(UUID uuid, Villager.ReputationType reputationType, int amount) Remove reputation of a given type towards a given entity.voidremoveReputation(UUID uuid, Villager.ReputationType reputationType, int amount, Villager.ReputationEvent changeReason) Remove reputation of a given type towards a given entity, with a specific change reason.voidsetGossipDecayTime(long ticks) Sets the reputation decay time for this villager.voidsetProfession(Villager.Profession profession) Sets the new profession of this villager.voidsetReputation(UUID uuid, Villager.ReputationType reputationType, int amount) Set reputation of a given type towards a given entity.voidsetReputation(UUID uuid, Villager.ReputationType reputationType, int amount, Villager.ReputationEvent changeReason) Set reputation of a given type towards a given entity, with a specific change reason.voidsetVillagerExperience(int experience) Sets the trading experience of this villager.voidsetVillagerLevel(int level) Sets the level of this villager.voidsetVillagerType(Villager.Type type) Sets the new type of this villager.voidCauses this villager to shake his head.booleanAttempts to make this villager sleep at the given location.voidwakeup()Causes this villager to wake up if he's currently sleeping.zombify()Convert this Villager into a ZombieVillager as if it was killed by a Zombie.Methods inherited from interface org.bukkit.entity.AbstractVillagergetInventoryMethods inherited from interface org.bukkit.entity.AgeablegetAge, isAdult, setAdult, setAge, setBabyMethods inherited from interface org.bukkit.attribute.AttributablegetAttributeMethods inherited from interface org.bukkit.entity.BreedablecanBreed, getAgeLock, setAgeLock, setBreedMethods inherited from interface org.bukkit.command.CommandSendergetName, sendMessage, sendMessage, sendMessage, sendMessageMethods inherited from interface org.bukkit.entity.Damageabledamage, damage, damage, getAbsorptionAmount, getHealth, getMaxHealth, resetMaxHealth, setAbsorptionAmount, setHealth, setMaxHealthMethods inherited from interface org.bukkit.entity.EntityaddPassenger, addScoreboardTag, copy, copy, createSnapshot, eject, getAsString, getBoundingBox, getEntityId, getFacing, getFallDistance, getFireTicks, getFreezeTicks, getHeight, getLastDamageCause, getLocation, getLocation, getMaxFireTicks, getMaxFreezeTicks, getNearbyEntities, getPassenger, getPassengers, getPistonMoveReaction, getPortalCooldown, getPose, getScoreboardTags, getServer, getSpawnCategory, getSwimHighSpeedSplashSound, getSwimSound, getSwimSplashSound, getTicksLived, getTrackedBy, getType, getUniqueId, getVehicle, getVelocity, getWidth, getWorld, hasGravity, isCustomNameVisible, isDead, isEmpty, isFrozen, isGlowing, isInsideVehicle, isInvulnerable, isInWater, isInWorld, isOnGround, isPersistent, isSilent, isValid, isVisibleByDefault, isVisualFire, leaveVehicle, playEffect, remove, removePassenger, removeScoreboardTag, setCustomNameVisible, setFallDistance, setFireTicks, setFreezeTicks, setGlowing, setGravity, setInvulnerable, setLastDamageCause, setPassenger, setPersistent, setPortalCooldown, setRotation, setSilent, setTicksLived, setVelocity, setVisibleByDefault, setVisualFire, spigot, teleport, teleport, teleport, teleportMethods inherited from interface org.bukkit.entity.LivingEntityaddPotionEffect, addPotionEffect, addPotionEffects, attack, canBreatheUnderwater, getActivePotionEffects, getArrowCooldown, getArrowsInBody, getCanPickupItems, getCategory, getCollidableExemptions, getDeathSound, getDrinkingSound, getEatingSound, getEquipment, getEyeHeight, getEyeHeight, getEyeLocation, getFallDamageSound, getFallDamageSoundBig, getFallDamageSoundSmall, getHurtSound, getItemInUse, getItemInUseTicks, getKiller, getLastDamage, getLastTwoTargetBlocks, getLeashHolder, getLineOfSight, getMaximumAir, getMaximumNoDamageTicks, getMemory, getNoActionTicks, getNoDamageTicks, getPotionEffect, getRemainingAir, getRemoveWhenFarAway, getTargetBlock, getTargetBlockExact, getTargetBlockExact, hasAI, hasLineOfSight, hasPotionEffect, isClimbing, isCollidable, isGliding, isInvisible, isLeashed, isRiptiding, isSleeping, isSwimming, playHurtAnimation, rayTraceBlocks, rayTraceBlocks, removePotionEffect, setAI, setArrowCooldown, setArrowsInBody, setCanPickupItems, setCollidable, setGliding, setInvisible, setItemInUseTicks, setLastDamage, setLeashHolder, setMaximumAir, setMaximumNoDamageTicks, setMemory, setNoActionTicks, setNoDamageTicks, setRemainingAir, setRemoveWhenFarAway, setRiptiding, setSwimming, swingMainHand, swingOffHandMethods inherited from interface org.bukkit.loot.LootablegetLootTable, getSeed, setLootTable, setSeedMethods inherited from interface org.bukkit.inventory.MerchantgetRecipe, getRecipeCount, getRecipes, getTrader, isTrading, setRecipe, setRecipesMethods inherited from interface org.bukkit.metadata.MetadatablegetMetadata, hasMetadata, removeMetadata, setMetadataMethods inherited from interface org.bukkit.entity.MobgetAmbientSound, getTarget, isAware, setAware, setTargetMethods inherited from interface org.bukkit.NameablegetCustomName, setCustomNameMethods inherited from interface org.bukkit.permissions.PermissibleaddAttachment, addAttachment, addAttachment, addAttachment, getEffectivePermissions, hasPermission, hasPermission, isPermissionSet, isPermissionSet, recalculatePermissions, removeAttachmentMethods inherited from interface org.bukkit.persistence.PersistentDataHoldergetPersistentDataContainerMethods inherited from interface org.bukkit.projectiles.ProjectileSourcelaunchProjectile, launchProjectileMethods inherited from interface org.bukkit.permissions.ServerOperatorisOp, setOp
- 
Method Details- 
getProfessionGets the current profession of this villager.- Returns:
- Current profession.
 
- 
setProfessionSets the new profession of this villager.- Parameters:
- profession- New profession.
 
- 
getVillagerTypeGets the current type of this villager.- Returns:
- Current type.
 
- 
setVillagerTypeSets the new type of this villager.- Parameters:
- type- New type.
 
- 
getVillagerLevelint 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
 
- 
setVillagerLevelvoid 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]
 
- 
getVillagerExperienceint getVillagerExperience()Gets the trading experience of this villager.- Returns:
- trading experience
 
- 
setVillagerExperiencevoid setVillagerExperience(int experience) Sets the trading experience of this villager.- Parameters:
- experience- new experience
- Throws:
- IllegalArgumentException- if experience < 0
 
- 
sleepAttempts 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
 
- 
wakeupvoid wakeup()Causes this villager to wake up if he's currently sleeping.- Throws:
- IllegalStateException- if not sleeping
 
- 
shakeHeadvoid shakeHead()Causes this villager to shake his head.
- 
zombifyConvert this Villager into a ZombieVillager as if it was killed by a Zombie. Note: this will fire a EntityTransformEvent- Returns:
- the converted entity ZombieVillageror null if the conversion its cancelled
 
- 
getReputationGets the reputation of an entity for a given type.- Parameters:
- uuid- the UUID of the entity whose reputation is being checked
- reputationType- reputation type to be retrieved
- Returns:
- current reputation for the given reputation type
 
- 
getWeightedReputationGets the weighted reputation of an entity for a given type.The total reputation of an entity is a sum of its weighted reputations of each type, where the reputation is multiplied by weight assigned to its type. - Parameters:
- uuid- the UUID of the entity whose reputation is being checked
- reputationType- reputation type to be retrieved
- Returns:
- current reputation for the given reputation type
- See Also:
 
- 
getReputationGets the reputation of an entity.- Parameters:
- uuid- the UUID of the entity whose reputation is being checked
- Returns:
- current reputation for the given reputation type
 
- 
addReputationAdd reputation of a given type towards a given entity.The final value will be clamped to the maximum value supported by the provided reputation type. If the final value is below the reputation discard threshold, gossip associated with this reputation type will be removed. Note: this will fire a VillagerReputationChangeEvent.- Parameters:
- uuid- the UUID of the entity for whom the reputation is being added
- reputationType- reputation type to be modified
- amount- amount of reputation to add
 
- 
addReputationvoid addReputation(@NotNull UUID uuid, @NotNull Villager.ReputationType reputationType, int amount, @NotNull Villager.ReputationEvent changeReason) Add reputation of a given type towards a given entity, with a specific change reason.The final value will be clamped to the maximum value supported by the provided reputation type. If the final value is below the reputation discard threshold, gossip associated with this reputation type will be removed. Note: this will fire a VillagerReputationChangeEvent.- Parameters:
- uuid- the UUID of the entity for whom the reputation is being added
- reputationType- reputation type to be modified
- amount- amount of reputation to add
- changeReason- reputation change reason
 
- 
removeReputationvoid removeReputation(@NotNull UUID uuid, @NotNull Villager.ReputationType reputationType, int amount) Remove reputation of a given type towards a given entity.The final value will be clamped to the maximum value supported by the provided reputation type. If the final value is below the reputation discard threshold, gossip associated with this reputation type will be removed. Note: this will fire a VillagerReputationChangeEvent.- Parameters:
- uuid- the UUID of the entity for whom the reputation is being removed
- reputationType- reputation type to be modified
- amount- amount of reputation to remove
 
- 
removeReputationvoid removeReputation(@NotNull UUID uuid, @NotNull Villager.ReputationType reputationType, int amount, @NotNull Villager.ReputationEvent changeReason) Remove reputation of a given type towards a given entity, with a specific change reason.The final value will be clamped to the maximum value supported by the provided reputation type. If the final value is below the reputation discard threshold, gossip associated with this reputation type will be removed. Note: this will fire a VillagerReputationChangeEvent.- Parameters:
- uuid- the UUID of the entity for whom the reputation is being removed
- reputationType- reputation type to be modified
- amount- amount of reputation to remove
- changeReason- reputation change reason
 
- 
setReputationSet reputation of a given type towards a given entity.The final value will be clamped to the maximum value supported by the provided reputation type. If the final value is below the reputation discard threshold, gossip associated with this reputation type will be removed. Note: this will fire a VillagerReputationChangeEvent.- Parameters:
- uuid- the UUID of the entity for whom the reputation is being added
- reputationType- reputation type to be modified
- amount- amount of reputation to add
 
- 
setReputationvoid setReputation(@NotNull UUID uuid, @NotNull Villager.ReputationType reputationType, int amount, @NotNull Villager.ReputationEvent changeReason) Set reputation of a given type towards a given entity, with a specific change reason.The final value will be clamped to the maximum value supported by the provided reputation type. If the final value is below the reputation discard threshold, gossip associated with this reputation type will be removed. Note: this will fire a VillagerReputationChangeEvent.- Parameters:
- uuid- the UUID of the entity for whom the reputation is being added
- reputationType- reputation type to be modified
- amount- amount of reputation to add
- changeReason- reputation change reason
 
- 
setGossipDecayTimevoid setGossipDecayTime(long ticks) Sets the reputation decay time for this villager.Defaults to 24000 (1 daylight cycle). - Parameters:
- ticks- amount of ticks until the villager's reputation decays
 
- 
getGossipDecayTimelong getGossipDecayTime()Gets the reputation decay time for this villager.Defaults to 24000 (1 daylight cycle). - Returns:
- amount of ticks until the villager's reputation decays
 
 
-