Package top.focess.qq.api.command
Class DataCollection
- java.lang.Object
-
- top.focess.qq.api.command.DataCollection
-
public class DataCollection extends Object
Store and parser arguments for better CommandExecutor usage.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceDataCollection.BufferGetterRepresents a getter for buffer.
-
Constructor Summary
Constructors Constructor Description DataCollection(DataConverter<?>[] dataConverters)Initialize the DataCollection with fixed size.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringget()Get String argument in order<T> Tget(Class<T> c)Get customize buffer elementbooleangetBoolean()Get boolean argument in orderCommandgetCommand()Get Command argument in orderdoublegetDouble()Get double argument in orderintgetInt()Get int argument in orderlonggetLong()Get long argument in orderPlugingetPlugin()Get Plugin argument in orderstatic voidregister(Plugin plugin, DataConverter<?> dataConverter, DataCollection.BufferGetter bufferGetter)Register the getter of the bufferstatic voidunregister(Plugin plugin)Unregister the getter of the buffers by pluginstatic booleanunregisterAll()Unregister all the getter of the buffers<T> voidwrite(Class<T> cls, T t)Write customize buffer elementvoidwriteCommand(Command command)Write a Command argumentvoidwritePlugin(Plugin p)Write a Plugin argument
-
-
-
Constructor Detail
-
DataCollection
public DataCollection(DataConverter<?>[] dataConverters)
Initialize the DataCollection with fixed size.- Parameters:
dataConverters- the data converters
-
-
Method Detail
-
register
public static void register(Plugin plugin, DataConverter<?> dataConverter, DataCollection.BufferGetter bufferGetter)
Register the getter of the buffer- Parameters:
plugin- the plugindataConverter- the buffer data converterbufferGetter- the getter of the buffer
-
unregister
public static void unregister(Plugin plugin)
Unregister the getter of the buffers by plugin- Parameters:
plugin- the plugin
-
unregisterAll
public static boolean unregisterAll()
Unregister all the getter of the buffers- Returns:
- true if there are some getter of the buffers not belonging to MainPlugin not been unregistered, false otherwise
-
get
public String get()
Get String argument in order- Returns:
- the String argument in order
-
getInt
public int getInt()
Get int argument in order- Returns:
- the int argument in order
-
getDouble
public double getDouble()
Get double argument in order- Returns:
- the double argument in order
-
getBoolean
public boolean getBoolean()
Get boolean argument in order- Returns:
- the boolean argument in order
-
getLong
public long getLong()
Get long argument in order- Returns:
- the long argument in order
-
writePlugin
public void writePlugin(Plugin p)
Write a Plugin argument- Parameters:
p- Plugin argument
-
getPlugin
public Plugin getPlugin()
Get Plugin argument in order- Returns:
- the Plugin argument in order
-
getCommand
public Command getCommand()
Get Command argument in order- Returns:
- the Command argument in order
-
writeCommand
public void writeCommand(Command command)
Write a Command argument- Parameters:
command- Command argument
-
write
public <T> void write(Class<T> cls, T t)
Write customize buffer element- Type Parameters:
T- the buffer elements' type- Parameters:
cls- the buffer elements' classt- the buffer element- Throws:
UnsupportedOperationException- if the buffer is not registered
-
get
public <T> T get(Class<T> c)
Get customize buffer element- Type Parameters:
T- the buffer elements' type- Parameters:
c- the buffer elements' class- Returns:
- T the buffer element
- Throws:
UnsupportedOperationException- if the buffer is not registered
-
-