SPIGOT-3886: Plugin exceptions in map rendering should not crash server

This commit is contained in:
md_5 2018-04-08 20:03:12 +10:00
parent fb423b8f48
commit 9060bfa9b9
2 changed files with 7 additions and 1 deletions

View File

@ -93,6 +93,7 @@ public class CraftMapCanvas implements MapCanvas {
}
catch (NumberFormatException ex) {}
}
throw new IllegalArgumentException("Text contains unterminated color string");
}
CharacterSprite sprite = font.getChar(text.charAt(i));

View File

@ -5,6 +5,7 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import net.minecraft.server.WorldMap;
@ -143,7 +144,11 @@ public final class CraftMapView implements MapView {
}
canvas.setBase(render.buffer);
renderer.render(this, canvas, player);
try {
renderer.render(this, canvas, player);
} catch (Throwable ex) {
Bukkit.getLogger().log(Level.SEVERE, "Could not render map using renderer " + renderer.getClass().getName(), ex);
}
byte[] buf = canvas.getBuffer();
for (int i = 0; i < buf.length; ++i) {