Class PortalBuilder

java.lang.Object
org.sgrewritten.stargate.api.network.PortalBuilder

public class PortalBuilder extends Object
Used to build portals
  • Constructor Details

    • PortalBuilder

      public PortalBuilder(StargateAPI stargateAPI, org.bukkit.OfflinePlayer owner, String portalName)
      Construct an instance of a PortalBuilder
      Parameters:
      stargateAPI -

      The stargate api

      owner -

      The owner of the portal

      portalName -

      The name of the portal

  • Method Details

    • addPermissionCheck

      public PortalBuilder addPermissionCheck(@NotNull @NotNull org.bukkit.entity.Player permissionTarget)
      Check for all stargate related permissions for target
      Parameters:
      permissionTarget -

      The target of the permissions

      Returns:

      This portal builder

    • setCost

      public PortalBuilder setCost(double cost, @NotNull @NotNull org.bukkit.entity.Player economyTarget)
      Set a cost for this portal
      Parameters:
      cost -

      A cost

      economyTarget -

      The payee

      Returns:

      This portal builder

    • addEventHandling

      public PortalBuilder addEventHandling(@Nullable @Nullable org.bukkit.OfflinePlayer eventTarget)
      Make the builder throw an StargateCreatePortalEvent
      Parameters:
      eventTarget -

      The target of the event

      Returns:

      This portal builder

    • addMessageReceiver

      public PortalBuilder addMessageReceiver(@Nullable @Nullable org.bukkit.entity.Entity messageTarget)
      Parameters:
      messageTarget -

      The entity that receives any messages related to the attempt of the portal creation

      Returns:

      This portal builder

    • setDestination

      public PortalBuilder setDestination(@Nullable @Nullable String destinationName)
      Parameters:
      destinationName -

      Set a fixed destination portal

      Returns:

      This portal builder

    • setAdaptiveGatePositionGeneration

      public PortalBuilder setAdaptiveGatePositionGeneration(boolean adaptiveGatePositionGeneration)
      Requires the constructor PortalBuilder(StargateAPI, OfflinePlayer, String) to matter
      Parameters:
      adaptiveGatePositionGeneration -

      Whether to generate portal positions for the gate

      Returns:

      This portal builder

    • setMetaData

      public PortalBuilder setMetaData(String metaData)
      Parameters:
      metaData -

      The metadata for the portal

      Returns:

      This portal builder

    • setDestinationServerName

      public PortalBuilder setDestinationServerName(String serverName)
      Set the name of the server this portal should point to (only relevant for bungee portals)
      Parameters:
      serverName -

      The name of the server this portal points to

      Returns:

      This portal builder

    • setNetwork

      public PortalBuilder setNetwork(@NotNull @NotNull Network network)
      Parameters:
      network -

      the network this portal points to

      Returns:

      This portal builder

    • setNetwork

      public PortalBuilder setNetwork(@NotNull @NotNull String networkName)
      Parameters:
      networkName -

      The network argument to select networks from

      Returns:

      This portal builder

    • setGate

      public PortalBuilder setGate(GateAPI gateAPI)
      Parameters:
      gateAPI -

      The gate to be used by this portal builder

      Returns:

      This portal builder

    • setGateBuilder

      public PortalBuilder setGateBuilder(@NotNull @NotNull org.bukkit.Location topLeft, @NotNull @NotNull GateFormatAPI gateFormatAPI)
      Set the way the gate should be constructed, see ExplicitGateBuilder for more information
      Parameters:
      topLeft -

      Top left location

      gateFormatAPI -

      The gate format to be used when making this gate

      Returns:

      This portal builder

    • setGateBuilder

      public PortalBuilder setGateBuilder(@NotNull @NotNull org.bukkit.Location topLeft, @NotNull @NotNull String gateFormatName)
      Set the way the gate should be constructed, see ExplicitGateBuilder for more information
      Parameters:
      topLeft -

      Top left location

      gateFormatName -

      The name of the gate format

      Returns:

      This portal builder

      Throws:
      IllegalArgumentException -

      If the gate format has not been registered

    • setGateBuilder

      public PortalBuilder setGateBuilder(@NotNull @NotNull GateBuilder gateBuilder)
    • setFlags

      public PortalBuilder setFlags(@NotNull @NotNull String flagsString)
      Set the flags of the portal
      Parameters:
      flagsString -

      A string of characters representing flags or flag arguments

      Returns:

      This portal builder

    • setFlags

      public PortalBuilder setFlags(@NotNull @NotNull Set<StargateFlag> flags)
      Set the flags of the portal
      Parameters:
      flags -

      The flags of the portal

      Returns:

      This portal builder

    • build

      Build an instance of a portal
      Returns:

      An instance of a portal

      Throws:
      TranslatableException
      GateConflictException
      NoFormatFoundException
      InvalidStructureException