mirror of
https://github.com/webbukkit/dynmap.git
synced 2025-01-01 13:37:40 +01:00
commit
7e0124e849
@ -181,7 +181,7 @@ public class DynmapPlugin extends JavaPlugin {
|
|||||||
|
|
||||||
permissions = NijikokunPermissions.create(getServer(), "dynmap");
|
permissions = NijikokunPermissions.create(getServer(), "dynmap");
|
||||||
if (permissions == null)
|
if (permissions == null)
|
||||||
permissions = new OpPermissions(new String[] { "fullrender", "reload" });
|
permissions = new OpPermissions(new String[] { "fullrender", "cancelrender", "radiusrender", "resetstats", "reload" });
|
||||||
|
|
||||||
dataDirectory = this.getDataFolder();
|
dataDirectory = this.getDataFolder();
|
||||||
/* Load block models */
|
/* Load block models */
|
||||||
@ -501,6 +501,7 @@ public class DynmapPlugin extends JavaPlugin {
|
|||||||
"hide",
|
"hide",
|
||||||
"show",
|
"show",
|
||||||
"fullrender",
|
"fullrender",
|
||||||
|
"cancelrender",
|
||||||
"radiusrender",
|
"radiusrender",
|
||||||
"reload",
|
"reload",
|
||||||
"stats",
|
"stats",
|
||||||
@ -585,6 +586,22 @@ public class DynmapPlugin extends JavaPlugin {
|
|||||||
} else {
|
} else {
|
||||||
sender.sendMessage("World name is required");
|
sender.sendMessage("World name is required");
|
||||||
}
|
}
|
||||||
|
} else if (c.equals("cancelrender") && checkPlayerPermission(sender,"cancelrender")) {
|
||||||
|
if (args.length > 1) {
|
||||||
|
for (int i = 1; i < args.length; i++) {
|
||||||
|
World w = getServer().getWorld(args[i]);
|
||||||
|
if(w != null)
|
||||||
|
mapManager.cancelRender(w,sender);
|
||||||
|
else
|
||||||
|
sender.sendMessage("World '" + args[i] + "' not defined/loaded");
|
||||||
|
}
|
||||||
|
} else if (player != null) {
|
||||||
|
Location loc = player.getLocation();
|
||||||
|
if(loc != null)
|
||||||
|
mapManager.cancelRender(loc.getWorld(), sender);
|
||||||
|
} else {
|
||||||
|
sender.sendMessage("World name is required");
|
||||||
|
}
|
||||||
} else if (c.equals("reload") && checkPlayerPermission(sender, "reload")) {
|
} else if (c.equals("reload") && checkPlayerPermission(sender, "reload")) {
|
||||||
sender.sendMessage("Reloading Dynmap...");
|
sender.sendMessage("Reloading Dynmap...");
|
||||||
reload();
|
reload();
|
||||||
|
@ -165,6 +165,7 @@ public class MapManager {
|
|||||||
/* Min and max limits for chunk coords (for radius limit) */
|
/* Min and max limits for chunk coords (for radius limit) */
|
||||||
int cxmin, cxmax, czmin, czmax;
|
int cxmin, cxmax, czmin, czmax;
|
||||||
String rendertype;
|
String rendertype;
|
||||||
|
boolean cancelled;
|
||||||
|
|
||||||
/* Full world, all maps render */
|
/* Full world, all maps render */
|
||||||
FullWorldRenderState(DynmapWorld dworld, Location l, CommandSender sender) {
|
FullWorldRenderState(DynmapWorld dworld, Location l, CommandSender sender) {
|
||||||
@ -216,6 +217,10 @@ public class MapManager {
|
|||||||
public void run() {
|
public void run() {
|
||||||
long tstart = System.currentTimeMillis();
|
long tstart = System.currentTimeMillis();
|
||||||
|
|
||||||
|
if(cancelled) {
|
||||||
|
cleanup();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if(tile0 == null) { /* Not single tile render */
|
if(tile0 == null) { /* Not single tile render */
|
||||||
/* If render queue is empty, start next map */
|
/* If render queue is empty, start next map */
|
||||||
if(renderQueue.isEmpty()) {
|
if(renderQueue.isEmpty()) {
|
||||||
@ -345,6 +350,10 @@ public class MapManager {
|
|||||||
cleanup();
|
cleanup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void cancelRender() {
|
||||||
|
cancelled = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class CheckWorldTimes implements Runnable {
|
private class CheckWorldTimes implements Runnable {
|
||||||
@ -468,6 +477,30 @@ public class MapManager {
|
|||||||
sender.sendMessage("Render of " + radius + " block radius starting on world '" + wname + "'...");
|
sender.sendMessage("Render of " + radius + " block radius starting on world '" + wname + "'...");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cancelRender(World w, CommandSender sender) {
|
||||||
|
synchronized(lock) {
|
||||||
|
if(w != null) {
|
||||||
|
FullWorldRenderState rndr;
|
||||||
|
rndr = active_renders.get(w.getName());
|
||||||
|
if(rndr != null) {
|
||||||
|
rndr.cancelRender(); /* Cancel render */
|
||||||
|
if(sender != null) {
|
||||||
|
sender.sendMessage("Cancelled render for '" + w.getName() + "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else { /* Else, cancel all */
|
||||||
|
for(String wid : active_renders.keySet()) {
|
||||||
|
FullWorldRenderState rnd = active_renders.get(wid);
|
||||||
|
rnd.cancelRender();
|
||||||
|
if(sender != null) {
|
||||||
|
sender.sendMessage("Cancelled render for '" + wid + "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void activateWorld(World w) {
|
public void activateWorld(World w) {
|
||||||
ConfigurationNode worldConfiguration = plug_in.getWorldConfiguration(w);
|
ConfigurationNode worldConfiguration = plug_in.getWorldConfiguration(w);
|
||||||
if (!worldConfiguration.getBoolean("enabled", false)) {
|
if (!worldConfiguration.getBoolean("enabled", false)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user