mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-02 22:16:03 +00:00
My line endings are bad, and I should feel bad.
This commit is contained in:
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
|
* Start running a certain check
|
||||||
*
|
*
|
||||||
* @param type
|
* @param type
|
||||||
* Check to start watching for
|
* Check to start watching for
|
||||||
*/
|
*/
|
||||||
@@ -49,7 +49,7 @@ public class AnticheatAPI
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Stop running a certain check
|
* Stop running a certain check
|
||||||
*
|
*
|
||||||
* @param type
|
* @param type
|
||||||
* Check to stop watching for
|
* Check to stop watching for
|
||||||
*/
|
*/
|
||||||
@@ -60,7 +60,7 @@ public class AnticheatAPI
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Find out if a check is currently being watched for
|
* Find out if a check is currently being watched for
|
||||||
*
|
*
|
||||||
* @param type
|
* @param type
|
||||||
* Type to check
|
* Type to check
|
||||||
* @return true if plugin is watching for this 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
|
* Allow a player to skip a certain check
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* Player to stop watching
|
* Player to stop watching
|
||||||
* @param type
|
* @param type
|
||||||
@@ -85,7 +85,7 @@ public class AnticheatAPI
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Stop allowing a player to skip a certain check
|
* Stop allowing a player to skip a certain check
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* Player to start watching
|
* Player to start watching
|
||||||
* @param type
|
* @param type
|
||||||
@@ -98,7 +98,7 @@ public class AnticheatAPI
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Find out if a player is currently exempt from a certain check
|
* Find out if a player is currently exempt from a certain check
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* Player to check
|
* Player to check
|
||||||
* @param type
|
* @param type
|
||||||
@@ -114,7 +114,7 @@ public class AnticheatAPI
|
|||||||
* Find out if a check will occur for a player. This checks if they are
|
* 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
|
* being tracked, the check is active, the player isn't exempt from the
|
||||||
* check, and the player doesn't have override permission.
|
* check, and the player doesn't have override permission.
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* Player to check
|
* Player to check
|
||||||
* @param type
|
* @param type
|
||||||
@@ -131,7 +131,7 @@ public class AnticheatAPI
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a player's integer hack level
|
* Get a player's integer hack level
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* Player to check
|
* Player to check
|
||||||
* @return player's hack level
|
* @return player's hack level
|
||||||
@@ -140,11 +140,11 @@ public class AnticheatAPI
|
|||||||
{
|
{
|
||||||
return umr.safeGetLevel(player.getName());
|
return umr.safeGetLevel(player.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a player's hack level (Min = 0, Max = 50)
|
* Set a player's hack level (Min = 0, Max = 50)
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* Player to set
|
* Player to set
|
||||||
* @param level
|
* @param level
|
||||||
@@ -159,7 +159,7 @@ public class AnticheatAPI
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Find out if a player is detected as using xray hacks (on any ore)
|
* Find out if a player is detected as using xray hacks (on any ore)
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* Player to check
|
* Player to check
|
||||||
* @return true if the player has any xray anomalies.
|
* @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
|
* Get access to all the other managers, advanced users ONLY
|
||||||
*
|
*
|
||||||
* @return the AntiCheat Manager
|
* @return the AntiCheat Manager
|
||||||
*/
|
*/
|
||||||
public static AnticheatManager getManager()
|
public static AnticheatManager getManager()
|
||||||
{
|
{
|
||||||
return Anticheat.getManager();
|
return Anticheat.getManager();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -110,4 +110,4 @@ public class BlockListener extends EventListener
|
|||||||
}
|
}
|
||||||
backend.logBlockBreak(player);
|
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());
|
backend.logEnterExit((Player) event.getExited());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -145,7 +145,7 @@ public class Metrics
|
|||||||
* Construct and create a Graph that can be used to separate specific
|
* Construct and create a Graph that can be used to separate specific
|
||||||
* plotters to their own graphs on the metrics website. Plotters can be
|
* plotters to their own graphs on the metrics website. Plotters can be
|
||||||
* added to the graph object returned.
|
* added to the graph object returned.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* @return Graph object created. Will never return NULL under normal
|
* @return Graph object created. Will never return NULL under normal
|
||||||
* circumstances unless bad parameters are given
|
* circumstances unless bad parameters are given
|
||||||
@@ -169,7 +169,7 @@ public class Metrics
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a custom data plotter to the default graph
|
* Adds a custom data plotter to the default graph
|
||||||
*
|
*
|
||||||
* @param plotter
|
* @param plotter
|
||||||
*/
|
*/
|
||||||
public void addCustomData(Plotter 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
|
* Check if mineshafter is present. If it is, we need to bypass it to send
|
||||||
* POST requests
|
* POST requests
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private boolean isMineshafterPresent()
|
private boolean isMineshafterPresent()
|
||||||
@@ -362,7 +362,7 @@ public class Metrics
|
|||||||
* <code>
|
* <code>
|
||||||
* String httpData = encode("guid") + '=' + encode("1234") + encodeDataPair("authors") + "..";
|
* String httpData = encode("guid") + '=' + encode("1234") + encodeDataPair("authors") + "..";
|
||||||
* </code>
|
* </code>
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* @param value
|
* @param value
|
||||||
* @return
|
* @return
|
||||||
@@ -374,7 +374,7 @@ public class Metrics
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Encode text as UTF-8
|
* Encode text as UTF-8
|
||||||
*
|
*
|
||||||
* @param text
|
* @param text
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -407,7 +407,7 @@ public class Metrics
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the graph's name
|
* Gets the graph's name
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String getName()
|
public String getName()
|
||||||
@@ -417,7 +417,7 @@ public class Metrics
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a plotter to the graph, which will be used to plot entries
|
* Add a plotter to the graph, which will be used to plot entries
|
||||||
*
|
*
|
||||||
* @param plotter
|
* @param plotter
|
||||||
*/
|
*/
|
||||||
public void addPlotter(Plotter plotter)
|
public void addPlotter(Plotter plotter)
|
||||||
@@ -427,7 +427,7 @@ public class Metrics
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a plotter from the graph
|
* Remove a plotter from the graph
|
||||||
*
|
*
|
||||||
* @param plotter
|
* @param plotter
|
||||||
*/
|
*/
|
||||||
public void removePlotter(Plotter 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
|
* Gets an <strong>unmodifiable</strong> set of the plotter objects in the graph
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Set<Plotter> getPlotters()
|
public Set<Plotter> getPlotters()
|
||||||
@@ -486,7 +486,7 @@ public class Metrics
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a plotter with a specific plot name
|
* Construct a plotter with a specific plot name
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
*/
|
*/
|
||||||
public Plotter(String name)
|
public Plotter(String name)
|
||||||
@@ -496,14 +496,14 @@ public class Metrics
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current value for the plotted point
|
* Get the current value for the plotted point
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public abstract int getValue();
|
public abstract int getValue();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the column name for the plotted point
|
* Get the column name for the plotted point
|
||||||
*
|
*
|
||||||
* @return the plotted point's column name
|
* @return the plotted point's column name
|
||||||
*/
|
*/
|
||||||
public String getColumnName()
|
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.
|
* 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>
|
* <br>
|
||||||
* If you are unsure about these rules, please read the plugin submission guidelines: http://goo.gl/8iU5l
|
* If you are unsure about these rules, please read the plugin submission guidelines: http://goo.gl/8iU5l
|
||||||
*
|
*
|
||||||
* @author H31IX
|
* @author H31IX
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class Updater
|
public class Updater
|
||||||
{
|
{
|
||||||
private Plugin plugin;
|
private Plugin plugin;
|
||||||
private UpdateType type;
|
private UpdateType type;
|
||||||
@@ -67,64 +67,64 @@ public class Updater
|
|||||||
private static final int BYTE_SIZE = 1024; // Used for downloading files
|
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 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
|
private Updater.UpdateResult result = Updater.UpdateResult.SUCCESS; // Used for determining the outcome of the update process
|
||||||
|
|
||||||
// Strings for reading RSS
|
// Strings for reading RSS
|
||||||
private static final String TITLE = "title";
|
private static final String TITLE = "title";
|
||||||
private static final String LINK = "link";
|
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().
|
* Gives the dev the result of the update process. Can be obtained by called getResult().
|
||||||
*/
|
*/
|
||||||
public enum UpdateResult
|
public enum UpdateResult
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The updater found an update, and has readied it to be loaded the next time the server restarts/reloads.
|
* The updater found an update, and has readied it to be loaded the next time the server restarts/reloads.
|
||||||
*/
|
*/
|
||||||
SUCCESS(1),
|
SUCCESS(1),
|
||||||
/**
|
/**
|
||||||
* The updater did not find an update, and nothing was downloaded.
|
* The updater did not find an update, and nothing was downloaded.
|
||||||
*/
|
*/
|
||||||
NO_UPDATE(2),
|
NO_UPDATE(2),
|
||||||
/**
|
/**
|
||||||
* The updater found an update, but was unable to download it.
|
* The updater found an update, but was unable to download it.
|
||||||
*/
|
*/
|
||||||
FAIL_DOWNLOAD(3),
|
FAIL_DOWNLOAD(3),
|
||||||
/**
|
/**
|
||||||
* For some reason, the updater was unable to contact dev.bukkit.org to download the file.
|
* For some reason, the updater was unable to contact dev.bukkit.org to download the file.
|
||||||
*/
|
*/
|
||||||
FAIL_DBO(4),
|
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'.
|
* 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),
|
FAIL_NOVERSION(5),
|
||||||
/**
|
/**
|
||||||
* The slug provided by the plugin running the updater was invalid and doesn't exist on DBO.
|
* The slug provided by the plugin running the updater was invalid and doesn't exist on DBO.
|
||||||
*/
|
*/
|
||||||
FAIL_BADSLUG(6),
|
FAIL_BADSLUG(6),
|
||||||
/**
|
/**
|
||||||
* The updater found an update, but because of the UpdateType being set to NO_DOWNLOAD, it wasn't downloaded.
|
* 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 static final Map<Integer, Updater.UpdateResult> valueList = new HashMap<Integer, Updater.UpdateResult>();
|
||||||
private final int value;
|
private final int value;
|
||||||
|
|
||||||
private UpdateResult(int value)
|
private UpdateResult(int value)
|
||||||
{
|
{
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getValue()
|
public int getValue()
|
||||||
{
|
{
|
||||||
return this.value;
|
return this.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Updater.UpdateResult getResult(int value)
|
public static Updater.UpdateResult getResult(int value)
|
||||||
{
|
{
|
||||||
return valueList.get(value);
|
return valueList.get(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
for(Updater.UpdateResult result : Updater.UpdateResult.values())
|
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.
|
* Allows the dev to specify the type of update that will be run.
|
||||||
*/
|
*/
|
||||||
public enum UpdateType
|
public enum UpdateType
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run a version check, and then if the file is out of date, download the newest version.
|
* Run a version check, and then if the file is out of date, download the newest version.
|
||||||
*/
|
*/
|
||||||
DEFAULT(1),
|
DEFAULT(1),
|
||||||
/**
|
/**
|
||||||
* Don't run a version check, just find the latest update and download it.
|
* Don't run a version check, just find the latest update and download it.
|
||||||
*/
|
*/
|
||||||
NO_VERSION_CHECK(2),
|
NO_VERSION_CHECK(2),
|
||||||
/**
|
/**
|
||||||
* Get information about the version and the download size, but don't actually download anything.
|
* Get information about the version and the download size, but don't actually download anything.
|
||||||
*/
|
*/
|
||||||
NO_DOWNLOAD(3);
|
NO_DOWNLOAD(3);
|
||||||
|
|
||||||
private static final Map<Integer, Updater.UpdateType> valueList = new HashMap<Integer, Updater.UpdateType>();
|
private static final Map<Integer, Updater.UpdateType> valueList = new HashMap<Integer, Updater.UpdateType>();
|
||||||
private final int value;
|
private final int value;
|
||||||
|
|
||||||
private UpdateType(int value)
|
private UpdateType(int value)
|
||||||
{
|
{
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getValue()
|
public int getValue()
|
||||||
{
|
{
|
||||||
return this.value;
|
return this.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Updater.UpdateType getResult(int value)
|
public static Updater.UpdateType getResult(int value)
|
||||||
{
|
{
|
||||||
return valueList.get(value);
|
return valueList.get(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
for(Updater.UpdateType result : Updater.UpdateType.values())
|
for(Updater.UpdateType result : Updater.UpdateType.values())
|
||||||
@@ -177,11 +177,11 @@ public class Updater
|
|||||||
valueList.put(result.value, result);
|
valueList.put(result.value, result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the updater
|
* Initialize the updater
|
||||||
*
|
*
|
||||||
* @param plugin
|
* @param plugin
|
||||||
* The plugin that is checking for an update.
|
* The plugin that is checking for an update.
|
||||||
* @param slug
|
* @param slug
|
||||||
@@ -192,18 +192,18 @@ public class Updater
|
|||||||
* Specify the type of update this will be. See {@link UpdateType}
|
* Specify the type of update this will be. See {@link UpdateType}
|
||||||
* @param announce
|
* @param announce
|
||||||
* True if the program should announce the progress of new updates in console
|
* 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)
|
public Updater(Plugin plugin, String slug, File file, UpdateType type, boolean announce)
|
||||||
{
|
{
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.announce = announce;
|
this.announce = announce;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Obtain the results of the project's file feed
|
// Obtain the results of the project's file feed
|
||||||
url = new URL(DBOUrl + slug + "/files.rss");
|
url = new URL(DBOUrl + slug + "/files.rss");
|
||||||
}
|
}
|
||||||
catch (MalformedURLException ex)
|
catch (MalformedURLException ex)
|
||||||
{
|
{
|
||||||
// The slug doesn't exist
|
// The slug doesn't exist
|
||||||
plugin.getLogger().warning("The author of this plugin has misconfigured their Auto Update system");
|
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.
|
* Get the result of the update process.
|
||||||
*/
|
*/
|
||||||
public Updater.UpdateResult getResult()
|
public Updater.UpdateResult getResult()
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the total bytes of the file (can only be used after running a version check or a normal run).
|
* Get the total bytes of the file (can only be used after running a version check or a normal run).
|
||||||
*/
|
*/
|
||||||
public long getFileSize()
|
public long getFileSize()
|
||||||
{
|
{
|
||||||
return totalSize;
|
return totalSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the version string latest file avaliable online.
|
* Get the version string latest file avaliable online.
|
||||||
*/
|
*/
|
||||||
public String getLatestVersionString()
|
public String getLatestVersionString()
|
||||||
{
|
{
|
||||||
return versionTitle;
|
return versionTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save an update from dev.bukkit.org into the server's update folder.
|
* Save an update from dev.bukkit.org into the server's update folder.
|
||||||
*/
|
*/
|
||||||
private void saveFile(File folder, String file, String u)
|
private void saveFile(File folder, String file, String u)
|
||||||
{
|
{
|
||||||
if(!folder.exists())
|
if(!folder.exists())
|
||||||
@@ -312,7 +312,7 @@ public class Updater
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
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;
|
result = Updater.UpdateResult.FAIL_DOWNLOAD;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
@@ -329,15 +329,15 @@ public class Updater
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Part of Zip-File-Extractor, modified by H31IX for use with Bukkit
|
* Part of Zip-File-Extractor, modified by H31IX for use with Bukkit
|
||||||
*/
|
*/
|
||||||
private void unzip(String file)
|
private void unzip(String file)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -356,12 +356,12 @@ public class Updater
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BufferedInputStream bis = new BufferedInputStream(zipFile.getInputStream(entry));
|
BufferedInputStream bis = new BufferedInputStream(zipFile.getInputStream(entry));
|
||||||
int b;
|
int b;
|
||||||
byte buffer[] = new byte[BYTE_SIZE];
|
byte buffer[] = new byte[BYTE_SIZE];
|
||||||
FileOutputStream fos = new FileOutputStream(destinationFilePath);
|
FileOutputStream fos = new FileOutputStream(destinationFilePath);
|
||||||
BufferedOutputStream bos = new BufferedOutputStream(fos, BYTE_SIZE);
|
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);
|
bos.write(buffer, 0, b);
|
||||||
}
|
}
|
||||||
@@ -421,15 +421,15 @@ public class Updater
|
|||||||
catch(IOException ex)
|
catch(IOException ex)
|
||||||
{
|
{
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
plugin.getLogger().warning("The auto-updater tried to unzip a new update file, but was unsuccessful.");
|
plugin.getLogger().warning("The auto-updater tried to unzip a new update file, but was unsuccessful.");
|
||||||
result = Updater.UpdateResult.FAIL_DOWNLOAD;
|
result = Updater.UpdateResult.FAIL_DOWNLOAD;
|
||||||
}
|
}
|
||||||
new File(file).delete();
|
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.
|
* 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)
|
public boolean pluginFile(String name)
|
||||||
{
|
{
|
||||||
for(File file : new File("plugins").listFiles())
|
for(File file : new File("plugins").listFiles())
|
||||||
@@ -440,11 +440,11 @@ public class Updater
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtain the direct download file url from the file's page.
|
* Obtain the direct download file url from the file's page.
|
||||||
*/
|
*/
|
||||||
private String getFile(String link)
|
private String getFile(String link)
|
||||||
{
|
{
|
||||||
String download = null;
|
String download = null;
|
||||||
@@ -455,7 +455,7 @@ public class Updater
|
|||||||
URLConnection urlConn = url.openConnection();
|
URLConnection urlConn = url.openConnection();
|
||||||
InputStreamReader inStream = new InputStreamReader(urlConn.getInputStream());
|
InputStreamReader inStream = new InputStreamReader(urlConn.getInputStream());
|
||||||
BufferedReader buff = new BufferedReader(inStream);
|
BufferedReader buff = new BufferedReader(inStream);
|
||||||
|
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
String line;
|
String line;
|
||||||
while((line = buff.readLine()) != null)
|
while((line = buff.readLine()) != null)
|
||||||
@@ -490,11 +490,11 @@ public class Updater
|
|||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
plugin.getLogger().warning("The auto-updater tried to contact dev.bukkit.org, but was unsuccessful.");
|
plugin.getLogger().warning("The auto-updater tried to contact dev.bukkit.org, but was unsuccessful.");
|
||||||
result = Updater.UpdateResult.FAIL_DBO;
|
result = Updater.UpdateResult.FAIL_DBO;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return download;
|
return download;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check to see if the program should continue by evaluation whether the plugin is already updated, or shouldn't be updated
|
* 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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Evaluate whether the version number is marked showing that it should not be updated by this program
|
* Evaluate whether the version number is marked showing that it should not be updated by this program
|
||||||
*/
|
*/
|
||||||
private boolean hasTag(String version, String remoteVersion)
|
private boolean hasTag(String version, String remoteVersion)
|
||||||
{
|
{
|
||||||
for(String string : noUpdateTag)
|
for(String string : noUpdateTag)
|
||||||
@@ -548,14 +548,14 @@ public class Updater
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Part of RSS Reader by Vogella, modified by H31IX for use with Bukkit
|
* Part of RSS Reader by Vogella, modified by H31IX for use with Bukkit
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("null")
|
@SuppressWarnings("null")
|
||||||
private void readFeed()
|
private void readFeed()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Set header values intial to the empty string
|
// Set header values intial to the empty string
|
||||||
String title = "";
|
String title = "";
|
||||||
@@ -566,27 +566,27 @@ public class Updater
|
|||||||
InputStream in = read();
|
InputStream in = read();
|
||||||
XMLEventReader eventReader = inputFactory.createXMLEventReader(in);
|
XMLEventReader eventReader = inputFactory.createXMLEventReader(in);
|
||||||
// Read the XML document
|
// Read the XML document
|
||||||
while (eventReader.hasNext())
|
while (eventReader.hasNext())
|
||||||
{
|
{
|
||||||
XMLEvent event = eventReader.nextEvent();
|
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();
|
event = eventReader.nextEvent();
|
||||||
title = event.asCharacters().getData();
|
title = event.asCharacters().getData();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (event.asStartElement().getName().getLocalPart().equals(LINK))
|
if (event.asStartElement().getName().getLocalPart().equals(LINK))
|
||||||
{
|
{
|
||||||
event = eventReader.nextEvent();
|
event = eventReader.nextEvent();
|
||||||
link = event.asCharacters().getData();
|
link = event.asCharacters().getData();
|
||||||
continue;
|
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
|
// Store the title and link of the first entry we get - the first file on the list is all we need
|
||||||
versionTitle = title;
|
versionTitle = title;
|
||||||
@@ -596,25 +596,25 @@ public class Updater
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (XMLStreamException e)
|
|
||||||
{
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
}
|
||||||
}
|
catch (XMLStreamException e)
|
||||||
|
|
||||||
/**
|
|
||||||
* Open the RSS feed
|
|
||||||
*/
|
|
||||||
private InputStream read()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return url.openStream();
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
{
|
||||||
throw new RuntimeException(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(' ');
|
StringBuilder output = new StringBuilder().append(record.getMessage()).append(' ');
|
||||||
return output.toString();
|
return output.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -54,4 +54,4 @@ public class Distance
|
|||||||
{
|
{
|
||||||
return Math.abs(l1.getY() - l2.getY());
|
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);
|
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();
|
return output.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -40,4 +40,4 @@ System:
|
|||||||
# However, alerts will still be sent to console and to admins online, and events will still take place.
|
# However, alerts will still be sent to console and to admins online, and events will still take place.
|
||||||
Silent mode: false
|
Silent mode: false
|
||||||
# Should ops be exempt from all checks?
|
# Should ops be exempt from all checks?
|
||||||
Exempt op: false
|
Exempt op: false
|
||||||
@@ -75,4 +75,4 @@ INVENTORY_MAXVIOLATIONS: 2
|
|||||||
INVENTORY_MAXVIOLATIONTIME: 10000
|
INVENTORY_MAXVIOLATIONTIME: 10000
|
||||||
INVENTORY_TIMEMAX: 50
|
INVENTORY_TIMEMAX: 50
|
||||||
TIMER_STEP_CHECK: 50
|
TIMER_STEP_CHECK: 50
|
||||||
TIMER_TIMEMIN: 2000
|
TIMER_TIMEMIN: 2000
|
||||||
@@ -157,4 +157,4 @@ permissions:
|
|||||||
anticheat.check.visual: true
|
anticheat.check.visual: true
|
||||||
anticheat.check.vclip: true
|
anticheat.check.vclip: true
|
||||||
anticheat.check.fastinventory: true
|
anticheat.check.fastinventory: true
|
||||||
anticheat.check.autotool: true
|
anticheat.check.autotool: true
|
||||||
Reference in new issue
Block a user