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)
permissions = BukkitPermissions.create("dynmap");
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();
@ -724,7 +724,8 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
"reload",
"stats",
"resetstats",
"sendtoweb" }));
"sendtoweb",
"purgequeue" }));
@Override
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
@ -846,6 +847,8 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
} else {
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")) {
sender.sendMessage("Reloading Dynmap...");
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) {
ConfigurationNode worldConfiguration = plug_in.getWorldConfiguration(w);
if (!worldConfiguration.getBoolean("enabled", false)) {

View File

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