Commits

DerFrZocker authored and md_5 committed f80adb8b9f2
SPIGOT-7138: Can't retrieve pixel color from map
No tags

src/main/java/org/bukkit/craftbukkit/map/CraftMapCanvas.java

Modified
31 31 return cursors;
32 32 }
33 33
34 34 @Override
35 35 public void setCursors(MapCursorCollection cursors) {
36 36 this.cursors = cursors;
37 37 }
38 38
39 39 @Override
40 40 public void setPixelColor(int x, int y, Color color) {
41 - setPixel(x, y, MapPalette.matchColor(color));
41 + setPixel(x, y, (color == null) ? -1 : MapPalette.matchColor(color));
42 42 }
43 43
44 44 @Override
45 45 public Color getPixelColor(int x, int y) {
46 - return MapPalette.getColor(getPixel(x, y));
46 + byte pixel = getPixel(x, y);
47 + if (pixel == -1) {
48 + return null;
49 + }
50 +
51 + return MapPalette.getColor(pixel);
47 52 }
48 53
49 54 @Override
50 55 public Color getBasePixelColor(int x, int y) {
51 56 return MapPalette.getColor(getBasePixel(x, y));
52 57 }
53 58
54 59 @Override
55 60 public void setPixel(int x, int y, byte color) {
56 61 if (x < 0 || y < 0 || x >= 128 || y >= 128)

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut