Class DevPlatformer

java.lang.Object
ua.mcchickenstudio.opencreative.utils.world.platforms.DevPlatformer
All Implemented Interfaces:
ExtensionContent
Direct Known Subclasses:
HorizontalPlatformer, LegacyPlatformer, VerticalPlatformer

public abstract class DevPlatformer extends Object implements ExtensionContent

DevPlatformer

This interface represents a platformer, that manipulates and controls coding platforms in developer planets. It can create platform, return a list of existing platforms, set world's border.

Platform must be plain formed.

  • Constructor Details

    • DevPlatformer

      public DevPlatformer(@NotNull @NotNull String id)
      Constructor of coding platform generator.
      Parameters:
      id - short id of dev platformer that will be used in registry.

      It must be lower-snake-cased, for example: "horizontal", "classic". If some of registered platformers has same ID as new, it will be not added.

  • Method Details

    • getID

      @NotNull public final @NotNull String getID()
      Returns id of platforms creator, that will be used to find it in registry.
      Returns:
      id of dev platformer.
    • setWorldBorder

      public abstract void setWorldBorder(@NotNull @NotNull DevPlanet devPlanet)
      Sets world border for developer planet.
      Parameters:
      devPlanet - dev planet to set border.
    • getPlatformInLocation

      @Nullable public abstract @Nullable DevPlatform getPlatformInLocation(@NotNull @NotNull DevPlanet devPlanet, @NotNull @NotNull org.bukkit.Location location)
      Returns coding platform by location.
      Parameters:
      location - location to get platform.
      Returns:
      coding platform - if location contains coding platform, otherwise - null.
    • getColumnBeginLocation

      @Nullable public abstract @Nullable org.bukkit.Location getColumnBeginLocation(@NotNull @NotNull DevPlanet devPlanet, @NotNull @NotNull org.bukkit.Location location)
      Returns begin location of coding line by location.
      Parameters:
      location - location to get platform.
      Returns:
      executor block location - if location is related to actions or its executor location itself.
    • getFarPlatformByX

      @NotNull public abstract @NotNull DevPlatform getFarPlatformByX(@NotNull @NotNull DevPlanet devPlanet)
      Returns the most far platform by X coordinate.
      Parameters:
      devPlanet - developer planet to get platform.
      Returns:
      farthest platform by X, or coding platform placed at (1,1).
    • getFarPlatformByZ

      @NotNull public abstract @NotNull DevPlatform getFarPlatformByZ(@NotNull @NotNull DevPlanet devPlanet)
      Returns the most far platform by Z coordinate.
      Parameters:
      devPlanet - developer planet to get platform.
      Returns:
      farthest platform by Z, or coding platform placed at (1,1).
    • getPlatforms

      @NotNull public abstract @NotNull List<@NotNull DevPlatform> getPlatforms(@NotNull @NotNull DevPlanet devPlanet)
      Returns list of existing coding platforms, that can be used to place coding blocks.
      Parameters:
      devPlanet - developer planet to get platforms.
      Returns:
      list of developer platforms.
    • claimPlatform

      public abstract boolean claimPlatform(@NotNull @NotNull DevPlanet devPlanet, @NotNull @NotNull DevPlatform platform)
      Claims coding platform, if it doesn't exist yet.
      Parameters:
      devPlanet - developer planet to claim platform.
      platform - coding platform to claim.
      Returns:
      true - claimed coding platform, false - already built and exists.
    • buildPlatform

      @NotNull public abstract @NotNull CompletableFuture<Void> buildPlatform(@NotNull @NotNull DevPlatform platform, org.bukkit.Material floorMaterial, org.bukkit.Material eventMaterial, org.bukkit.Material actionMaterial)
      Builds coding platform by its coordinates. Coordinates are not from Minecraft location.
      Parameters:
      platform - platform to create.
      floorMaterial - material of block, that will be used as floor.
      eventMaterial - material of block, that will be placed as cells for event blocks placement.
      actionMaterial - material of block, that will be placed as cells for action blocks placement.
      Returns:
      true - created coding platform, false - cannot build it.
    • getPlatformBeginLocation

      @NotNull public abstract @NotNull org.bukkit.Location getPlatformBeginLocation(@NotNull @NotNull DevPlatform platform)
      Returns location of top left corner of platform.
      Parameters:
      platform - dev platform to get location.
      Returns:
      begin location of platform.
    • getPlatformEndLocation

      @NotNull public abstract @NotNull org.bukkit.Location getPlatformEndLocation(@NotNull @NotNull DevPlatform platform)
      Returns location of bottom right corner of platform.
      Parameters:
      platform - dev platform to get location.
      Returns:
      end location of platform.
    • getNextAvailablePlatform

      @NotNull public abstract @NotNull DevPlatform getNextAvailablePlatform(@NotNull @NotNull DevPlanet planet)
      Returns next platform, that will be created by player.
      Returns:
      next available coding platform.
    • getCodingBlocksLimit

      public abstract int getCodingBlocksLimit(@NotNull @NotNull DevPlanet planet)
      Returns maximum amount of coding blocks in 1 column. Includes executor and all actions blocks through coding line.
      Returns:
      limit of coding blocks.
    • notDependsOnHeight

      public abstract boolean notDependsOnHeight()
      Checks if this manager creates platforms on Z coordinate instead of Y coordinate. Useful for skipping additional checks while parsing coding blocks.
      Returns:
      true - considers only Z or X coordinates, false - considers also Y.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object