Class PlayerCreateMapEvent
java.lang.Object
fr.fidorial.event.player.PlayerCreateMapEvent
- All Implemented Interfaces:
Cancellable, Event, PlayerEvent
Fired when a player uses an empty map, before the new map is created.
Cancelling keeps the empty map. The area of the new map can be changed; by default it is the
grid cell of the player at
MapScale.ONE_TO_ONE.
Listeners run on the region thread of the player.
- Since:
- 0.1.0
-
Constructor Summary
ConstructorsConstructorDescriptionPlayerCreateMapEvent(Player player, World world, int centerX, int centerZ, MapScale scale) Creates an event. -
Method Summary
Modifier and TypeMethodDescriptionvoidcenter(int x, int z) Moves the map.intcenterX()Returns the X coordinate of the center of the map.intcenterZ()Returns the Z coordinate of the center of the map.booleanReturnstrueif the action this event describes will not happen.player()Returns the player involved in this event.scale()Returns how many blocks a pixel of the map will cover.voidChanges the scale.voidsetCancelled(boolean cancelled) Prevents or re-allows the action this event describes.world()Returns the world the map will show.
-
Constructor Details
-
PlayerCreateMapEvent
-
-
Method Details
-
player
Description copied from interface:PlayerEventReturns the player involved in this event.- Specified by:
playerin interfacePlayerEvent- Returns:
- the player involved in this event
-
world
Returns the world the map will show.- Returns:
- the world the map will show
- Since:
- 0.1.0
-
centerX
public int centerX()Returns the X coordinate of the center of the map.- Returns:
- the X coordinate of the center of the map
- Since:
- 0.1.0
-
centerZ
public int centerZ()Returns the Z coordinate of the center of the map.- Returns:
- the Z coordinate of the center of the map
- Since:
- 0.1.0
-
center
public void center(int x, int z) Moves the map.- Parameters:
x- the X coordinate of the centerz- the Z coordinate of the center- Since:
- 0.1.0
-
scale
Returns how many blocks a pixel of the map will cover.- Returns:
- how many blocks a pixel of the map will cover
- Since:
- 0.1.0
-
scale
Changes the scale. The center is kept: realign it withMapManager.alignedCenter(int, MapScale)to keep maps of that scale tiling the world.- Parameters:
scale- the scale- Since:
- 0.1.0
-
isCancelled
public boolean isCancelled()Description copied from interface:CancellableReturnstrueif the action this event describes will not happen.- Specified by:
isCancelledin interfaceCancellable- Returns:
trueif the action this event describes will not happen
-
setCancelled
public void setCancelled(boolean cancelled) Description copied from interface:CancellablePrevents or re-allows the action this event describes.- Specified by:
setCancelledin interfaceCancellable- Parameters:
cancelled-trueto prevent it
-