mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-06-29 19:46:42 +00:00
Merge branch 'development' into paldiu-local
This commit is contained in:
@ -16,6 +16,35 @@ public abstract class ModuleExecutable
|
||||
this.async = async;
|
||||
}
|
||||
|
||||
public NanoHTTPD.Response execute(final NanoHTTPD.HTTPSession session)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (async)
|
||||
{
|
||||
return getResponse(session);
|
||||
}
|
||||
|
||||
// Sync to server thread
|
||||
return Bukkit.getScheduler().callSyncMethod(TotalFreedomMod.getPlugin(), new Callable<NanoHTTPD.Response>()
|
||||
{
|
||||
@Override
|
||||
public NanoHTTPD.Response call() throws Exception
|
||||
{
|
||||
return getResponse(session);
|
||||
}
|
||||
}).get();
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FLog.severe(ex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public abstract NanoHTTPD.Response getResponse(NanoHTTPD.HTTPSession session);
|
||||
|
||||
public static ModuleExecutable forClass(final TotalFreedomMod plugin, Class<? extends HTTPDModule> clazz, boolean async)
|
||||
{
|
||||
final Constructor<? extends HTTPDModule> cons;
|
||||
|
Reference in New Issue
Block a user