mirror of
https://github.com/TotalFreedomMC/TotalFreedomMod.git
synced 2024-05-24 21:41:21 +00:00
33 lines
1 KiB
Java
33 lines
1 KiB
Java
package me.totalfreedom.totalfreedommod.httpd.module;
|
|
|
|
import java.io.File;
|
|
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
|
import me.totalfreedom.totalfreedommod.banning.VPNBanList;
|
|
import me.totalfreedom.totalfreedommod.httpd.HTTPDaemon;
|
|
import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD;
|
|
|
|
public class Module_vpnbans extends HTTPDModule
|
|
{
|
|
|
|
public Module_vpnbans(TotalFreedomMod plugin, NanoHTTPD.HTTPSession session)
|
|
{
|
|
super(plugin, session);
|
|
}
|
|
|
|
@Override
|
|
public NanoHTTPD.Response getResponse()
|
|
{
|
|
File vpnbanFile = new File(plugin.getDataFolder(), VPNBanList.CONFIG_FILENAME);
|
|
|
|
if (vpnbanFile.exists())
|
|
{
|
|
return HTTPDaemon.serveFileBasic(new File(plugin.getDataFolder(), VPNBanList.CONFIG_FILENAME));
|
|
}
|
|
else
|
|
{
|
|
return new NanoHTTPD.Response(NanoHTTPD.Response.Status.NOT_FOUND, NanoHTTPD.MIME_PLAINTEXT,
|
|
"Error 404: Not Found - The requested resource was not found on this server.");
|
|
}
|
|
}
|
|
}
|