Package net.openosrs.api.operation
Class OperationOwner
- java.lang.Object
-
- net.openosrs.api.operation.OperationOwner
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public final class OperationOwner extends java.lang.Object implements java.lang.AutoCloseableOne plugin run or explicitly managed script lifetime. Closing it forbids new actions.
-
-
Constructor Summary
Constructors Constructor Description OperationOwner()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()static OperationOwnercurrent()static OperationOwnercurrentOrNew()longgetId()booleanisActive()java.lang.RunnableonCancel(java.lang.Runnable cancellation)Registers cleanup only; listeners must not send game actions.<T> TwhileActive(java.util.function.Supplier<T> step, T cancelled)Linearizes a complete client-thread step against owner shutdown.
-
-
-
Method Detail
-
current
public static OperationOwner current()
-
currentOrNew
public static OperationOwner currentOrNew()
-
getId
public long getId()
-
isActive
public boolean isActive()
-
onCancel
public java.lang.Runnable onCancel(java.lang.Runnable cancellation)
Registers cleanup only; listeners must not send game actions. Returns listener removal.
-
whileActive
public <T> T whileActive(java.util.function.Supplier<T> step, T cancelled)Linearizes a complete client-thread step against owner shutdown.
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable
-
-