Class CommandExecutionManager.CapturedFeedback
- All Implemented Interfaces:
Consumer<net.kyori.adventure.text.Component>
- Enclosing class:
CommandExecutionManager
Until take() every printed line is kept for the command.result. From then on
a line is written to the console through console instead, so output a command prints
after its dispatch returned (an asynchronous body, a scheduled reply) is not lost: it lands in
the result or on the console, exactly once, whichever thread prints it. The lock makes the
hand-over atomic; the console is written outside it.
Bounded lifetime. Taking the result releases the captured lines, so a sender that a
command or another plugin keeps holds only this small object. Late lines are forwarded for
windowNanos after the result was taken; after that they are dropped, and one WARNING
names the command (never its arguments, which can carry a secret) so the operator knows why.
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe lines kept for the result, ornullonce taken.private final LongSupplierprivate final Stringprivate booleanWhether the dropped-output warning was logged.private final Objectprivate longTheclockreading when the result was taken.private final long -
Constructor Summary
ConstructorsConstructorDescriptionCapturedFeedback(String commandName, long windowNanos, LongSupplier clock, Consumer<String> console) -
Method Summary
-
Field Details
-
Constructor Details
-
CapturedFeedback
CapturedFeedback(String commandName, long windowNanos, LongSupplier clock, Consumer<String> console)
-
-
Method Details
-
accept
public void accept(net.kyori.adventure.text.Component component) -
take
Takes the lines printed so far for the result and switches later lines to the console.- Returns:
- the captured lines; empty when they were already taken
-