Package org.bukkit.event.entity
Class VillagerReputationChangeEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.entity.EntityEvent
org.bukkit.event.entity.VillagerReputationChangeEvent
- All Implemented Interfaces:
Cancellable
Called whenever an entity's reputation with a villager changes.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result
-
Field Summary
Fields inherited from class org.bukkit.event.entity.EntityEvent
entity
-
Constructor Summary
ConstructorDescriptionVillagerReputationChangeEvent
(Villager villager, UUID targetUUID, Villager.ReputationEvent reason, Villager.ReputationType reputationType, int oldValue, int newValue, int maxValue) -
Method Summary
Modifier and TypeMethodDescriptionReturns the Entity involved in this eventstatic HandlerList
int
Get maximum value for the reputation type affected by this event.int
Get new reputation value after the change.int
Get the reputation value before the change.Get the reason of this reputation change.Get the type of changed reputation.Get the Entity for whom the reputation with a villager changes.Get UUID of the entity for whom the reputation with a villager changes.boolean
Gets the cancellation state of this event.void
setCancelled
(boolean cancel) Sets the cancellation state of this event.void
setNewValue
(int newValue) Set new reputation value for this event.Methods inherited from class org.bukkit.event.entity.EntityEvent
getEntityType
Methods inherited from class org.bukkit.event.Event
getEventName, isAsynchronous
-
Constructor Details
-
VillagerReputationChangeEvent
public VillagerReputationChangeEvent(@NotNull Villager villager, @NotNull UUID targetUUID, @NotNull Villager.ReputationEvent reason, @NotNull Villager.ReputationType reputationType, int oldValue, int newValue, int maxValue)
-
-
Method Details
-
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
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
Get the reason of this reputation change.- Returns:
- the reason of this reputation change
-
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 anIllegalArgumentException
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 interfaceCancellable
- 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 interfaceCancellable
- Parameters:
cancel
- true if you wish to cancel this event
-
getEntity
Description copied from class:EntityEvent
Returns the Entity involved in this event- Overrides:
getEntity
in classEntityEvent
- Returns:
- Entity who is involved in this event
-
getHandlers
- Specified by:
getHandlers
in classEvent
-
getHandlerList
-