mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-02 22:16:03 +00:00
Minor improvements and threaded updating
This commit is contained in:
1 parent
e4d932e211
commit
bce27eb805
2 files changed
+17
-11
No files matched your search
@@ -32,8 +32,10 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -143,10 +145,17 @@ public class AntiCheat extends JavaPlugin {
|
|||||||
|
|
||||||
private void setupUpdater() {
|
private void setupUpdater() {
|
||||||
if (config.getConfig().autoUpdate.getValue()) {
|
if (config.getConfig().autoUpdate.getValue()) {
|
||||||
verboseLog("Checking for a new update...");
|
final File file = this.getFile();
|
||||||
Updater updater = new Updater(this, PROJECT_ID, this.getFile(), Updater.UpdateType.DEFAULT, false);
|
final Plugin plugin = this;
|
||||||
update = updater.getResult() != Updater.UpdateResult.NO_UPDATE;
|
getServer().getScheduler().runTaskAsynchronously(this, new Runnable() {
|
||||||
verboseLog("Update available: " + update);
|
@Override
|
||||||
|
public void run() {
|
||||||
|
verboseLog("Checking for a new update...");
|
||||||
|
Updater updater = new Updater(plugin, PROJECT_ID, file, Updater.UpdateType.DEFAULT, false);
|
||||||
|
update = updater.getResult() != Updater.UpdateResult.NO_UPDATE;
|
||||||
|
verboseLog("Update available: " + update);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -334,13 +334,12 @@ public final class Utilities {
|
|||||||
* @return true if int
|
* @return true if int
|
||||||
*/
|
*/
|
||||||
public static boolean isInt(String string) {
|
public static boolean isInt(String string) {
|
||||||
boolean x = false;
|
|
||||||
try {
|
try {
|
||||||
Integer.parseInt(string);
|
Integer.parseInt(string);
|
||||||
x = true;
|
return true;
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return x;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -454,10 +453,8 @@ public final class Utilities {
|
|||||||
* @param string the string to parse
|
* @param string the string to parse
|
||||||
* @return ArrayList with string
|
* @return ArrayList with string
|
||||||
*/
|
*/
|
||||||
public static ArrayList<String> stringToList(String string) {
|
public static ArrayList<String> stringToList(final String string) {
|
||||||
ArrayList<String> i = new ArrayList<String>();
|
return new ArrayList<String>() {{ add(string); }};
|
||||||
i.add(string);
|
|
||||||
return i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in new issue
Block a user