Class PlayerCreateMapEvent

java.lang.Object
fr.fidorial.event.player.PlayerCreateMapEvent
All Implemented Interfaces:
Cancellable, Event, PlayerEvent

public final class PlayerCreateMapEvent extends Object implements PlayerEvent, Cancellable
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 Details

    • PlayerCreateMapEvent

      public PlayerCreateMapEvent(Player player, World world, int centerX, int centerZ, MapScale scale)
      Creates an event.
      Parameters:
      player - the player
      world - the world the map will show
      centerX - the X coordinate of the center
      centerZ - the Z coordinate of the center
      scale - the scale
      Since:
      0.1.0
  • Method Details

    • player

      public Player player()
      Description copied from interface: PlayerEvent
      Returns the player involved in this event.
      Specified by:
      player in interface PlayerEvent
      Returns:
      the player involved in this event
    • world

      public World 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 center
      z - the Z coordinate of the center
      Since:
      0.1.0
    • scale

      public MapScale 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

      public void scale(MapScale scale)
      Changes the scale. The center is kept: realign it with MapManager.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: Cancellable
      Returns true if the action this event describes will not happen.
      Specified by:
      isCancelled in interface Cancellable
      Returns:
      true if the action this event describes will not happen
    • setCancelled

      public void setCancelled(boolean cancelled)
      Description copied from interface: Cancellable
      Prevents or re-allows the action this event describes.
      Specified by:
      setCancelled in interface Cancellable
      Parameters:
      cancelled - true to prevent it