Merge branch 'development' into paldiu-local

This commit is contained in:
Paldiu
2021-01-04 13:14:53 -06:00
15 changed files with 177 additions and 64 deletions

View File

@ -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;