Class ExplicitGateBuilder

java.lang.Object
org.sgrewritten.stargate.api.gate.ExplicitGateBuilder
All Implemented Interfaces:
GateBuilder

public class ExplicitGateBuilder extends Object implements GateBuilder
Builder for gate objects based on already known parameters. To build a gate from unknown parameters, use ImplicitGateBuilder
  • Constructor Details

    • ExplicitGateBuilder

      public ExplicitGateBuilder(RegistryAPI registryAPI, org.bukkit.Location topLeft, GateFormatAPI gateFormatAPI)
      Constructor for ExplicitGateBuilder
      Parameters:
      registryAPI -

      The stargate registry for portals and networks

      topLeft -

      The to be top left position of the gate (or top right if the gate is flipped)

      gateFormatAPI -

      The format of the gate

  • Method Details

    • setCalculatePortalPositions

      public ExplicitGateBuilder setCalculatePortalPositions(boolean calculatePortalPositions)
      Parameters:
      calculatePortalPositions -

      Whether the gate should calculate its own portal positions

      Returns:

      This gate builder

    • setGenerateButtonPositions

      public ExplicitGateBuilder setGenerateButtonPositions(boolean generateButtonPositions)
      Description copied from interface: GateBuilder
      Whether to generate a button position. This might not be necessary for gates such as always on gates
      Specified by:
      setGenerateButtonPositions in interface GateBuilder
      Parameters:
      generateButtonPositions -

      Whether to generate a button position.

      Returns:

      This gate builder (convenience)

    • setFlipGate

      public ExplicitGateBuilder setFlipGate(boolean flipGate)
      Whether the gate should be flipped, this effectively makes the top left position top right (flip z axis in format space)
      Parameters:
      flipGate -

      Whether the gate should be flipped

      Returns:

      This gate builder

    • setFacing

      public ExplicitGateBuilder setFacing(org.bukkit.block.BlockFace facing)
      Set the facing of this gate, this equals the facing of the sign. You can alternatively see this as setting the gate to different rotations.
      Parameters:
      facing -

      The facing of this gate

      Returns:

      This gate builder

    • build

      public GateAPI build() throws InvalidStructureException
      Description copied from interface: GateBuilder
      Build a gate
      Specified by:
      build in interface GateBuilder
      Returns:

      A gate

      Throws:
      InvalidStructureException -

      When the gate to be built does not match the format