|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.quartercode.quarterbukkit.api.thread.ThreadUtil
public class ThreadUtil
This class is for handle the Bukkit-Thread-Errors. It will manage the called method with their actions.
Method Summary | |
---|---|
static boolean |
check(WrongThreadAction wrongThreadAction)
Checks if the current Thread is valid for Bukkit-API-functions and executes the WrongThreadAction if not. |
static boolean |
check(WrongThreadAction wrongThreadAction,
java.lang.reflect.Method method,
java.lang.Object object,
java.lang.Object... parameters)
Checks if the current Thread is valid for Bukkit-API-functions and executes the WrongThreadAction if not. |
static java.lang.Thread |
getBukkitThrad()
Returns the initalized Bukkit-Main- Thread . |
static java.lang.reflect.Method |
getMethod(java.lang.Class<?> c,
java.lang.String name,
java.lang.Class<?>... parameterTypes)
Returns a refelction- Method and throws human exceptions (API Helper). |
static void |
initalizeThread(org.bukkit.plugin.Plugin plugin)
Initalizes the Thread management. |
static boolean |
isInBukkitThread()
Checks if the current Thread is the Bukkit-Main-Thread . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void initalizeThread(org.bukkit.plugin.Plugin plugin)
Thread
management.
This can only be called one time.
plugin
- The QuarterBukkit plugin.public static java.lang.Thread getBukkitThrad()
Thread
.
Thread
.public static boolean isInBukkitThread()
Thread
is the Bukkit-Main-Thread
.
Thread
is valid for Bukkit-API-functions.public static boolean check(WrongThreadAction wrongThreadAction)
Thread
is valid for Bukkit-API-functions and executes the WrongThreadAction
if not.
You cannot use the WrongThreadAction.WAIT
in this checking method.
wrongThreadAction
- The action which executes when this is the wrong Thread
.
public static boolean check(WrongThreadAction wrongThreadAction, java.lang.reflect.Method method, java.lang.Object object, java.lang.Object... parameters)
Thread
is valid for Bukkit-API-functions and executes the WrongThreadAction
if not.
To use the WrongThreadAction.WAIT
in this checking method, you have to set the Method
, Object
(null for static access) and invoke parameters as an Object
-array.
wrongThreadAction
- The action which executes when this is the wrong thread.
public static java.lang.reflect.Method getMethod(java.lang.Class<?> c, java.lang.String name, java.lang.Class<?>... parameterTypes)
Method
and throws human exceptions (API Helper).
c
- The Class
with the method.name
- The name of the method.parameterTypes
- The parameter Class
es of the method in the right order.
Method
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |