Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
MapCursorCollection.java
1 package org.bukkit.map;
2 
3 import java.util.ArrayList;
4 import java.util.List;
5 
6 /**
7  * Represents all the map cursors on a {@link MapCanvas}. Like MapCanvas, a
8  * MapCursorCollection is linked to a specific {@link MapRenderer}.
9  */
10 public final class MapCursorCollection {
11  private List<MapCursor> cursors = new ArrayList<MapCursor>();
12 
13  /**
14  * Get the amount of cursors in this collection.
15  *
16  * @return The size of this collection.
17  */
18  public int size() {
19  return cursors.size();
20  }
21 
22  /**
23  * Get a cursor from this collection.
24  *
25  * @param index The index of the cursor.
26  * @return The MapCursor.
27  */
28  public MapCursor getCursor(int index) {
29  return cursors.get(index);
30  }
31 
32  /**
33  * Remove a cursor from the collection.
34  *
35  * @param cursor The MapCursor to remove.
36  * @return Whether the cursor was removed successfully.
37  */
38  public boolean removeCursor(MapCursor cursor) {
39  return cursors.remove(cursor);
40  }
41 
42  /**
43  * Add a cursor to the collection.
44  *
45  * @param cursor The MapCursor to add.
46  * @return The MapCursor that was passed.
47  */
48  public MapCursor addCursor(MapCursor cursor) {
49  cursors.add(cursor);
50  return cursor;
51  }
52 
53  /**
54  * Add a cursor to the collection.
55  *
56  * @param x The x coordinate, from -128 to 127.
57  * @param y The y coordinate, from -128 to 127.
58  * @param direction The facing of the cursor, from 0 to 15.
59  * @return The newly added MapCursor.
60  */
61  public MapCursor addCursor(int x, int y, byte direction) {
62  return addCursor(x, y, direction, (byte) 0, true);
63  }
64 
65  /**
66  * Add a cursor to the collection.
67  *
68  * @param x The x coordinate, from -128 to 127.
69  * @param y The y coordinate, from -128 to 127.
70  * @param direction The facing of the cursor, from 0 to 15.
71  * @param type The type (color/style) of the map cursor.
72  * @return The newly added MapCursor.
73  * @deprecated Magic value
74  */
75  @Deprecated
76  public MapCursor addCursor(int x, int y, byte direction, byte type) {
77  return addCursor(x, y, direction, type, true);
78  }
79 
80  /**
81  * Add a cursor to the collection.
82  *
83  * @param x The x coordinate, from -128 to 127.
84  * @param y The y coordinate, from -128 to 127.
85  * @param direction The facing of the cursor, from 0 to 15.
86  * @param type The type (color/style) of the map cursor.
87  * @param visible Whether the cursor is visible.
88  * @return The newly added MapCursor.
89  * @deprecated Magic value
90  */
91  @Deprecated
92  public MapCursor addCursor(int x, int y, byte direction, byte type, boolean visible) {
93  return addCursor(new MapCursor((byte) x, (byte) y, direction, type, visible));
94  }
95 
96 }
MapCursor addCursor(MapCursor cursor)
MapCursor addCursor(int x, int y, byte direction)
MapCursor addCursor(int x, int y, byte direction, byte type)
MapCursor addCursor(int x, int y, byte direction, byte type, boolean visible)
boolean removeCursor(MapCursor cursor)