Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-03 01:50:07 +01:00
Implement SupplyingExtent (#613)
Dieser Commit ist enthalten in:
Ursprung
4243e8e86b
Commit
0685881f64
@ -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();
|
||||
}
|
||||
}
|
@ -19,6 +19,7 @@
|
||||
|
||||
package com.sk89q.worldedit.command.argument;
|
||||
|
||||
import com.boydti.fawe.object.extent.SupplyingExtent;
|
||||
import com.sk89q.worldedit.EmptyClipboardException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
@ -109,10 +110,10 @@ public class FactoryConverter<T> implements ArgumentConverter<T> {
|
||||
if (extent instanceof World) {
|
||||
parserContext.setWorld((World) extent);
|
||||
}
|
||||
parserContext.setExtent(new RequestExtent());
|
||||
parserContext.setExtent(new SupplyingExtent(((Locatable) actor)::getExtent));
|
||||
} else if (session.hasWorldOverride()) {
|
||||
parserContext.setWorld(session.getWorldOverride());
|
||||
parserContext.setExtent(new RequestExtent());
|
||||
parserContext.setExtent(new SupplyingExtent(session::getWorldOverride));
|
||||
}
|
||||
parserContext.setSession(session);
|
||||
parserContext.setRestricted(true);
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren