Class BattleEndEvent

java.lang.Object
net.minecraftforge.eventbus.api.Event
com.pixelmonmod.pixelmon.api.events.battles.BattleEvent
com.pixelmonmod.pixelmon.api.events.battles.BattleEndEvent

public class BattleEndEvent extends BattleEvent
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.

  • Field Details

  • Constructor Details

  • Method Details

    • getCause

      public BattleEndCause 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

      public Map<BattleParticipant,BattleResults> getResults()
      Gets the battle results per participant
      Returns:
      The participant
    • getResult

      public Optional<BattleResults> getResult(net.minecraft.world.entity.Entity entity)
      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

      public List<net.minecraft.server.level.ServerPlayer> getPlayers()
      Gets a list of players that were involved in the battle
      Returns:
      A list of players