001 package org.bukkit.map; 002 003 import org.bukkit.entity.Player; 004 005 /** 006 * Represents a renderer for a map. 007 */ 008 public abstract class MapRenderer { 009 010 private boolean contextual; 011 012 /** 013 * Initialize the map renderer base to be non-contextual. See {@link 014 * #isContextual()}. 015 */ 016 public MapRenderer() { 017 this(false); 018 } 019 020 /** 021 * Initialize the map renderer base with the given contextual status. 022 * 023 * @param contextual Whether the renderer is contextual. See {@link 024 * #isContextual()}. 025 */ 026 public MapRenderer(boolean contextual) { 027 this.contextual = contextual; 028 } 029 030 /** 031 * Get whether the renderer is contextual, i.e. has different canvases for 032 * different players. 033 * 034 * @return True if contextual, false otherwise. 035 */ 036 final public boolean isContextual() { 037 return contextual; 038 } 039 040 /** 041 * Initialize this MapRenderer for the given map. 042 * 043 * @param map The MapView being initialized. 044 */ 045 public void initialize(MapView map) {} 046 047 /** 048 * Render to the given map. 049 * 050 * @param map The MapView being rendered to. 051 * @param canvas The canvas to use for rendering. 052 * @param player The player who triggered the rendering. 053 */ 054 abstract public void render(MapView map, MapCanvas canvas, Player player); 055 056 }