summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/bukkit/map/MapRenderer.java
blob: 08f134a91042d908c72c20178c369ce98c3cb718 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package org.bukkit.map;

import org.bukkit.entity.Player;

/**
 * Represents a renderer for a map.
 */
public abstract class MapRenderer {

    private boolean contextual;

    /**
     * Initialize the map renderer base to be non-contextual. See {@link #isContextual()}.
     */
    public MapRenderer() {
        this(false);
    }

    /**
     * Initialize the map renderer base with the given contextual status.
     *
     * @param contextual Whether the renderer is contextual. See {@link #isContextual()}.
     */
    public MapRenderer(boolean contextual) {
        this.contextual = contextual;
    }

    /**
     * Get whether the renderer is contextual, i.e. has different canvases for
     * different players.
     *
     * @return True if contextual, false otherwise.
     */
    final public boolean isContextual() {
        return contextual;
    }

    /**
     * Initialize this MapRenderer for the given map.
     *
     * @param map The MapView being initialized.
     */
    public void initialize(MapView map) {}

    /**
     * Render to the given map.
     *
     * @param map The MapView being rendered to.
     * @param canvas The canvas to use for rendering.
     * @param player The player who triggered the rendering.
     */
    abstract public void render(MapView map, MapCanvas canvas, Player player);

}