Class BattleCommand

java.lang.Object
com.pixelmonmod.pixelmon.command.impl.BattleCommand

public class BattleCommand extends Object
Can start a battle between multiple players and/or entities (including NPCs) and also allows players to spectate battles.

The battle subcommand does not have its permission level set to allow any player because this command instantly starts a battle and does not provide an accept/deny prompt.

Example usages:

  • "/pokebattle battle single Tony_Sax Envyful"
  • "/pokebattle battle double Tony_Sax Envyful"
  • "/pokebattle battle double Tony_Sax Isi Envyful"
  • "/pokebattle battle double Tony_Sax Isi Envyful Rasgnarok"
  • "/pokebattle battle triple Tony_Sax Envyful"
  • "/pokebattle battle triple Tony_Sax Isi Envyful Rasgnarok"
  • "/pokebattle battle triple Tony_Sax Isi oa10712 Envyful Rasgnarok Waterdude"
  • "/pokebattle spectate Envyful"
  • "/pokebattle spectate"

Using "/pokebattle spectate" without a player parameter will make the player that executed the command stop spectating.

  • Constructor Summary

    Constructors
    Constructor
    Description
    BattleCommand(com.mojang.brigadier.CommandDispatcher<net.minecraft.commands.CommandSourceStack> dispatcher)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    getTopEarthBlock(net.minecraft.world.level.Level world, int cpX, int cpZ)
    Gets the height of the top solid block with the specified x/z coordinates.
    int
    spectateBattle(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> commandContext)
    Allows a player to spectate a battle if they are not one of the participants of the battle, not in their own separate battle, and the target player is in a battle.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BattleCommand

      public BattleCommand(com.mojang.brigadier.CommandDispatcher<net.minecraft.commands.CommandSourceStack> dispatcher)
  • Method Details

    • getTopEarthBlock

      public static int getTopEarthBlock(net.minecraft.world.level.Level world, int cpX, int cpZ)
      Gets the height of the top solid block with the specified x/z coordinates.
      Parameters:
      world - The Minecraft world.
      cpX - The x coordinate to look at.
      cpZ - The z coordinate to look at.
      Returns:
      The height of the top solid block with the specified x/z coordinates.
    • spectateBattle

      public int spectateBattle(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> commandContext) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Allows a player to spectate a battle if they are not one of the participants of the battle, not in their own separate battle, and the target player is in a battle.
      Parameters:
      commandContext - provides the parameters given to the command
      Returns:
      1 if the function executed successfully
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException