Interface MapManager<G extends GameObject<G,​A,​R>,​A extends MapArchObject<A>,​R extends Archetype<G,​A,​R>>

    • Method Detail

      • openMapFile

        @NotNull
        @NotNull MapControl<G,​A,​R> openMapFile​(@NotNull
                                                           @NotNull MapFile mapFile,
                                                           boolean interactive)
                                                    throws java.io.IOException
        Loads a map file. The returned instance must be freed with release(MapControl) when not needed anymore.
        Parameters:
        mapFile - the map file to load
        interactive - if set, may ask to delete undefined archetypes; if unset, keep undefined archetypes
        Returns:
        the map control
        Throws:
        java.io.IOException - if an I/O error occurs
      • openMapFile

        @NotNull
        @NotNull MapControl<G,​A,​R> openMapFile​(@NotNull
                                                           @NotNull java.io.File file,
                                                           boolean interactive)
                                                    throws java.io.IOException
        Loads a map file. The returned instance must be freed with release(MapControl) when not needed anymore.
        Parameters:
        file - the map file to load
        interactive - if set, may ask to delete undefined archetypes; if unset, keep undefined archetypes
        Returns:
        the map control
        Throws:
        java.io.IOException - if an I/O error occurs
      • closeMap

        void closeMap​(@NotNull
                      @NotNull MapControl<G,​A,​R> mapControl)
        Closes the given map, ignoring modified status.
        Parameters:
        mapControl - the map to close
      • newMap

        @NotNull
        @NotNull MapControl<G,​A,​R> newMap​(@Nullable
                                                      @Nullable java.util.List<G> objects,
                                                      @NotNull
                                                      A mapArchObject,
                                                      @Nullable
                                                      @Nullable MapFile mapFile,
                                                      boolean interactive)
        Creates a new map control without view. The returned instance must be freed with release(MapControl) when not needed anymore.
        Parameters:
        objects - the game objects to insert; may be null
        mapArchObject - the map arch object for the new map
        mapFile - the map file, or null if the map was not yet saved
        interactive - if set, the new map becomes the current map
        Returns:
        the newly created map control
      • setCurrentMap

        void setCurrentMap​(@Nullable
                           @Nullable MapControl<G,​A,​R> mapControl)
        Sets the given map as the current one.
        Parameters:
        mapControl - the MapControl of the new current map
      • getOpenedMaps

        @NotNull
        @NotNull java.util.List<MapControl<G,​A,​R>> getOpenedMaps()
        Returns all opened maps.
        Returns:
        the opened maps
      • getCurrentMap

        @Nullable
        @Nullable MapControl<G,​A,​R> getCurrentMap()
        Returns the current map.
        Returns:
        the current map
      • getOpenMap

        @Nullable
        @Nullable MapControl<G,​A,​R> getOpenMap()
        Returns one open map.
        Returns:
        the map or null if no open maps exist
      • addMapManagerListener

        void addMapManagerListener​(@NotNull
                                   @NotNull MapManagerListener<G,​A,​R> listener)
        Adds a MapManagerListener to be notified.
        Parameters:
        listener - the listener to add
      • removeMapManagerListener

        void removeMapManagerListener​(@NotNull
                                      @NotNull MapManagerListener<G,​A,​R> listener)
        Removes a MapManagerListener to be notified.
        Parameters:
        listener - the listener to remove
      • revert

        void revert​(@NotNull
                    @NotNull MapControl<G,​A,​R> mapControl)
             throws java.io.IOException
        Reverts one map.
        Parameters:
        mapControl - the map to revert
        Throws:
        java.io.IOException - if an I/O error occurs
      • getLocalMapDir

        java.io.File getLocalMapDir()
        Returns a guess for a script directory to use.
        Returns:
        the directory
      • release

        void release​(@NotNull
                     @NotNull MapControl<G,​A,​R> mapControl)
        Releases a MapControl instance.
        Parameters:
        mapControl - the map control instance