Code cleanup and Optimizations

This commit is contained in:
MattBDev
2016-03-29 00:56:44 -04:00
parent 49d18b9229
commit 32ba55baf5
34 changed files with 456 additions and 540 deletions

View File

@ -51,39 +51,39 @@ import java.util.zip.GZIPOutputStream;
public class Metrics {
/**
* The current revision number
* The current revision number.
*/
private static final int REVISION = 7;
/**
* The base url of the metrics domain
* The base url of the metrics domain.
*/
private static final String BASE_URL = "http://report.mcstats.org";
/**
* The url used to report a server's status
* The url used to report a server's status.
*/
private static final String REPORT_URL = "/plugin/%s";
/**
* Interval of time to ping (in minutes)
* Interval of time to ping (in minutes).
*/
private static final int PING_INTERVAL = 15;
/**
* The plugin this metrics submits for
* The plugin this metrics submits for.
*/
private final Plugin plugin;
/**
* All of the custom graphs to submit to metrics
* All of the custom graphs to submit to metrics.
*/
private final Set<Graph> graphs = Collections.synchronizedSet(new HashSet<Graph>());
/**
* Unique server id
* Unique server id.
*/
private final String guid;
/**
* Debug mode
* Debug mode.
*/
private final boolean debug;
/**
* The scheduled task
* The scheduled task.
*/
private volatile BukkitTask task = null;
@ -97,7 +97,7 @@ public class Metrics {
}
/**
* GZip compress a string of bytes
* GZip compress a string of bytes.
*
* @param input
*
@ -129,7 +129,6 @@ public class Metrics {
* @param key
* @param value
*
* @throws UnsupportedEncodingException
*/
private static void appendJSONPair(StringBuilder json, String key, String value) {
boolean isValueNumeric = false;

View File

@ -336,7 +336,7 @@ public class NbtFactory {
}
/**
* Search for the first publically and privately defined method of the given name and parameter count.
* Search for the first publicly and privately defined method of the given name and parameter count.
* @param requireMod - modifiers that are required.
* @param bannedMod - modifiers that are banned.
* @param clazz - a class to start with.
@ -366,7 +366,7 @@ public class NbtFactory {
}
/**
* Search for the first publically and privately defined field of the given name.
* Search for the first publicly and privately defined field of the given name.
* @param instance - an instance of the class with the field.
* @param clazz - an optional class to start with, or NULL to deduce it from instance.
* @param fieldName - the field name.

View File

@ -56,7 +56,7 @@ public class OfflinePlayerUtil {
return name;
}
Constructor gameProfileConstructor = makeConstructor(gameProfileClass, UUID.class, String.class);
if (gameProfileConstructor == null) { //Verson has string constructor
if (gameProfileConstructor == null) { //Version has string constructor
gameProfileConstructor = makeConstructor(gameProfileClass, String.class, String.class);
return callConstructor(gameProfileConstructor, id.toString(), name);
} else { //Version has uuid constructor

View File

@ -127,10 +127,10 @@ public class SendChunk {
}
}
public void sendChunk(String worldname, Collection<ChunkLoc> locs) {
public void sendChunk(String worldname, Collection<ChunkLoc> chunkLocs) {
World myworld = Bukkit.getWorld(worldname);
ArrayList<Chunk> chunks = new ArrayList<>();
for (ChunkLoc loc : locs) {
for (ChunkLoc loc : chunkLocs) {
if (myworld.isChunkLoaded(loc.x, loc.z)) {
chunks.add(myworld.getChunkAt(loc.x, loc.z));
}