mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-25 03:35:18 +01:00
Merge pull request #218 from mikeprimm/master
Report output from fullrender to command sender, not log
This commit is contained in:
commit
4fdcc0bf92
@ -363,14 +363,14 @@ public class DynmapPlugin extends JavaPlugin {
|
|||||||
for (int i = 1; i < args.length; i++) {
|
for (int i = 1; i < args.length; i++) {
|
||||||
World w = getServer().getWorld(args[i]);
|
World w = getServer().getWorld(args[i]);
|
||||||
if(w != null)
|
if(w != null)
|
||||||
mapManager.renderFullWorld(new Location(w, 0, 0, 0));
|
mapManager.renderFullWorld(new Location(w, 0, 0, 0),sender);
|
||||||
else
|
else
|
||||||
sender.sendMessage("World '" + args[i] + "' not defined/loaded");
|
sender.sendMessage("World '" + args[i] + "' not defined/loaded");
|
||||||
}
|
}
|
||||||
} else if (player != null) {
|
} else if (player != null) {
|
||||||
Location loc = player.getLocation();
|
Location loc = player.getLocation();
|
||||||
if(loc != null)
|
if(loc != null)
|
||||||
mapManager.renderFullWorld(loc);
|
mapManager.renderFullWorld(loc, sender);
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage("World name is required");
|
sender.sendMessage("World name is required");
|
||||||
}
|
}
|
||||||
|
@ -88,14 +88,16 @@ public class MapManager {
|
|||||||
MapTile tile0 = null;
|
MapTile tile0 = null;
|
||||||
MapTile tile = null;
|
MapTile tile = null;
|
||||||
int rendercnt = 0;
|
int rendercnt = 0;
|
||||||
|
CommandSender sender;
|
||||||
|
|
||||||
/* Full world, all maps render */
|
/* Full world, all maps render */
|
||||||
FullWorldRenderState(DynmapWorld dworld, Location l) {
|
FullWorldRenderState(DynmapWorld dworld, Location l, CommandSender sender) {
|
||||||
world = dworld;
|
world = dworld;
|
||||||
loc = l;
|
loc = l;
|
||||||
found = new HashSet<MapTile>();
|
found = new HashSet<MapTile>();
|
||||||
rendered = new HashSet<MapTile>();
|
rendered = new HashSet<MapTile>();
|
||||||
renderQueue = new LinkedList<MapTile>();
|
renderQueue = new LinkedList<MapTile>();
|
||||||
|
this.sender = sender;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Single tile render - used for incremental renders */
|
/* Single tile render - used for incremental renders */
|
||||||
@ -122,7 +124,7 @@ public class MapManager {
|
|||||||
/* If render queue is empty, start next map */
|
/* If render queue is empty, start next map */
|
||||||
if(renderQueue.isEmpty()) {
|
if(renderQueue.isEmpty()) {
|
||||||
if(map_index >= 0) { /* Finished a map? */
|
if(map_index >= 0) { /* Finished a map? */
|
||||||
Log.info("Full render of map '" + world.maps.get(map_index).getClass().getSimpleName() + "' of world '" +
|
sender.sendMessage("Full render of map '" + world.maps.get(map_index).getClass().getSimpleName() + "' of world '" +
|
||||||
world.world.getName() + "' completed - " + rendercnt + " tiles rendered.");
|
world.world.getName() + "' completed - " + rendercnt + " tiles rendered.");
|
||||||
}
|
}
|
||||||
found.clear();
|
found.clear();
|
||||||
@ -130,7 +132,7 @@ public class MapManager {
|
|||||||
rendercnt = 0;
|
rendercnt = 0;
|
||||||
map_index++; /* Next map */
|
map_index++; /* Next map */
|
||||||
if(map_index >= world.maps.size()) { /* Last one done? */
|
if(map_index >= world.maps.size()) { /* Last one done? */
|
||||||
Log.info("Full render of '" + world.world.getName() + "' finished.");
|
sender.sendMessage("Full render of '" + world.world.getName() + "' finished.");
|
||||||
cleanup();
|
cleanup();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -184,7 +186,7 @@ public class MapManager {
|
|||||||
found.remove(tile);
|
found.remove(tile);
|
||||||
rendercnt++;
|
rendercnt++;
|
||||||
if((rendercnt % 100) == 0) {
|
if((rendercnt % 100) == 0) {
|
||||||
Log.info("Full render of map '" + world.maps.get(map_index).getClass().getSimpleName() + "' on world '" +
|
sender.sendMessage("Full render of map '" + world.maps.get(map_index).getClass().getSimpleName() + "' on world '" +
|
||||||
w.getName() + "' in progress - " + rendercnt + " tiles rendered, " + renderQueue.size() + " tiles pending.");
|
w.getName() + "' in progress - " + rendercnt + " tiles rendered, " + renderQueue.size() + " tiles pending.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -248,10 +250,10 @@ public class MapManager {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void renderFullWorld(Location l) {
|
void renderFullWorld(Location l, CommandSender sender) {
|
||||||
DynmapWorld world = getWorld(l.getWorld().getName());
|
DynmapWorld world = getWorld(l.getWorld().getName());
|
||||||
if (world == null) {
|
if (world == null) {
|
||||||
Log.severe("Could not render: world '" + l.getWorld().getName() + "' not defined in configuration.");
|
sender.sendMessage("Could not render: world '" + l.getWorld().getName() + "' not defined in configuration.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String wname = l.getWorld().getName();
|
String wname = l.getWorld().getName();
|
||||||
@ -259,15 +261,15 @@ public class MapManager {
|
|||||||
synchronized(lock) {
|
synchronized(lock) {
|
||||||
rndr = active_renders.get(wname);
|
rndr = active_renders.get(wname);
|
||||||
if(rndr != null) {
|
if(rndr != null) {
|
||||||
Log.info("Full world render of world '" + wname + "' already active.");
|
sender.sendMessage("Full world render of world '" + wname + "' already active.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
rndr = new FullWorldRenderState(world,l); /* Make new activation record */
|
rndr = new FullWorldRenderState(world,l,sender); /* Make new activation record */
|
||||||
active_renders.put(wname, rndr); /* Add to active table */
|
active_renders.put(wname, rndr); /* Add to active table */
|
||||||
}
|
}
|
||||||
/* Schedule first tile to be worked */
|
/* Schedule first tile to be worked */
|
||||||
renderpool.execute(rndr);
|
renderpool.execute(rndr);
|
||||||
Log.info("Full render starting on world '" + wname + "'...");
|
sender.sendMessage("Full render starting on world '" + wname + "'...");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void activateWorld(World w) {
|
public void activateWorld(World w) {
|
||||||
|
@ -121,6 +121,7 @@ public class HttpServerConnection extends Thread {
|
|||||||
if (socket == null)
|
if (socket == null)
|
||||||
return;
|
return;
|
||||||
socket.setSoTimeout(5000);
|
socket.setSoTimeout(5000);
|
||||||
|
socket.setTcpNoDelay(true);
|
||||||
InetSocketAddress rmtaddr = (InetSocketAddress)socket.getRemoteSocketAddress(); /* Get remote address */
|
InetSocketAddress rmtaddr = (InetSocketAddress)socket.getRemoteSocketAddress(); /* Get remote address */
|
||||||
InputStream in = socket.getInputStream();
|
InputStream in = socket.getInputStream();
|
||||||
BufferedOutputStream out = new BufferedOutputStream(socket.getOutputStream(), 40960);
|
BufferedOutputStream out = new BufferedOutputStream(socket.getOutputStream(), 40960);
|
||||||
|
Loading…
Reference in New Issue
Block a user