Implement SupplyingExtent (#613)

This commit is contained in:
Hannes Greule
2020-09-14 12:20:26 +02:00
committed by GitHub
parent 4243e8e86b
commit 0685881f64
2 changed files with 27 additions and 2 deletions

View File

@ -0,0 +1,24 @@
package com.boydti.fawe.object.extent;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.extent.PassthroughExtent;
import java.util.function.Supplier;
/**
* An extent that delegates actions to another extent that may change at any time.
*/
public class SupplyingExtent extends PassthroughExtent {
private final Supplier<Extent> extentSupplier;
public SupplyingExtent(Supplier<Extent> extentSupplier) {
super(extentSupplier.get());
this.extentSupplier = extentSupplier;
}
@Override
public Extent getExtent() {
return this.extentSupplier.get();
}
}