diff --git a/src/main/java/net/h31ix/anticheat/api/AnticheatAPI.java b/src/main/java/net/h31ix/anticheat/api/AnticheatAPI.java index 823ce25..4181689 100644 --- a/src/main/java/net/h31ix/anticheat/api/AnticheatAPI.java +++ b/src/main/java/net/h31ix/anticheat/api/AnticheatAPI.java @@ -38,7 +38,7 @@ public class AnticheatAPI /** * Start running a certain check - * + * * @param type * Check to start watching for */ @@ -49,7 +49,7 @@ public class AnticheatAPI /** * Stop running a certain check - * + * * @param type * Check to stop watching for */ @@ -60,7 +60,7 @@ public class AnticheatAPI /** * Find out if a check is currently being watched for - * + * * @param type * Type to check * @return true if plugin is watching for this check @@ -72,7 +72,7 @@ public class AnticheatAPI /** * Allow a player to skip a certain check - * + * * @param player * Player to stop watching * @param type @@ -85,7 +85,7 @@ public class AnticheatAPI /** * Stop allowing a player to skip a certain check - * + * * @param player * Player to start watching * @param type @@ -98,7 +98,7 @@ public class AnticheatAPI /** * Find out if a player is currently exempt from a certain check - * + * * @param player * Player to check * @param type @@ -114,7 +114,7 @@ public class AnticheatAPI * Find out if a check will occur for a player. This checks if they are * being tracked, the check is active, the player isn't exempt from the * check, and the player doesn't have override permission. - * + * * @param player * Player to check * @param type @@ -131,7 +131,7 @@ public class AnticheatAPI /** * Get a player's integer hack level - * + * * @param player * Player to check * @return player's hack level @@ -140,11 +140,11 @@ public class AnticheatAPI { return umr.safeGetLevel(player.getName()); } - + /** * Set a player's hack level (Min = 0, Max = 50) - * + * * @param player * Player to set * @param level @@ -159,7 +159,7 @@ public class AnticheatAPI /** * Find out if a player is detected as using xray hacks (on any ore) - * + * * @param player * Player to check * @return true if the player has any xray anomalies. @@ -178,11 +178,11 @@ public class AnticheatAPI /** * Get access to all the other managers, advanced users ONLY - * + * * @return the AntiCheat Manager */ public static AnticheatManager getManager() { return Anticheat.getManager(); } -} \ No newline at end of file +} diff --git a/src/main/java/net/h31ix/anticheat/event/BlockListener.java b/src/main/java/net/h31ix/anticheat/event/BlockListener.java index cb2cf49..263f561 100644 --- a/src/main/java/net/h31ix/anticheat/event/BlockListener.java +++ b/src/main/java/net/h31ix/anticheat/event/BlockListener.java @@ -110,4 +110,4 @@ public class BlockListener extends EventListener } backend.logBlockBreak(player); } -} \ No newline at end of file +} diff --git a/src/main/java/net/h31ix/anticheat/event/EntityListener.java b/src/main/java/net/h31ix/anticheat/event/EntityListener.java index 01da5f1..37c8a01 100644 --- a/src/main/java/net/h31ix/anticheat/event/EntityListener.java +++ b/src/main/java/net/h31ix/anticheat/event/EntityListener.java @@ -185,4 +185,4 @@ public class EntityListener extends EventListener } } } -} \ No newline at end of file +} diff --git a/src/main/java/net/h31ix/anticheat/event/PlayerListener.java b/src/main/java/net/h31ix/anticheat/event/PlayerListener.java index 840d16d..8a3184a 100644 --- a/src/main/java/net/h31ix/anticheat/event/PlayerListener.java +++ b/src/main/java/net/h31ix/anticheat/event/PlayerListener.java @@ -434,4 +434,4 @@ public class PlayerListener extends EventListener } } } -} \ No newline at end of file +} diff --git a/src/main/java/net/h31ix/anticheat/event/VehicleListener.java b/src/main/java/net/h31ix/anticheat/event/VehicleListener.java index 78cba5a..6d7461b 100644 --- a/src/main/java/net/h31ix/anticheat/event/VehicleListener.java +++ b/src/main/java/net/h31ix/anticheat/event/VehicleListener.java @@ -45,4 +45,4 @@ public class VehicleListener extends EventListener backend.logEnterExit((Player) event.getExited()); } } -} \ No newline at end of file +} diff --git a/src/main/java/net/h31ix/anticheat/metrics/Metrics.java b/src/main/java/net/h31ix/anticheat/metrics/Metrics.java index 0418ed6..40427b4 100644 --- a/src/main/java/net/h31ix/anticheat/metrics/Metrics.java +++ b/src/main/java/net/h31ix/anticheat/metrics/Metrics.java @@ -145,7 +145,7 @@ public class Metrics * Construct and create a Graph that can be used to separate specific * plotters to their own graphs on the metrics website. Plotters can be * added to the graph object returned. - * + * * @param name * @return Graph object created. Will never return NULL under normal * circumstances unless bad parameters are given @@ -169,7 +169,7 @@ public class Metrics /** * Adds a custom data plotter to the default graph - * + * * @param plotter */ public void addCustomData(Plotter plotter) @@ -338,7 +338,7 @@ public class Metrics /** * Check if mineshafter is present. If it is, we need to bypass it to send * POST requests - * + * * @return */ private boolean isMineshafterPresent() @@ -362,7 +362,7 @@ public class Metrics * * String httpData = encode("guid") + '=' + encode("1234") + encodeDataPair("authors") + ".."; * - * + * * @param key * @param value * @return @@ -374,7 +374,7 @@ public class Metrics /** * Encode text as UTF-8 - * + * * @param text * @return */ @@ -407,7 +407,7 @@ public class Metrics /** * Gets the graph's name - * + * * @return */ public String getName() @@ -417,7 +417,7 @@ public class Metrics /** * Add a plotter to the graph, which will be used to plot entries - * + * * @param plotter */ public void addPlotter(Plotter plotter) @@ -427,7 +427,7 @@ public class Metrics /** * Remove a plotter from the graph - * + * * @param plotter */ public void removePlotter(Plotter plotter) @@ -437,7 +437,7 @@ public class Metrics /** * Gets an unmodifiable set of the plotter objects in the graph - * + * * @return */ public Set getPlotters() @@ -486,7 +486,7 @@ public class Metrics /** * Construct a plotter with a specific plot name - * + * * @param name */ public Plotter(String name) @@ -496,14 +496,14 @@ public class Metrics /** * Get the current value for the plotted point - * + * * @return */ public abstract int getValue(); /** * Get the column name for the plotted point - * + * * @return the plotted point's column name */ public String getColumnName() @@ -538,4 +538,4 @@ public class Metrics } -} \ No newline at end of file +} diff --git a/src/main/java/net/h31ix/anticheat/update/Updater.java b/src/main/java/net/h31ix/anticheat/update/Updater.java index 7bb5ab4..bfa42f2 100644 --- a/src/main/java/net/h31ix/anticheat/update/Updater.java +++ b/src/main/java/net/h31ix/anticheat/update/Updater.java @@ -46,11 +46,11 @@ import org.bukkit.plugin.Plugin; * An example of a good configuration option would be something similar to 'auto-update: true' - if this value is set to false you may NOT run the auto-updater. *
* If you are unsure about these rules, please read the plugin submission guidelines: http://goo.gl/8iU5l - * + * * @author H31IX */ -public class Updater +public class Updater { private Plugin plugin; private UpdateType type; @@ -67,64 +67,64 @@ public class Updater private static final int BYTE_SIZE = 1024; // Used for downloading files private String updateFolder = YamlConfiguration.loadConfiguration(new File("bukkit.yml")).getString("settings.update-folder"); // The folder that downloads will be placed in private Updater.UpdateResult result = Updater.UpdateResult.SUCCESS; // Used for determining the outcome of the update process - + // Strings for reading RSS private static final String TITLE = "title"; private static final String LINK = "link"; - private static final String ITEM = "item"; - + private static final String ITEM = "item"; + /** * Gives the dev the result of the update process. Can be obtained by called getResult(). - */ + */ public enum UpdateResult { /** * The updater found an update, and has readied it to be loaded the next time the server restarts/reloads. - */ + */ SUCCESS(1), /** * The updater did not find an update, and nothing was downloaded. - */ + */ NO_UPDATE(2), /** * The updater found an update, but was unable to download it. - */ + */ FAIL_DOWNLOAD(3), /** * For some reason, the updater was unable to contact dev.bukkit.org to download the file. - */ + */ FAIL_DBO(4), /** * When running the version check, the file on DBO did not contain the a version in the format 'vVersion' such as 'v1.0'. - */ + */ FAIL_NOVERSION(5), /** * The slug provided by the plugin running the updater was invalid and doesn't exist on DBO. - */ + */ FAIL_BADSLUG(6), /** * The updater found an update, but because of the UpdateType being set to NO_DOWNLOAD, it wasn't downloaded. - */ - UPDATE_AVAILABLE(7); - + */ + UPDATE_AVAILABLE(7); + private static final Map valueList = new HashMap(); private final int value; - + private UpdateResult(int value) { this.value = value; } - + public int getValue() { return this.value; } - + public static Updater.UpdateResult getResult(int value) { return valueList.get(value); } - + static { for(Updater.UpdateResult result : Updater.UpdateResult.values()) @@ -133,43 +133,43 @@ public class Updater } } } - + /** * Allows the dev to specify the type of update that will be run. - */ + */ public enum UpdateType { /** * Run a version check, and then if the file is out of date, download the newest version. - */ + */ DEFAULT(1), /** * Don't run a version check, just find the latest update and download it. - */ + */ NO_VERSION_CHECK(2), /** * Get information about the version and the download size, but don't actually download anything. - */ + */ NO_DOWNLOAD(3); - + private static final Map valueList = new HashMap(); private final int value; - + private UpdateType(int value) { this.value = value; } - + public int getValue() { return this.value; } - + public static Updater.UpdateType getResult(int value) { return valueList.get(value); } - + static { for(Updater.UpdateType result : Updater.UpdateType.values()) @@ -177,11 +177,11 @@ public class Updater valueList.put(result.value, result); } } - } - + } + /** * Initialize the updater - * + * * @param plugin * The plugin that is checking for an update. * @param slug @@ -192,18 +192,18 @@ public class Updater * Specify the type of update this will be. See {@link UpdateType} * @param announce * True if the program should announce the progress of new updates in console - */ + */ public Updater(Plugin plugin, String slug, File file, UpdateType type, boolean announce) { this.plugin = plugin; this.type = type; this.announce = announce; - try + try { // Obtain the results of the project's file feed url = new URL(DBOUrl + slug + "/files.rss"); - } - catch (MalformedURLException ex) + } + catch (MalformedURLException ex) { // The slug doesn't exist plugin.getLogger().warning("The author of this plugin has misconfigured their Auto Update system"); @@ -238,31 +238,31 @@ public class Updater /** * Get the result of the update process. - */ + */ public Updater.UpdateResult getResult() { return result; } - + /** * Get the total bytes of the file (can only be used after running a version check or a normal run). - */ + */ public long getFileSize() { return totalSize; - } - + } + /** * Get the version string latest file avaliable online. - */ + */ public String getLatestVersionString() { return versionTitle; } - + /** * Save an update from dev.bukkit.org into the server's update folder. - */ + */ private void saveFile(File folder, String file, String u) { if(!folder.exists()) @@ -312,7 +312,7 @@ public class Updater } catch (Exception ex) { - plugin.getLogger().warning("The auto-updater tried to download a new update, but was unsuccessful."); + plugin.getLogger().warning("The auto-updater tried to download a new update, but was unsuccessful."); result = Updater.UpdateResult.FAIL_DOWNLOAD; } finally @@ -329,15 +329,15 @@ public class Updater } } catch (Exception ex) - { + { } } } - + /** * Part of Zip-File-Extractor, modified by H31IX for use with Bukkit - */ - private void unzip(String file) + */ + private void unzip(String file) { try { @@ -356,12 +356,12 @@ public class Updater } else { - BufferedInputStream bis = new BufferedInputStream(zipFile.getInputStream(entry)); + BufferedInputStream bis = new BufferedInputStream(zipFile.getInputStream(entry)); int b; byte buffer[] = new byte[BYTE_SIZE]; FileOutputStream fos = new FileOutputStream(destinationFilePath); BufferedOutputStream bos = new BufferedOutputStream(fos, BYTE_SIZE); - while((b = bis.read(buffer, 0, BYTE_SIZE)) != -1) + while((b = bis.read(buffer, 0, BYTE_SIZE)) != -1) { bos.write(buffer, 0, b); } @@ -421,15 +421,15 @@ public class Updater catch(IOException ex) { ex.printStackTrace(); - plugin.getLogger().warning("The auto-updater tried to unzip a new update file, but was unsuccessful."); - result = Updater.UpdateResult.FAIL_DOWNLOAD; - } + plugin.getLogger().warning("The auto-updater tried to unzip a new update file, but was unsuccessful."); + result = Updater.UpdateResult.FAIL_DOWNLOAD; + } new File(file).delete(); - } - + } + /** * Check if the name of a jar is one of the plugins currently installed, used for extracting the correct files out of a zip. - */ + */ public boolean pluginFile(String name) { for(File file : new File("plugins").listFiles()) @@ -440,11 +440,11 @@ public class Updater } } return false; - } - + } + /** * Obtain the direct download file url from the file's page. - */ + */ private String getFile(String link) { String download = null; @@ -455,7 +455,7 @@ public class Updater URLConnection urlConn = url.openConnection(); InputStreamReader inStream = new InputStreamReader(urlConn.getInputStream()); BufferedReader buff = new BufferedReader(inStream); - + int counter = 0; String line; while((line = buff.readLine()) != null) @@ -490,11 +490,11 @@ public class Updater ex.printStackTrace(); plugin.getLogger().warning("The auto-updater tried to contact dev.bukkit.org, but was unsuccessful."); result = Updater.UpdateResult.FAIL_DBO; - return null; + return null; } return download; } - + /** * Check to see if the program should continue by evaluation whether the plugin is already updated, or shouldn't be updated */ @@ -525,10 +525,10 @@ public class Updater } return true; } - + /** * Evaluate whether the version number is marked showing that it should not be updated by this program - */ + */ private boolean hasTag(String version, String remoteVersion) { for(String string : noUpdateTag) @@ -548,14 +548,14 @@ public class Updater } return false; } - + /** * Part of RSS Reader by Vogella, modified by H31IX for use with Bukkit - */ + */ @SuppressWarnings("null") - private void readFeed() + private void readFeed() { - try + try { // Set header values intial to the empty string String title = ""; @@ -566,27 +566,27 @@ public class Updater InputStream in = read(); XMLEventReader eventReader = inputFactory.createXMLEventReader(in); // Read the XML document - while (eventReader.hasNext()) + while (eventReader.hasNext()) { XMLEvent event = eventReader.nextEvent(); - if (event.isStartElement()) + if (event.isStartElement()) { - if (event.asStartElement().getName().getLocalPart().equals(TITLE)) - { + if (event.asStartElement().getName().getLocalPart().equals(TITLE)) + { event = eventReader.nextEvent(); title = event.asCharacters().getData(); continue; } - if (event.asStartElement().getName().getLocalPart().equals(LINK)) - { + if (event.asStartElement().getName().getLocalPart().equals(LINK)) + { event = eventReader.nextEvent(); link = event.asCharacters().getData(); continue; } - } - else if (event.isEndElement()) + } + else if (event.isEndElement()) { - if (event.asEndElement().getName().getLocalPart().equals(ITEM)) + if (event.asEndElement().getName().getLocalPart().equals(ITEM)) { // Store the title and link of the first entry we get - the first file on the list is all we need versionTitle = title; @@ -596,25 +596,25 @@ public class Updater } } } - } - catch (XMLStreamException e) - { - throw new RuntimeException(e); } - } - - /** - * Open the RSS feed - */ - private InputStream read() - { - try - { - return url.openStream(); - } - catch (IOException e) + catch (XMLStreamException e) { throw new RuntimeException(e); } } -} \ No newline at end of file + + /** + * Open the RSS feed + */ + private InputStream read() + { + try + { + return url.openStream(); + } + catch (IOException e) + { + throw new RuntimeException(e); + } + } +} diff --git a/src/main/java/net/h31ix/anticheat/util/ConsoleFormatter.java b/src/main/java/net/h31ix/anticheat/util/ConsoleFormatter.java index 5260306..cfe6200 100644 --- a/src/main/java/net/h31ix/anticheat/util/ConsoleFormatter.java +++ b/src/main/java/net/h31ix/anticheat/util/ConsoleFormatter.java @@ -30,4 +30,4 @@ public class ConsoleFormatter extends Formatter StringBuilder output = new StringBuilder().append(record.getMessage()).append(' '); return output.toString(); } -} \ No newline at end of file +} diff --git a/src/main/java/net/h31ix/anticheat/util/Distance.java b/src/main/java/net/h31ix/anticheat/util/Distance.java index 8f747c8..47c137f 100644 --- a/src/main/java/net/h31ix/anticheat/util/Distance.java +++ b/src/main/java/net/h31ix/anticheat/util/Distance.java @@ -54,4 +54,4 @@ public class Distance { return Math.abs(l1.getY() - l2.getY()); } -} \ No newline at end of file +} diff --git a/src/main/java/net/h31ix/anticheat/util/FileFormatter.java b/src/main/java/net/h31ix/anticheat/util/FileFormatter.java index eaba6a7..7d4a298 100644 --- a/src/main/java/net/h31ix/anticheat/util/FileFormatter.java +++ b/src/main/java/net/h31ix/anticheat/util/FileFormatter.java @@ -35,4 +35,4 @@ public class FileFormatter extends Formatter StringBuilder output = new StringBuilder().append("[").append(record.getLevel()).append('|').append(FORMAT.format(new Date(record.getMillis()))).append("]: ").append(record.getMessage()).append(' ').append(LINE_SEP); return output.toString(); } -} \ No newline at end of file +} diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index bb6e818..36c5355 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -40,4 +40,4 @@ System: # However, alerts will still be sent to console and to admins online, and events will still take place. Silent mode: false # Should ops be exempt from all checks? - Exempt op: false \ No newline at end of file + Exempt op: false diff --git a/src/main/resources/magic.yml b/src/main/resources/magic.yml index 82c67a9..9b627e2 100644 --- a/src/main/resources/magic.yml +++ b/src/main/resources/magic.yml @@ -75,4 +75,4 @@ INVENTORY_MAXVIOLATIONS: 2 INVENTORY_MAXVIOLATIONTIME: 10000 INVENTORY_TIMEMAX: 50 TIMER_STEP_CHECK: 50 -TIMER_TIMEMIN: 2000 \ No newline at end of file +TIMER_TIMEMIN: 2000 diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index ca5bef0..42f74ea 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -157,4 +157,4 @@ permissions: anticheat.check.visual: true anticheat.check.vclip: true anticheat.check.fastinventory: true - anticheat.check.autotool: true \ No newline at end of file + anticheat.check.autotool: true