dB.report(scriptEntry, getName(), (id != null ? id.debug() : "") + (create != null ? create.debug() : "")
+ (reset != null ? reset.debug() : "") + (image != null ? image.debug() : "") + resize.debug()
+ (text != null ? text.debug() : "") + x.debug() + y.debug());
MapView map = null;
if (create != null) {
map = Bukkit.getServer().createMap(create.getWorld());
scriptEntry.addObject("created_map", new Element(map.getId()));
}
else if (id != null) {
map = Bukkit.getServer().getMap((short) id.asInt());
if (map == null)
throw new CommandExecutionException("No map found for ID '" + id.asInt() + "'!");
}
else {
throw new CommandExecutionException("The map command failed somehow! Report this to a developer!");
}
if (reset != null) {
for (MapRenderer renderer : map.getRenderers()) {
if (renderer instanceof DenizenMapRenderer) {
map.removeRenderer(renderer);
for (MapRenderer oldRenderer : ((DenizenMapRenderer) renderer).getOldRenderers())
map.addRenderer(oldRenderer);
map.setCenterX(reset.getBlockX());
map.setCenterZ(reset.getBlockZ());
map.setWorld(reset.getWorld());
}
}
}
else {
DenizenMapRenderer dmr = null;
List<MapRenderer> oldRendererList = map.getRenderers();
for (MapRenderer renderer : oldRendererList) {
if (!(renderer instanceof DenizenMapRenderer) || dmr != null)
map.removeRenderer(renderer);
else
dmr = (DenizenMapRenderer) renderer;
}
if (dmr == null) {
dmr = new DenizenMapRenderer(oldRendererList);
map.addRenderer(dmr);
}
if (image != null)
dmr.addImage(x.asInt(), y.asInt(), new File(DenizenAPI.getCurrentInstance().getDataFolder(),
image.asString()).getPath(), resize.asBoolean());
else if (text != null)