Class BattleEndEvent
java.lang.Object
net.minecraftforge.eventbus.api.Event
com.pixelmonmod.pixelmon.api.events.battles.BattleEvent
com.pixelmonmod.pixelmon.api.events.battles.BattleEndEvent
Common battle ending event which fires exactly once, and for all battle ending,
including abnormal endings.
This is the recommended event for all end-of-battle listening due to its comprehensive information and its guaranteed execution regardless of what means the battle ends by.
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraftforge.eventbus.api.Event
net.minecraftforge.eventbus.api.Event.HasResult, net.minecraftforge.eventbus.api.Event.Result
-
Field Summary
Modifier and TypeFieldDescriptionprotected final boolean
protected final BattleEndCause
protected final Map<BattleParticipant,
BattleResults> Fields inherited from class com.pixelmonmod.pixelmon.api.events.battles.BattleEvent
battleController
-
Constructor Summary
ConstructorDescriptionBattleEndEvent
(BattleController bc, BattleEndCause cause, boolean abnormal, Map<BattleParticipant, BattleResults> results) -
Method Summary
Modifier and TypeMethodDescriptiongetCause()
Gets the cause of the battle endList<net.minecraft.server.level.ServerPlayer>
Gets a list of players that were involved in the battlegetResult
(net.minecraft.world.entity.Entity entity) Gets the battle result for the entity given Will return an empty optional of cannot find that entity/playerGets the battle results per participantboolean
Checks if the battle end was "abnormal"Methods inherited from class com.pixelmonmod.pixelmon.api.events.battles.BattleEvent
getBattleController
Methods inherited from class net.minecraftforge.eventbus.api.Event
getListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult
-
Field Details
-
cause
-
abnormal
protected final boolean abnormal -
results
-
-
Constructor Details
-
BattleEndEvent
public BattleEndEvent(BattleController bc, BattleEndCause cause, boolean abnormal, Map<BattleParticipant, BattleResults> results)
-
-
Method Details
-
getCause
Gets the cause of the battle end- Returns:
- The battle end cause
-
isAbnormal
public boolean isAbnormal()Checks if the battle end was "abnormal"- Returns:
- True if abnormal
-
getResults
Gets the battle results per participant- Returns:
- The participant
-
getResult
Gets the battle result for the entity given Will return an empty optional of cannot find that entity/player- Parameters:
entity
- The entity to search for- Returns:
- The result
-
getPlayers
Gets a list of players that were involved in the battle- Returns:
- A list of players
-