mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-04 03:56:41 +00:00
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:
@ -85,6 +85,7 @@ public class LocalSession {
|
||||
private transient BlockTool pickaxeMode = new SinglePickaxe();
|
||||
private transient Map<ItemType, Tool> tools = new HashMap<>();
|
||||
private transient int maxBlocksChanged = -1;
|
||||
private transient int maxTimeoutTime;
|
||||
private transient boolean useInventory;
|
||||
private transient Snapshot snapshot;
|
||||
private transient boolean hasCUISupport = false;
|
||||
@ -415,6 +416,24 @@ public class LocalSession {
|
||||
this.maxBlocksChanged = maxBlocksChanged;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the maximum time allowed for certain executions to run before cancelling them, such as expressions.
|
||||
*
|
||||
* @return timeout time, in milliseconds
|
||||
*/
|
||||
public int getTimeout() {
|
||||
return maxTimeoutTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the maximum number of blocks that can be changed.
|
||||
*
|
||||
* @param timeout the time, in milliseconds, to limit certain executions to, or -1 to disable
|
||||
*/
|
||||
public void setTimeout(int timeout) {
|
||||
this.maxTimeoutTime = timeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the super pick axe is enabled.
|
||||
*
|
||||
|
Reference in New Issue
Block a user