接口 Villager
- 所有超级接口:
AbstractVillager
,Ageable
,Attributable
,Breedable
,CommandSender
,Creature
,Damageable
,Entity
,InventoryHolder
,LivingEntity
,Lootable
,Merchant
,Metadatable
,Mob
,Nameable
,NPC
,Permissible
,PersistentDataHolder
,ProjectileSource
,ServerOperator
-
嵌套类概要
嵌套类修饰符和类型接口说明static interface
Represents the various different Villager professions there may be.static interface
Reputation change reason.static interface
Reputation type used in gossips.static interface
Represents Villager type, usually corresponding to what biome they spawn in.从接口继承的嵌套类/接口 org.bukkit.entity.Entity
Entity.Spigot
-
方法概要
修饰符和类型方法说明void
addReputation
(@NotNull UUID uuid, @NotNull Villager.ReputationType reputationType, int amount) Add reputation of a given type towards a given entity.void
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.long
Gets the reputation decay time for this villager.Gets the current profession of this villager.int
getReputation
(@NotNull UUID uuid) Gets the reputation of an entity.int
getReputation
(@NotNull UUID uuid, @NotNull Villager.ReputationType reputationType) Gets the reputation of an entity for a given type.int
Gets the trading experience of this villager.int
Gets the level of this villager.Gets the current type of this villager.int
getWeightedReputation
(@NotNull UUID uuid, @NotNull Villager.ReputationType reputationType) Gets the weighted reputation of an entity for a given type.void
removeReputation
(@NotNull UUID uuid, @NotNull Villager.ReputationType reputationType, int amount) Remove reputation of a given type towards a given entity.void
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.void
setGossipDecayTime
(long ticks) Sets the reputation decay time for this villager.void
setProfession
(@NotNull Villager.Profession profession) Sets the new profession of this villager.void
setReputation
(@NotNull UUID uuid, @NotNull Villager.ReputationType reputationType, int amount) Set reputation of a given type towards a given entity.void
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.void
setVillagerExperience
(int experience) Sets the trading experience of this villager.void
setVillagerLevel
(int level) Sets the level of this villager.void
Sets the new type of this villager.void
Causes this villager to shake his head.boolean
Attempts to make this villager sleep at the given location.void
wakeup()
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.从接口继承的方法 org.bukkit.entity.AbstractVillager
getInventory
从接口继承的方法 org.bukkit.attribute.Attributable
getAttribute
从接口继承的方法 org.bukkit.entity.Breedable
canBreed, getAgeLock, setAgeLock, setBreed
从接口继承的方法 org.bukkit.command.CommandSender
getName, sendMessage, sendMessage, sendMessage, sendMessage
从接口继承的方法 org.bukkit.entity.Damageable
damage, damage, damage, getAbsorptionAmount, getHealth, getMaxHealth, resetMaxHealth, setAbsorptionAmount, setHealth, setMaxHealth
从接口继承的方法 org.bukkit.entity.Entity
addPassenger, 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, teleport
从接口继承的方法 org.bukkit.entity.LivingEntity
addPotionEffect, 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, getWaypointColor, getWaypointStyle, 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, setWaypointColor, setWaypointStyle, swingMainHand, swingOffHand
从接口继承的方法 org.bukkit.loot.Lootable
getLootTable, getSeed, setLootTable, setSeed
从接口继承的方法 org.bukkit.inventory.Merchant
getRecipe, getRecipeCount, getRecipes, getTrader, isTrading, setRecipe, setRecipes
从接口继承的方法 org.bukkit.metadata.Metadatable
getMetadata, hasMetadata, removeMetadata, setMetadata
从接口继承的方法 org.bukkit.Nameable
getCustomName, setCustomName
从接口继承的方法 org.bukkit.permissions.Permissible
addAttachment, addAttachment, addAttachment, addAttachment, getEffectivePermissions, hasPermission, hasPermission, isPermissionSet, isPermissionSet, recalculatePermissions, removeAttachment
从接口继承的方法 org.bukkit.persistence.PersistentDataHolder
getPersistentDataContainer
从接口继承的方法 org.bukkit.projectiles.ProjectileSource
launchProjectile, launchProjectile
从接口继承的方法 org.bukkit.permissions.ServerOperator
isOp, setOp
-
方法详细资料
-
getProfession
Gets the current profession of this villager.- 返回:
- Current profession.
-
setProfession
Sets the new profession of this villager.- 参数:
profession
- New profession.
-
getVillagerType
Gets the current type of this villager.- 返回:
- Current type.
-
setVillagerType
Sets the new type of this villager.- 参数:
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.- 返回:
- 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.- 参数:
level
- the new level- 抛出:
IllegalArgumentException
- if level not between [1, 5]
-
getVillagerExperience
int getVillagerExperience()Gets the trading experience of this villager.- 返回:
- trading experience
-
setVillagerExperience
void setVillagerExperience(int experience) Sets the trading experience of this villager.- 参数:
experience
- new experience- 抛出:
IllegalArgumentException
- if experience < 0
-
sleep
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.- 参数:
location
- the location of the bed- 返回:
- whether the sleep was successful
-
wakeup
void wakeup()Causes this villager to wake up if he's currently sleeping.- 抛出:
IllegalStateException
- if not sleeping
-
shakeHead
void shakeHead()Causes this villager to shake his head. -
zombify
Convert this Villager into a ZombieVillager as if it was killed by a Zombie. Note: this will fire a EntityTransformEvent- 返回:
- the converted entity
ZombieVillager
or null if the conversion its cancelled
-
getReputation
int getReputation(@NotNull @NotNull UUID uuid, @NotNull @NotNull Villager.ReputationType reputationType) Gets the reputation of an entity for a given type.- 参数:
uuid
- the UUID of the entity whose reputation is being checkedreputationType
- reputation type to be retrieved- 返回:
- current reputation for the given reputation type
-
getWeightedReputation
int getWeightedReputation(@NotNull @NotNull UUID uuid, @NotNull @NotNull Villager.ReputationType reputationType) Gets 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.
- 参数:
uuid
- the UUID of the entity whose reputation is being checkedreputationType
- reputation type to be retrieved- 返回:
- current reputation for the given reputation type
- 另请参阅:
-
getReputation
Gets the reputation of an entity.- 参数:
uuid
- the UUID of the entity whose reputation is being checked- 返回:
- current reputation for the given reputation type
-
addReputation
void addReputation(@NotNull @NotNull UUID uuid, @NotNull @NotNull Villager.ReputationType reputationType, int amount) Add 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
.- 参数:
uuid
- the UUID of the entity for whom the reputation is being addedreputationType
- reputation type to be modifiedamount
- amount of reputation to add
-
addReputation
void addReputation(@NotNull @NotNull UUID uuid, @NotNull @NotNull Villager.ReputationType reputationType, int amount, @NotNull @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
.- 参数:
uuid
- the UUID of the entity for whom the reputation is being addedreputationType
- reputation type to be modifiedamount
- amount of reputation to addchangeReason
- reputation change reason
-
removeReputation
void removeReputation(@NotNull @NotNull UUID uuid, @NotNull @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
.- 参数:
uuid
- the UUID of the entity for whom the reputation is being removedreputationType
- reputation type to be modifiedamount
- amount of reputation to remove
-
removeReputation
void removeReputation(@NotNull @NotNull UUID uuid, @NotNull @NotNull Villager.ReputationType reputationType, int amount, @NotNull @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
.- 参数:
uuid
- the UUID of the entity for whom the reputation is being removedreputationType
- reputation type to be modifiedamount
- amount of reputation to removechangeReason
- reputation change reason
-
setReputation
void setReputation(@NotNull @NotNull UUID uuid, @NotNull @NotNull Villager.ReputationType reputationType, int amount) Set 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
.- 参数:
uuid
- the UUID of the entity for whom the reputation is being addedreputationType
- reputation type to be modifiedamount
- amount of reputation to add
-
setReputation
void setReputation(@NotNull @NotNull UUID uuid, @NotNull @NotNull Villager.ReputationType reputationType, int amount, @NotNull @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
.- 参数:
uuid
- the UUID of the entity for whom the reputation is being addedreputationType
- reputation type to be modifiedamount
- amount of reputation to addchangeReason
- reputation change reason
-
setGossipDecayTime
void setGossipDecayTime(long ticks) Sets the reputation decay time for this villager.Defaults to 24000 (1 daylight cycle).
- 参数:
ticks
- amount of ticks until the villager's reputation decays
-
getGossipDecayTime
long getGossipDecayTime()Gets the reputation decay time for this villager.Defaults to 24000 (1 daylight cycle).
- 返回:
- amount of ticks until the villager's reputation decays
-