Class VillagerReputationChangeEvent

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.entity.EntityEvent
org.bukkit.event.entity.VillagerReputationChangeEvent
All Implemented Interfaces:
Cancellable

public class VillagerReputationChangeEvent extends EntityEvent implements Cancellable
Called whenever an entity's reputation with a villager changes.
  • Constructor Details

  • Method Details

    • getTargetUUID

      @NotNull public UUID getTargetUUID()
      Get UUID of the entity for whom the reputation with a villager changes.
      Returns:
      UUID of the entity for whom the reputation with a villager changes
    • getTarget

      @Nullable public Entity getTarget()
      Get the Entity for whom the reputation with a villager changes.
      Returns:
      the Entity for whom the reputation with a villager changes, or null if it isn't found
    • getReason

      @NotNull public Villager.ReputationEvent getReason()
      Get the reason of this reputation change.
      Returns:
      the reason of this reputation change
    • getReputationType

      @NotNull public Villager.ReputationType getReputationType()
      Get the type of changed reputation.
      Returns:
      the type of changed reputation
    • getOldValue

      public int getOldValue()
      Get the reputation value before the change.
      Returns:
      the reputation value before the change
    • getNewValue

      public int getNewValue()
      Get new reputation value after the change.
      Returns:
      the reputation value after the change
    • setNewValue

      public void setNewValue(int newValue)
      Set new reputation value for this event.

      If the final value is below the reputation discard threshold, gossip associated with this reputation type will be removed.

      The provided value must be between 0 and getMaxValue(), otherwise an IllegalArgumentException will be thrown. Each reputation type may have a different maximum value.

      Parameters:
      newValue - the reputation value after the change
      See Also:
    • getMaxValue

      public int getMaxValue()
      Get maximum value for the reputation type affected by this event.
      Returns:
      the maximum value for the reputation type affected by this event
      See Also:
    • isCancelled

      public boolean isCancelled()
      Description copied from interface: Cancellable
      Gets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins
      Specified by:
      isCancelled in interface Cancellable
      Returns:
      true if this event is cancelled
    • setCancelled

      public void setCancelled(boolean cancel)
      Description copied from interface: Cancellable
      Sets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.
      Specified by:
      setCancelled in interface Cancellable
      Parameters:
      cancel - true if you wish to cancel this event
    • getEntity

      @NotNull public Villager getEntity()
      Description copied from class: EntityEvent
      Returns the Entity involved in this event
      Overrides:
      getEntity in class EntityEvent
      Returns:
      Entity who is involved in this event
    • getHandlers

      @NotNull public HandlerList getHandlers()
      Specified by:
      getHandlers in class Event
    • getHandlerList

      @NotNull public static HandlerList getHandlerList()