From 3a4c5832786ec2522ca77b86d4c4047c2c63cd75 Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Tue, 16 Aug 2022 19:52:48 +1000 Subject: [PATCH] SPIGOT-7138: Can't retrieve pixel color from map By: DerFrZocker --- .../src/main/java/org/bukkit/map/MapCanvas.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/paper-api/src/main/java/org/bukkit/map/MapCanvas.java b/paper-api/src/main/java/org/bukkit/map/MapCanvas.java index e8dcf0f16a..0043771972 100644 --- a/paper-api/src/main/java/org/bukkit/map/MapCanvas.java +++ b/paper-api/src/main/java/org/bukkit/map/MapCanvas.java @@ -3,6 +3,7 @@ package org.bukkit.map; import java.awt.Color; import java.awt.Image; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * Represents a canvas for drawing to a map. Each canvas is associated with a @@ -44,20 +45,27 @@ public interface MapCanvas { * {@link #getPixelColor(int, int)} might return another * color than set. * + * If null is used as color, then the color returned by + * {@link #getBasePixelColor(int, int)} is shown on the map. + * * @param x The x coordinate, from 0 to 127. * @param y The y coordinate, from 0 to 127. * @param color The color. */ - void setPixelColor(int x, int y, @NotNull Color color); + void setPixelColor(int x, int y, @Nullable Color color); /** * Get a pixel from the canvas. * + * If no color is set at the given position for this canvas, then null is + * returned and the color returned by {@link #getBasePixelColor(int, int)} + * is shown on the map. + * * @param x The x coordinate, from 0 to 127. * @param y The y coordinate, from 0 to 127. - * @return The color. + * @return The color, or null if no color is set. */ - @NotNull + @Nullable Color getPixelColor(int x, int y); /**