I'm tired of seeing prs that make small code reformats so im doing a commit to fix it all at once

This commit is contained in:
ZeroEpoch1969
2018-07-30 23:41:56 -07:00
parent 8bd8efc665
commit 60c627c591
46 changed files with 457 additions and 273 deletions

View File

@ -52,7 +52,8 @@ public class HTTPDaemon extends FreedomService
return;
}
port = ConfigEntry.HTTPD_PORT.getInteger();;
port = ConfigEntry.HTTPD_PORT.getInteger();
;
httpd = new HTTPD(port);
// Modules
@ -168,7 +169,7 @@ public class HTTPDaemon extends FreedomService
{
mimetype = MIME_DEFAULT_BINARY;
}
// Some browsers like firefox download the file for text/yaml mime types
if (FilenameUtils.getExtension(file.getName()).equals("yml"))
{

View File

@ -239,7 +239,8 @@ public abstract class NanoHTTPD
catch (IOException e)
{
}
} while (!myServerSocket.isClosed());
}
while (!myServerSocket.isClosed());
}
});
myThread.setDaemon(true);
@ -284,15 +285,15 @@ public abstract class NanoHTTPD
* <p/>
* (By default, this delegates to serveFile() and allows directory listing.)
*
* @param uri Percent-decoded URI without parameters, for example "/index.cgi"
* @param method "GET", "POST" etc.
* @param parms Parsed, percent decoded parameters from URI and, in case of POST, data.
* @param uri Percent-decoded URI without parameters, for example "/index.cgi"
* @param method "GET", "POST" etc.
* @param parms Parsed, percent decoded parameters from URI and, in case of POST, data.
* @param headers Header entries, percent decoded
* @return HTTP response, see class Response for details
*/
@Deprecated
public Response serve(String uri, Method method, Map<String, String> headers, Map<String, String> parms,
Map<String, String> files)
Map<String, String> files)
{
return new Response(Response.Status.NOT_FOUND, MIME_PLAINTEXT, "Not Found");
}
@ -397,6 +398,7 @@ public abstract class NanoHTTPD
// Threading Strategy.
//
// ------------------------------------------------------------------------------- //
/**
* Pluggable strategy for asynchronously executing requests.
*
@ -412,6 +414,7 @@ public abstract class NanoHTTPD
// Temp file handling strategy.
//
// ------------------------------------------------------------------------------- //
/**
* Pluggable strategy for creating and cleaning up temporary files.
*
@ -462,6 +465,7 @@ public abstract class NanoHTTPD
}
// ------------------------------------------------------------------------------- //
/**
* Temp file manager.
* <p/>
@ -823,9 +827,9 @@ public abstract class NanoHTTPD
{
OK(200, "OK"), CREATED(201, "Created"), ACCEPTED(202, "Accepted"), NO_CONTENT(204, "No Content"), PARTIAL_CONTENT(206, "Partial Content"), REDIRECT(301,
"Moved Permanently"), NOT_MODIFIED(304, "Not Modified"), BAD_REQUEST(400, "Bad Request"), UNAUTHORIZED(401,
"Unauthorized"), FORBIDDEN(403, "Forbidden"), NOT_FOUND(404, "Not Found"), RANGE_NOT_SATISFIABLE(416,
"Requested Range Not Satisfiable"), INTERNAL_ERROR(500, "Internal Server Error");
"Moved Permanently"), NOT_MODIFIED(304, "Not Modified"), BAD_REQUEST(400, "Bad Request"), UNAUTHORIZED(401,
"Unauthorized"), FORBIDDEN(403, "Forbidden"), NOT_FOUND(404, "Not Found"), RANGE_NOT_SATISFIABLE(416,
"Requested Range Not Satisfiable"), INTERNAL_ERROR(500, "Internal Server Error");
private final int requestStatus;
private final String description;
@ -1181,7 +1185,7 @@ public abstract class NanoHTTPD
* Decodes the Multipart Body data and put it into Key/Value pairs.
*/
private void decodeMultipartData(String boundary, ByteBuffer fbuf, BufferedReader in, Map<String, String> parms,
Map<String, String> files) throws ResponseException
Map<String, String> files) throws ResponseException
{
try
{
@ -1261,7 +1265,8 @@ public abstract class NanoHTTPD
do
{
mpline = in.readLine();
} while (mpline != null && !mpline.contains(boundary));
}
while (mpline != null && !mpline.contains(boundary));
}
parms.put(pname, value);
}
@ -1544,8 +1549,8 @@ public abstract class NanoHTTPD
/**
* Sets a cookie.
*
* @param name The cookie's name.
* @param value The cookie's value.
* @param name The cookie's name.
* @param value The cookie's value.
* @param expires How many days until the cookie expires.
*/
public void set(String name, String value, int expires)

View File

@ -42,7 +42,7 @@ public class Module_help extends HTTPDModule
final StringBuilder responseBody = new StringBuilder()
.append(heading("Command Help", 1))
.append(paragraph(
"This page is an automatically generated listing of all plugin commands that are currently live on the server. "
"This page is an automatically generated listing of all plugin commands that are currently live on the server. "
+ "Please note that it does not include vanilla server commands."));
final Collection<Command> knownCommands = ((SimpleCommandMap) map).getCommands();
@ -102,19 +102,19 @@ public class Module_help extends HTTPDModule
sb.append(
"<li><span class=\"commandName\">{$CMD_NAME}</span> - Usage: <span class=\"commandUsage\">{$CMD_USAGE}</span>"
.replace("{$CMD_NAME}", escapeHtml4(command.getName().trim()))
.replace("{$CMD_USAGE}", escapeHtml4(command.getUsage().trim())));
.replace("{$CMD_NAME}", escapeHtml4(command.getName().trim()))
.replace("{$CMD_USAGE}", escapeHtml4(command.getUsage().trim())));
if (!command.getAliases().isEmpty())
{
sb.append(
" - Aliases: <span class=\"commandAliases\">{$CMD_ALIASES}</span>"
.replace("{$CMD_ALIASES}", escapeHtml4(StringUtils.join(command.getAliases(), ", "))));
.replace("{$CMD_ALIASES}", escapeHtml4(StringUtils.join(command.getAliases(), ", "))));
}
sb.append(
"<br><span class=\"commandDescription\">{$CMD_DESC}</span></li>\r\n"
.replace("{$CMD_DESC}", escapeHtml4(command.getDescription().trim())));
.replace("{$CMD_DESC}", escapeHtml4(command.getDescription().trim())));
return sb.toString();
}

View File

@ -23,10 +23,10 @@ public class Module_logfile extends HTTPDModule
private static final File LOG_FOLDER = new File("./logs/");
private static final String[] LOG_FILTER = new String[]
{
"log",
"gz"
};
{
"log",
"gz"
};
public Module_logfile(TotalFreedomMod plugin, NanoHTTPD.HTTPSession session)
{

View File

@ -30,9 +30,9 @@ public class Module_schematic extends HTTPDModule
private static final String REQUEST_FORM_FILE_ELEMENT_NAME = "schematicFile";
private static final Pattern SCHEMATIC_FILENAME_LC = Pattern.compile("^[a-z0-9_'!,\\-]{1,30}\\.schematic$");
private static final String[] SCHEMATIC_FILTER = new String[]
{
"schematic"
};
{
"schematic"
};
private static final String UPLOAD_FORM = "<form method=\"post\" name=\"schematicForm\" id=\"schematicForm\" action=\"/schematic/upload/\" enctype=\"multipart/form-data\">\n"
+ "<p>Select a schematic file to upload. Filenames must be alphanumeric, between 1 and 30 characters long (inclusive), and have a .schematic extension.</p>\n"
+ "<input type=\"file\" id=\"schematicFile\" name=\"schematicFile\" />\n"