[Bleeding] Revamped rank system yet again

Refractoring
Bug fixes
Mass format
This commit is contained in:
JeromSar
2016-02-29 21:48:17 +01:00
parent a0058869c9
commit 4586b7519f
33 changed files with 219 additions and 301 deletions

View File

@ -1,5 +1,12 @@
package me.totalfreedom.totalfreedommod.httpd;
import me.totalfreedom.totalfreedommod.httpd.module.Module_help;
import me.totalfreedom.totalfreedommod.httpd.module.Module_file;
import me.totalfreedom.totalfreedommod.httpd.module.Module_schematic;
import me.totalfreedom.totalfreedommod.httpd.module.Module_permbans;
import me.totalfreedom.totalfreedommod.httpd.module.Module_players;
import me.totalfreedom.totalfreedommod.httpd.module.Module_logs;
import me.totalfreedom.totalfreedommod.httpd.module.Module_list;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

View File

@ -887,7 +887,7 @@ public abstract class NanoHTTPD
/**
* Handles one session, i.e. parses the HTTP request and returns the response.
*/
protected class HTTPSession
public class HTTPSession // TFM - protected -> public
{
public static final int BUFSIZE = 8192;
@ -1004,7 +1004,7 @@ public abstract class NanoHTTPD
}
}
protected void parseBody(Map<String, String> files) throws IOException, ResponseException
public void parseBody(Map<String, String> files) throws IOException, ResponseException // TFM - protected -> public
{
RandomAccessFile randomAccessFile = null;
BufferedReader in = null;

View File

@ -1,8 +1,9 @@
package me.totalfreedom.totalfreedommod.httpd;
package me.totalfreedom.totalfreedommod.httpd.module;
import java.net.Socket;
import java.util.HashMap;
import java.util.Map;
import me.totalfreedom.totalfreedommod.httpd.HTTPDPageBuilder;
import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD.HTTPSession;
import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD.Method;
import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD.Response;

View File

@ -1,9 +1,11 @@
package me.totalfreedom.totalfreedommod.httpd;
package me.totalfreedom.totalfreedommod.httpd.module;
import java.io.File;
import java.io.IOException;
import java.util.Iterator;
import java.util.Map;
import me.totalfreedom.totalfreedommod.httpd.HTTPDaemon;
import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD;
import static me.totalfreedom.totalfreedommod.httpd.HTMLGenerationTools.list;
import static me.totalfreedom.totalfreedommod.httpd.HTMLGenerationTools.paragraph;
import me.totalfreedom.totalfreedommod.util.FLog;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.httpd;
package me.totalfreedom.totalfreedommod.httpd.module;
import java.io.File;
import java.io.FileInputStream;
@ -13,6 +13,8 @@ import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.httpd.HTTPDaemon;
import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD;
import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD.Response;
import org.apache.commons.lang3.StringUtils;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.httpd;
package me.totalfreedom.totalfreedommod.httpd.module;
import com.google.common.collect.Lists;
import java.util.Collection;
@ -10,9 +10,11 @@ import java.util.List;
import java.util.Map;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.commands.FreedomCommand;
import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD;
import static me.totalfreedom.totalfreedommod.httpd.HTMLGenerationTools.heading;
import static me.totalfreedom.totalfreedommod.httpd.HTMLGenerationTools.paragraph;
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
import me.totalfreedom.totalfreedommod.rank.Rank;
import net.pravian.aero.command.CommandReflection;
import static org.apache.commons.lang3.StringEscapeUtils.escapeHtml4;
import org.apache.commons.lang3.StringUtils;
@ -76,7 +78,7 @@ public class Module_help extends HTTPDModule
responseBody.append(heading(pluginName, 2)).append("<ul>\r\n");
PlayerRank lastTfmCommandLevel = null;
Rank lastTfmCommandLevel = null;
for (Command command : commands)
{
if (!TotalFreedomMod.pluginName.equals(pluginName))
@ -85,7 +87,7 @@ public class Module_help extends HTTPDModule
continue;
}
PlayerRank tfmCommandLevel = FreedomCommand.getCommand(command).getPerms().level();
Rank tfmCommandLevel = FreedomCommand.getCommand(command).getPerms().level();
if (lastTfmCommandLevel == null || lastTfmCommandLevel != tfmCommandLevel)
{
responseBody.append("</ul>\r\n").append(heading(tfmCommandLevel.getName(), 3)).append("<ul>\r\n");

View File

@ -1,7 +1,8 @@
package me.totalfreedom.totalfreedommod.httpd;
package me.totalfreedom.totalfreedommod.httpd.module;
import java.util.Collection;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;

View File

@ -1,7 +1,8 @@
package me.totalfreedom.totalfreedommod.httpd;
package me.totalfreedom.totalfreedommod.httpd.module;
import java.io.File;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD;
public class Module_logs extends Module_file
{

View File

@ -1,7 +1,9 @@
package me.totalfreedom.totalfreedommod.httpd;
package me.totalfreedom.totalfreedommod.httpd.module;
import java.io.File;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.httpd.HTTPDaemon;
import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD;
public class Module_permbans extends HTTPDModule
{

View File

@ -1,8 +1,9 @@
package me.totalfreedom.totalfreedommod.httpd;
package me.totalfreedom.totalfreedommod.httpd.module;
import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.util.FUtil;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.json.simple.JSONArray;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.totalfreedommod.httpd;
package me.totalfreedom.totalfreedommod.httpd.module;
import java.io.File;
import java.io.IOException;
@ -14,6 +14,10 @@ import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD.Method;
import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD.Response;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.httpd.HTMLGenerationTools;
import me.totalfreedom.totalfreedommod.httpd.HTTPDPageBuilder;
import me.totalfreedom.totalfreedommod.httpd.HTTPDaemon;
import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;