Decided to not use auto-updating after all, since it's a pain in the ass

This commit is contained in:
Rammelkast committed 2016-05-30 19:51:16 +02:00
1 parent bd01cc376a
commit d04c27828f
4 files changed
+1 -87

No files matched your search

@@ -49,8 +49,6 @@ public class AntiCheat extends JavaPlugin {
private static AntiCheatManager manager;
private static AntiCheat plugin;
private static List<Listener> eventList = new ArrayList<Listener>();
private static boolean update = false;
private static String updateDetails = null;
private static Configuration config;
private static boolean verbose;
private static boolean developer;
@@ -73,7 +71,6 @@ public class AntiCheat extends JavaPlugin {
setupConfig();
setupEvents();
setupCommands();
setupUpdater();
setupProtocol();
// Enterprise must come before levels
setupEnterprise();
@@ -101,25 +98,6 @@ public class AntiCheat extends JavaPlugin {
KillAuraCheck.listenPackets();
}
private void setupUpdater() {
if (config.getConfig().autoUpdate.getValue()) {
final File file = this.getFile();
final Plugin plugin = this;
getServer().getScheduler().runTaskAsynchronously(this, new Runnable() {
@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.SUCCESS;
verboseLog("Update available: " + update);
if (update) {
updateDetails = updater.getLatestName() + " for " + updater.getLatestGameVersion();
}
}
});
}
}
@Override
public void onDisable() {
verboseLog("Saving user levels...");
@@ -184,14 +162,6 @@ public class AntiCheat extends JavaPlugin {
return manager;
}
public static boolean isUpdated() {
return !update;
}
public static String getUpdateDetails() {
return updateDetails;
}
public static String getVersion() {
return manager.getPlugin().getDescription().getVersion();
}
@@ -34,7 +34,6 @@ import net.gravitydevelopment.anticheat.command.executors.CommandReload;
import net.gravitydevelopment.anticheat.command.executors.CommandReport;
import net.gravitydevelopment.anticheat.command.executors.CommandReset;
import net.gravitydevelopment.anticheat.command.executors.CommandSpy;
import net.gravitydevelopment.anticheat.command.executors.CommandUpdate;
public class CommandHandler implements CommandExecutor {
@@ -50,7 +49,6 @@ public class CommandHandler implements CommandExecutor {
commands.add(new CommandReport());
commands.add(new CommandReset());
commands.add(new CommandSpy());
commands.add(new CommandUpdate());
}
@Override
@@ -1,54 +0,0 @@
/*
* AntiCheat for Bukkit.
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.gravitydevelopment.anticheat.command.executors;
import net.gravitydevelopment.anticheat.AntiCheat;
import net.gravitydevelopment.anticheat.command.CommandBase;
import net.gravitydevelopment.anticheat.util.Permission;
import org.bukkit.command.CommandSender;
public class CommandUpdate extends CommandBase {
private static final String NAME = "AntiCheat Update Checking";
private static final String COMMAND = "update";
private static final String USAGE = "anticheat update";
private static final Permission PERMISSION = Permission.SYSTEM_UPDATE;
private static final String[] HELP = {
GRAY + "Use: " + AQUA + "/anticheat update" + GRAY + " to view the system's update status",
};
public CommandUpdate() {
super(NAME, COMMAND, USAGE, HELP, PERMISSION);
}
@Override
protected void execute(CommandSender cs, String[] args) {
cs.sendMessage(GRAY + "Running AntiCheat v" + GREEN + AntiCheat.getVersion());
if (CONFIG.getConfig().autoUpdate.getValue()) {
cs.sendMessage(GRAY + "Up to date: " + (AntiCheat.isUpdated() ? GREEN + "YES" : RED + "NO"));
if (!AntiCheat.isUpdated()) {
cs.sendMessage(GRAY + "Newest version: " + GREEN + AntiCheat.getUpdateDetails());
cs.sendMessage(GOLD + "The newest version will be automatically installed on next launch.");
}
} else {
cs.sendMessage(GRAY + "Your config settings have disabled update checking.");
cs.sendMessage(GRAY + "Please enable this setting or visit http://dev.bukkit.org/bukkit-plugins/anticheatreloaded/");
}
}
}
@@ -116,7 +116,7 @@ public class PastebinReport {
private void appendSystemInfo() {
Runtime runtime = Runtime.getRuntime();
Configuration config = AntiCheat.getManager().getConfiguration();
append("AntiCheat Version: " + AntiCheat.getVersion() + (AntiCheat.isUpdated() ? "" : " (OUTDATED)"));
append("AntiCheat Version: " + AntiCheat.getVersion());
append("Server Version: " + Bukkit.getVersion());
append("Server Implementation: " + Bukkit.getName());
append("Server ID: " + Bukkit.getServerId());