Interface MapArchObject<A extends MapArchObject<A>>
-
- All Superinterfaces:
java.io.Serializable
- All Known Implementing Classes:
AbstractMapArchObject,MapArchObject,MapArchObject,MapArchObject
public interface MapArchObject<A extends MapArchObject<A>> extends java.io.SerializableInterface for MapArchObjects.Enter coordinates
Enter coordinates (getEnterX(),setEnterX(int),getEnterY(),setEnterY(int)) determines where a player enters this map from another map when using an exit.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddMapArchObjectListener(@NotNull MapArchObjectListener listener)Registers an event listener.voidaddText(@NotNull java.lang.String text)Appends 'text' to the map text.voidbeginTransaction()Starts a new transaction.@NotNull java.lang.StringcalculateTilePath(@NotNull Direction direction, @Nullable MapFile mapFile)Calculate a single tile path in a particular direction.voidcalculateTilePaths(@Nullable MapFile mapFile, @NotNull java.io.File mapsDirectory)Calculates tiled paths for the map automatically.AcreateClone()Creates a copy of this object.voidendTransaction()Ends a transaction.voidendTransaction(boolean fireEvent)Ends a transaction.intgetDarkness()Returns the light / darkness of this map.intgetDifficulty()Returns the map's difficulty.@NotNull java.awt.PointgetEnter()Returns the enter coordinates.intgetEnterX()Returns the enter x coordinate.intgetEnterY()Returns the enter y coordinate.@NotNull java.lang.StringgetMapName()Returns the map name.@NotNull Size2DgetMapSize()Returns the map size.intgetResetTimeout()Returns the reset timeout (in seconds).intgetSwapTime()Returns the swap time (in ticks).@NotNull java.lang.StringgetText()Returns the message text.@NotNull java.lang.StringgetTilePath(@NotNull Direction direction)Returns a tile path.intgetTilePaths()Returns the number of tile paths.booleanisFixedReset()Returns whether this map uses a fixed reset.booleanisOutdoor()Returns whether the map is an "outdoor" map.booleanisPointValid(@Nullable java.awt.Point pos)Checks whether the given coordinate is within map bounds.booleanisTilePathAuto(@NotNull Direction direction, @Nullable MapFile mapFile)Determines whether a tiled map in the specified direction is automatic tiled path or not.voidremoveMapArchObjectListener(@NotNull MapArchObjectListener listener)Unregisters an event listener.voidsetDarkness(int darkness)Sets the light / darkness of this map.voidsetDifficulty(int difficulty)Sets the map's difficulty.voidsetEnterX(int enterX)Sets the enter x coordinate.voidsetEnterY(int enterY)Sets the enter y coordinate.voidsetFixedReset(boolean fixedReset)Sets whether this map uses a fixed reset.voidsetMapName(@NotNull java.lang.String name)Sets the map name.voidsetMapSize(@NotNull Size2D mapSize)Sets the map size.voidsetOutdoor(boolean outdoor)Sets whether the map is an "outdoor" map.voidsetResetTimeout(int resetTimeout)Sets the reset timeout (in seconds).voidsetState(A mapArchObject)Resets the state of this object to the state of the given map arch object.voidsetSwapTime(int swapTime)Sets the swap time (in ticks).voidsetText(java.lang.String text)Sets the map text.voidsetTilePath(@NotNull Direction direction, @NotNull java.lang.String tilePath)Sets a tile path.voidupdateModifiedAttribute(@NotNull java.lang.String userName)Updates the "Modified:" attribute in the message text.
-
-
-
Method Detail
-
setState
void setState(@NotNull A mapArchObject)Resets the state of this object to the state of the given map arch object.- Parameters:
mapArchObject- the map arch object to copy the state from
-
setMapSize
void setMapSize(@NotNull @NotNull Size2D mapSize)Sets the map size.- Parameters:
mapSize- the new map size- XXX:
- this does not change the size of the underlying MapModel. We eventually should change that so a map size isn't stored twice.
-
getMapSize
@NotNull @NotNull Size2D getMapSize()
Returns the map size.- Returns:
- size of the map reflected by this MapArchObject
-
getMapName
@NotNull @NotNull java.lang.String getMapName()
Returns the map name.- Returns:
- the map name
-
setMapName
void setMapName(@NotNull @NotNull java.lang.String name)Sets the map name.- Parameters:
name- the new map name
-
getEnterX
int getEnterX()
Returns the enter x coordinate.- Returns:
- the enter x coordinate
-
setEnterX
void setEnterX(int enterX)
Sets the enter x coordinate.- Parameters:
enterX- the new enter x coordinate
-
getEnterY
int getEnterY()
Returns the enter y coordinate.- Returns:
- the enter y coordinate
-
setEnterY
void setEnterY(int enterY)
Sets the enter y coordinate.- Parameters:
enterY- the new enter y coordinate
-
getEnter
@NotNull @NotNull java.awt.Point getEnter()
Returns the enter coordinates.- Returns:
- the enter coordinates
-
isOutdoor
boolean isOutdoor()
Returns whether the map is an "outdoor" map.- Returns:
- whether the map is an "outdoor" map
-
setOutdoor
void setOutdoor(boolean outdoor)
Sets whether the map is an "outdoor" map.- Parameters:
outdoor- whether the map is an "outdoor" map
-
getResetTimeout
int getResetTimeout()
Returns the reset timeout (in seconds).- Returns:
- the reset timeout (in seconds)
-
setResetTimeout
void setResetTimeout(int resetTimeout)
Sets the reset timeout (in seconds).- Parameters:
resetTimeout- the new reset timeout (in seconds)
-
getSwapTime
int getSwapTime()
Returns the swap time (in ticks).- Returns:
- the swap time (in ticks)
-
setSwapTime
void setSwapTime(int swapTime)
Sets the swap time (in ticks).- Parameters:
swapTime- the swap time (in ticks)
-
getDifficulty
int getDifficulty()
Returns the map's difficulty.- Returns:
- the map's difficulty
-
setDifficulty
void setDifficulty(int difficulty)
Sets the map's difficulty.- Parameters:
difficulty- the new difficulty for this map
-
isFixedReset
boolean isFixedReset()
Returns whether this map uses a fixed reset.- Returns:
- whether this map uses a fixed reset
-
setFixedReset
void setFixedReset(boolean fixedReset)
Sets whether this map uses a fixed reset.- Parameters:
fixedReset- whether this map should use a fixed reset
-
getDarkness
int getDarkness()
Returns the light / darkness of this map. (0 means fully bright)- Returns:
- the light / darkness of this map
-
setDarkness
void setDarkness(int darkness)
Sets the light / darkness of this map.- Parameters:
darkness- the new light / darkness of this map
-
getTilePaths
int getTilePaths()
Returns the number of tile paths.- Returns:
- the number of tile paths
-
getTilePath
@NotNull @NotNull java.lang.String getTilePath(@NotNull @NotNull Direction direction)Returns a tile path.- Parameters:
direction- the tile path direction- Returns:
- the tile path
-
setTilePath
void setTilePath(@NotNull @NotNull Direction direction, @NotNull @NotNull java.lang.String tilePath)Sets a tile path.- Parameters:
direction- the tile path directiontilePath- the new tile path
-
calculateTilePath
@NotNull @NotNull java.lang.String calculateTilePath(@NotNull @NotNull Direction direction, @Nullable @Nullable MapFile mapFile)Calculate a single tile path in a particular direction.- Parameters:
direction- the directionmapFile- map file- Returns:
- Calculated tile path, empty string on failure.
-
calculateTilePaths
void calculateTilePaths(@Nullable @Nullable MapFile mapFile, @NotNull @NotNull java.io.File mapsDirectory)Calculates tiled paths for the map automatically.- Parameters:
mapFile- map filemapsDirectory- maps directory
-
isTilePathAuto
boolean isTilePathAuto(@NotNull @NotNull Direction direction, @Nullable @Nullable MapFile mapFile)Determines whether a tiled map in the specified direction is automatic tiled path or not.- Parameters:
direction- direction of the tiled mapmapFile- map file- Returns:
- Whether the tile is automatic.
-
createClone
@NotNull A createClone()
Creates a copy of this object.- Returns:
- the newly created clone of this object
-
addMapArchObjectListener
void addMapArchObjectListener(@NotNull @NotNull MapArchObjectListener listener)Registers an event listener.- Parameters:
listener- the listener to register
-
removeMapArchObjectListener
void removeMapArchObjectListener(@NotNull @NotNull MapArchObjectListener listener)Unregisters an event listener.- Parameters:
listener- the listener to unregister
-
beginTransaction
void beginTransaction()
Starts a new transaction. Transactions may be nested. Transactions serve the purpose of firing events to the views when more changes are known to come before the view is really required to update. Each invocation of this function requires its own invocation ofendTransaction().Beginning a nested transaction is a cheap operation.
- See Also:
endTransaction(),endTransaction(boolean)
-
endTransaction
void endTransaction()
Ends a transaction. Invoking this method will reduce the transaction depth by only 1.Ending a nested operation is a cheap operation. Ending a transaction without changes also is a cheap operation.
If the last transaction is ended, the changes are committed.
Same as
endTransaction(false).- See Also:
beginTransaction(),endTransaction(boolean)
-
endTransaction
void endTransaction(boolean fireEvent)
Ends a transaction. Invoking this method will reduce the transaction depth by only 1.Ending a nested operation is a cheap operation. Ending a transaction without changes also is a cheap operation.
If the last transaction is ended, the changes are committed.
An example where setting
fireEventtotrueis useful even though the outermost transaction is not ended is when during painting the UI should be updated though painting is not finished.- Parameters:
fireEvent-trueif an event should be fired even in case this doesn't end the outermost transaction.- See Also:
beginTransaction(),endTransaction()- Note:
- If the outermost transaction is ended,
fireEventis ignored and the event is always fired., An event is never fired when there were no changes, no matter whether the outermost transaction is ended orfireEventis set totrue., If the event is fired, the internal change list is not cleared.
-
addText
void addText(@NotNull @NotNull java.lang.String text)Appends 'text' to the map text.- Parameters:
text- the string to add
-
setText
void setText(java.lang.String text)
Sets the map text.- Parameters:
text- the new map text
-
getText
@NotNull @NotNull java.lang.String getText()
Returns the message text.- Returns:
- the message text
-
updateModifiedAttribute
void updateModifiedAttribute(@NotNull @NotNull java.lang.String userName)Updates the "Modified:" attribute in the message text.- Parameters:
userName- the user name to include
-
isPointValid
boolean isPointValid(@Nullable @Nullable java.awt.Point pos)Checks whether the given coordinate is within map bounds.- Parameters:
pos- the coordinates to check- Returns:
trueif the given coordinates are on the map, otherwisefalse(also returnsfalseifpos == null)
-
-