diff options
author | t00thpick1 <t00thpick1dirko@gmail.com> | 2013-12-03 13:27:12 -0500 |
---|---|---|
committer | Nate Mortensen <nate.richard.mortensen@gmail.com> | 2013-12-03 18:56:36 -0700 |
commit | e5353b82a7974693ebdb16e08e9d702d1b7abd87 (patch) | |
tree | 361f14621fb8bd04935361f6191a01eb2e724092 /src/main/java/org/bukkit | |
parent | 169fd469609647f0d359da5601fafe9f8dd83868 (diff) | |
download | craftbukkit-e5353b82a7974693ebdb16e08e9d702d1b7abd87.tar craftbukkit-e5353b82a7974693ebdb16e08e9d702d1b7abd87.tar.gz craftbukkit-e5353b82a7974693ebdb16e08e9d702d1b7abd87.tar.lz craftbukkit-e5353b82a7974693ebdb16e08e9d702d1b7abd87.tar.xz craftbukkit-e5353b82a7974693ebdb16e08e9d702d1b7abd87.zip |
Correctly validate map colors. Fixes BUKKIT-4984
The validation check in CraftMapView.render(CraftPlayer) filters out any
values less than 0. As of Minecraft 1.7, -128 through -113 are valid colors,
so filtering them out prevents some of the new colors from being sent.
This commit fixes the issue by adjusting the validation check to include
any values less than or equal to -113. As the minimum value for a byte is
-128, no invalid colors are included.
Diffstat (limited to 'src/main/java/org/bukkit')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java b/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java index b28d6a34..1a150d98 100644 --- a/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java +++ b/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java @@ -147,7 +147,9 @@ public final class CraftMapView implements MapView { byte[] buf = canvas.getBuffer(); for (int i = 0; i < buf.length; ++i) { - if (buf[i] >= 0) render.buffer[i] = buf[i]; + byte color = buf[i]; + // There are 143 valid color id's, 0 -> 127 and -128 -> -113 + if (color >= 0 || color <= -113) render.buffer[i] = color; } for (int i = 0; i < canvas.getCursors().size(); ++i) { |