Package com.pixelmonmod.pixelmon.battles
Class BattleQuery
java.lang.Object
com.pixelmonmod.pixelmon.battles.BattleQuery
Controls the pre-battle challenge options between two players.
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionThe type of battle to initiate.int
The index of the query. -
Constructor Summary
ConstructorDescriptionBattleQuery
(net.minecraft.server.level.ServerPlayer player1, Pokemon pokemon1, net.minecraft.server.level.ServerPlayer player2, Pokemon pokemon2) Initializes a battle query with Pokémon instead of PixelmonEntitiesBattleQuery
(net.minecraft.server.level.ServerPlayer player1, PixelmonEntity pokemon1, net.minecraft.server.level.ServerPlayer player2, PixelmonEntity pokemon2) Initializes a battle query. -
Method Summary
Modifier and TypeMethodDescriptionvoid
acceptQuery
(net.minecraft.server.level.ServerPlayer player, EnumBattleQueryResponse response) Handles event where a player accepts the challenge.static BattleQuery.Builder
builder()
void
changeRules
(net.minecraft.server.level.ServerPlayer player) Requests that the battle rules be changed.void
declineQuery
(net.minecraft.server.level.ServerPlayer player) Closes the GUI if a player declines the battle.static BattleQuery
getQuery
(int index) Finds a specific battle query instance.static BattleQuery
getQuery
(net.minecraft.server.level.ServerPlayer player) Finds the battle query involving a certain player.void
proposeRules
(net.minecraft.server.level.ServerPlayer player, BattleRules rules) Proposes a set of rules to use for the battle.
-
Field Details
-
queryIndex
public int queryIndexThe index of the query. -
battleRules
The type of battle to initiate.
-
-
Constructor Details
-
BattleQuery
public BattleQuery(net.minecraft.server.level.ServerPlayer player1, PixelmonEntity pokemon1, net.minecraft.server.level.ServerPlayer player2, PixelmonEntity pokemon2) Initializes a battle query.- Parameters:
player1
- The first player in the query.pokemon1
- The first player's lead Pokémon.player2
- The second player in the query.pokemon2
- The second player's lead Pokémon.
-
BattleQuery
public BattleQuery(net.minecraft.server.level.ServerPlayer player1, Pokemon pokemon1, net.minecraft.server.level.ServerPlayer player2, Pokemon pokemon2) Initializes a battle query with Pokémon instead of PixelmonEntities- Parameters:
player1
- The first player in the query.pokemon1
- The first player's lead Pokémon.player2
- The second player in the query.pokemon2
- The second player's lead Pokémon.
-
-
Method Details
-
acceptQuery
public void acceptQuery(net.minecraft.server.level.ServerPlayer player, EnumBattleQueryResponse response) Handles event where a player accepts the challenge.- Parameters:
player
- The player who accepted the challenge.response
- The player's response to the challenge.
-
declineQuery
public void declineQuery(net.minecraft.server.level.ServerPlayer player) Closes the GUI if a player declines the battle.- Parameters:
player
- The player who declined the battle.
-
proposeRules
Proposes a set of rules to use for the battle.- Parameters:
player
- The player proposing the rules.rules
- The rules being proposed.
-
changeRules
public void changeRules(net.minecraft.server.level.ServerPlayer player) Requests that the battle rules be changed.- Parameters:
player
- The player requesting to change the rules.
-
getQuery
Finds a specific battle query instance.- Parameters:
index
- The index of the battle query.- Returns:
- The battle query with the index, or null if no battle query has the index.
-
getQuery
Finds the battle query involving a certain player.- Parameters:
player
- The player to find a battle query for.- Returns:
- The query involving the player, or null if the player is not in a query.
-
builder
-