Package top.focess.qq.api.util
Class IOHandler
- java.lang.Object
-
- top.focess.qq.api.util.IOHandler
-
public abstract class IOHandler extends Object
This class is used to handle input and output when executing Command.
-
-
Constructor Summary
Constructors Constructor Description IOHandler()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static IOHandlergetConsoleIoHandler()booleanhasInput()Indicate there needs the MiraiCode of this input if it is a Mirai Message, or the string value of this input.abstract booleanhasInput(boolean flag)Indicate there needs an input String.Stringinput()Used to get input Stringvoidinput(String input)Used to input Stringabstract voidoutput(String output)Used to output StringvoidoutputLang(String key, Object... objects)Used to output formatted language keystatic voidsetConsoleIoHandler(IOHandler consoleIoHandler)
-
-
-
Field Detail
-
value
@Nullable protected volatile String value
-
flag
protected volatile boolean flag
-
-
Method Detail
-
getConsoleIoHandler
public static IOHandler getConsoleIoHandler()
-
setConsoleIoHandler
public static void setConsoleIoHandler(IOHandler consoleIoHandler)
-
output
public abstract void output(String output)
Used to output String- Parameters:
output- output String
-
outputLang
public void outputLang(String key, Object... objects)
Used to output formatted language key- Parameters:
key- the language keyobjects- the objects need to replace
-
input
public String input() throws InputTimeoutException
Used to get input String- Returns:
- the input String
- Throws:
InputTimeoutException- if the command has waited for more than 10 minutes to get executor input string
-
input
public void input(@Nullable String input)Used to input String- Parameters:
input- the inputted String
-
hasInput
public boolean hasInput()
Indicate there needs the MiraiCode of this input if it is a Mirai Message, or the string value of this input.- Returns:
- true if there is an input String, false otherwise
- See Also:
hasInput(boolean)
-
hasInput
public abstract boolean hasInput(boolean flag)
Indicate there needs an input String.- Parameters:
flag- true if you need the MiraiCode of this input when it is a Mirai Message, false if you need the string value of this input- Returns:
- true if there is an input String, false otherwise
-
-