程序包 org.bukkit.entity

# 接口 Guardian

所有超级接口:
  `Attributable`, `CommandSender`, `Creature`, `Damageable`, `Enemy`, `Entity`, `LivingEntity`, `Lootable`, `Metadatable`, `Mob`, `Monster`, `Nameable`, `Permissible`, `PersistentDataHolder`, `ProjectileSource`, `ServerOperator`

所有已知子接口:
  `ElderGuardian`

public interface Guardian extends Monster
守卫海底遗迹的守卫者们.

- ## 嵌套类概要

  ## 从接口继承的嵌套类/接口 org.bukkit.entity.Entity

  `Entity.Spigot`

- ## 方法概要

  修饰符和类型
  方法
  说明
  `int`
  `getLaserDuration()`
  Get the duration (in ticks) that a laser attack takes.
  `int`
  `getLaserTicks()`
  Get the amount of ticks that have elapsed since this guardian has initiated a laser attack.
  `boolean`
  `hasLaser()`
  Gets whether the guardian laser is active or not.
  `boolean`
  `isElder()`
  已过时。
  应检测此实例是否为`ElderGuardian` (entity instanceof ElderGuardian)
  `boolean`
  `isMoving()`
  Check whether or not this guardian is moving.
  `void`
  `setElder(boolean shouldBeElder)`
  已过时。
  必须生成新的 `ElderGuardian`
  `boolean`
  `setLaser(boolean activated)`
  Sets whether the guardian laser should show or not.
  `void`
  `setLaserTicks(int ticks)`
  Set the amount of ticks that have elapsed since this guardian has initiated a laser attack.

  ### 从接口继承的方法 org.bukkit.attribute.Attributable

  `getAttribute`

  ### 从接口继承的方法 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, 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, setSwimming, swingMainHand, swingOffHand`

  ### 从接口继承的方法 org.bukkit.loot.Lootable

  `getLootTable, getSeed, setLootTable, setSeed`

  ### 从接口继承的方法 org.bukkit.metadata.Metadatable

  `getMetadata, hasMetadata, removeMetadata, setMetadata`

  ### 从接口继承的方法 org.bukkit.entity.Mob

  `getAmbientSound, getTarget, isAware, setAware, setTarget`

  ### 从接口继承的方法 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`

- ## 方法详细资料

  - ### setLaser

    boolean setLaser(boolean activated)
    Sets whether the guardian laser should show or not. A target must be present. If no target is present the laser will not show and the method will return false.
    参数:
      `activated` - whether the laser is active
    返回:
      true if the laser was activated otherwise false
    另请参阅:
      - `Mob.getTarget()`
      - `Mob.setTarget(LivingEntity)`

  - ### hasLaser

    boolean hasLaser()
    Gets whether the guardian laser is active or not.
    返回:
      true if the laser is active otherwise false

  - ### getLaserDuration

    int getLaserDuration()
    Get the duration (in ticks) that a laser attack takes.
    返回:
      the laser duration in ticks

  - ### setLaserTicks

    void setLaserTicks(int ticks)
    Set the amount of ticks that have elapsed since this guardian has initiated a laser attack. If set to `getLaserDuration()` or greater, the guardian will inflict damage upon its target and the laser attack will complete.

    For this value to have any effect, the guardian must have an active target (see `Mob.setTarget(LivingEntity)`) and be charging a laser attack (where `hasLaser()` is true). The client may display a different animation of the guardian laser than the set ticks.

    参数:
      `ticks` - the ticks to set. Must be at least -10

  - ### getLaserTicks

    int getLaserTicks()
    Get the amount of ticks that have elapsed since this guardian has initiated a laser attack.

    This value may or may not be significant depending on whether or not the guardian has an active target (`Mob.getTarget()`) and is charging a laser attack (`hasLaser()`). This value is not reset after a successful attack nor used in the next and will be reset to the minimum value when the guardian initiates a new one.

    返回:
      the laser ticks ranging from -10 to `getLaserDuration()`

  - ### isElder

    @Deprecated boolean isElder()
    已过时。
    应检测此实例是否为`ElderGuardian` (entity instanceof ElderGuardian)
    检测此守卫者是否为远古守卫者.

    原文:Check if the Guardian is an elder Guardian

    返回:
      此守卫者是否为远古守卫者

  - ### setElder

    @Deprecated void setElder(boolean shouldBeElder)
    已过时。
    必须生成新的 `ElderGuardian`
    参数:
      `shouldBeElder` - shouldBeElder

  - ### isMoving

    boolean isMoving()
    Check whether or not this guardian is moving.

    While moving, the guardian's spikes are retracted and will not inflict thorns damage upon entities that attack it. Additionally, a moving guardian cannot attack another entity. If stationary (i.e. this method returns `false`), thorns damage is guaranteed and the guardian may initiate laser attacks.

    返回:
      true if moving, false if stationary