Add better control over expression timeouts. (#451)

Add better control over expression timeouts.
* //timeout command can be used to change player's current timeout.
* Config now also has a max timeout, can be bypassed with permission
* Timeout of < 0 will let expressions run indefinitely.
* Said expressions won't run on a separate thread, slightly reducing the
  overhead from context switching. For large //gen commands, for example,
  this can actually increase speed.
This commit is contained in:
wizjany
2019-03-06 19:58:32 -05:00
committed by GitHub
parent f84f3c6f85
commit de08c8b8c7
21 changed files with 301 additions and 76 deletions

View File

@ -21,6 +21,7 @@ package com.sk89q.worldedit.function;
import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.regions.Region;
@ -32,6 +33,7 @@ public class EditContext {
private Extent destination;
@Nullable private Region region;
@Nullable private Pattern fill;
@Nullable private LocalSession session;
public Extent getDestination() {
return destination;
@ -60,4 +62,12 @@ public class EditContext {
this.fill = fill;
}
@Nullable
public LocalSession getSession() {
return session;
}
public void setSession(@Nullable LocalSession session) {
this.session = session;
}
}