// If duration set, schedule a delayed task.
if (duration > 0) {
// If this block already had a delayed task, cancel it.
if (taskMap.containsKey(interactLocation))
try { DenizenAPI.getCurrentInstance().getServer().getScheduler().cancelTask(taskMap.get(interactLocation)); } catch (Exception e) { }
dB.log("Setting delayed task 'SWITCH' for " + interactLocation.identify());
// Store new delayed task ID, for checking against, then schedule new delayed task.
taskMap.put(interactLocation, DenizenAPI.getCurrentInstance().getServer().getScheduler().scheduleSyncDelayedTask(DenizenAPI.getCurrentInstance(),
new Runnable() {
public void run() {
// Check to see if the state of the block is what is expected. If switched during