My line endings are bad, and I should feel bad.

This commit is contained in:
h31ix committed 2012-12-15 21:28:49 -05:00
1 parent 38deac94d4
commit 2e9dc8b52b
13 files changed
+131 -131

No files matched your search

@@ -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();
}
}
}
@@ -110,4 +110,4 @@ public class BlockListener extends EventListener
}
backend.logBlockBreak(player);
}
}
}
@@ -185,4 +185,4 @@ public class EntityListener extends EventListener
}
}
}
}
}
@@ -434,4 +434,4 @@ public class PlayerListener extends EventListener
}
}
}
}
}
@@ -45,4 +45,4 @@ public class VehicleListener extends EventListener
backend.logEnterExit((Player) event.getExited());
}
}
}
}
@@ -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
* <code>
* String httpData = encode("guid") + '=' + encode("1234") + encodeDataPair("authors") + "..";
* </code>
*
*
* @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 <strong>unmodifiable</strong> set of the plotter objects in the graph
*
*
* @return
*/
public Set<Plotter> 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
}
}
}
@@ -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.
* <br>
* 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<Integer, Updater.UpdateResult> valueList = new HashMap<Integer, Updater.UpdateResult>();
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<Integer, Updater.UpdateType> valueList = new HashMap<Integer, Updater.UpdateType>();
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);
}
}
}
/**
* Open the RSS feed
*/
private InputStream read()
{
try
{
return url.openStream();
}
catch (IOException e)
{
throw new RuntimeException(e);
}
}
}
@@ -30,4 +30,4 @@ public class ConsoleFormatter extends Formatter
StringBuilder output = new StringBuilder().append(record.getMessage()).append(' ');
return output.toString();
}
}
}
@@ -54,4 +54,4 @@ public class Distance
{
return Math.abs(l1.getY() - l2.getY());
}
}
}
@@ -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();
}
}
}