Add /dynmap purgequeue to purge tile update queue

This commit is contained in:
Mike Primm 2011-10-30 23:04:36 +08:00 committed by mikeprimm
parent 079f9dc8cd
commit c953097403
3 changed files with 22 additions and 2 deletions

View file

@ -217,7 +217,7 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
if (permissions == null) if (permissions == null)
permissions = BukkitPermissions.create("dynmap"); permissions = BukkitPermissions.create("dynmap");
if (permissions == null) if (permissions == null)
permissions = new OpPermissions(new String[] { "fullrender", "cancelrender", "radiusrender", "resetstats", "reload" }); permissions = new OpPermissions(new String[] { "fullrender", "cancelrender", "radiusrender", "resetstats", "reload", "purgequeue" });
dataDirectory = this.getDataFolder(); dataDirectory = this.getDataFolder();
@ -724,7 +724,8 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
"reload", "reload",
"stats", "stats",
"resetstats", "resetstats",
"sendtoweb" })); "sendtoweb",
"purgequeue" }));
@Override @Override
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
@ -846,6 +847,8 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
} else { } else {
sender.sendMessage("World name is required"); sender.sendMessage("World name is required");
} }
} else if (c.equals("purgequeue") && checkPlayerPermission(sender, "purgequeue")) {
mapManager.purgeQueue(sender);
} 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();

View file

@ -724,6 +724,18 @@ public class MapManager {
} }
} }
void purgeQueue(CommandSender sender) {
if(tileQueue != null) {
int cnt = 0;
List<MapTile> popped = tileQueue.popAll();
if(popped != null) {
cnt = popped.size();
popped.clear();
}
sender.sendMessage("Purged " + cnt + " tiles from queue");
}
}
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)) {

View file

@ -24,6 +24,7 @@ commands:
/<command> resetstats - Reset render statistics. /<command> resetstats - Reset render statistics.
/<command> resetstats world - Reset render statistics for maps on world 'world'. /<command> resetstats world - Reset render statistics for maps on world 'world'.
/<command> sendtoweb msg - Send message to web users /<command> sendtoweb msg - Send message to web users
/<command> purgequeue - Set tile update queue to empty
dmarker: dmarker:
description: Manipulate map markers description: Manipulate map markers
@ -77,6 +78,7 @@ permissions:
dynmap.stats: true dynmap.stats: true
dynmap.resetstats: true dynmap.resetstats: true
dynmap.sendtoweb: true dynmap.sendtoweb: true
dynmap.purgequeue: true
dynmap.marker.add: true dynmap.marker.add: true
dynmap.marker.update: true dynmap.marker.update: true
dynmap.marker.movehere: true dynmap.marker.movehere: true
@ -131,6 +133,9 @@ permissions:
dynmap.sendtoweb: dynmap.sendtoweb:
description: Allows /dynmap sendtoweb description: Allows /dynmap sendtoweb
default: op default: op
dynmap.purgequeue:
description: Allows /dynmap purgequeue
default: op
dynmap.marker.add: dynmap.marker.add:
description: Allows /dmarker add description: Allows /dmarker add
default: op default: op