Remove version checks and donation key handling
This commit is contained in:
parent
b04735a0c5
commit
422fbd1483
6 changed files with 5 additions and 91 deletions
|
|
@ -120,12 +120,7 @@ public class CommandHandler implements CommandExecutor {
|
|||
NetworkDebugCommand.runCommand(user, permission, argumentArray);
|
||||
}
|
||||
else if (corecommand.equals("migrate-db")) {
|
||||
if (!VersionUtils.validDonationKey()) {
|
||||
Chat.sendMessage(user, Color.DARK_AQUA + "Griefus " + Color.WHITE + "- " + Phrase.build(Phrase.DONATION_KEY_REQUIRED));
|
||||
}
|
||||
else {
|
||||
Extensions.runDatabaseMigration(corecommand, user, argumentArray);
|
||||
}
|
||||
Extensions.runDatabaseMigration(corecommand, user, argumentArray);
|
||||
}
|
||||
else {
|
||||
Chat.sendMessage(user, Color.DARK_AQUA + "Griefus " + Color.WHITE + "- " + Phrase.build(Phrase.COMMAND_NOT_FOUND, Color.WHITE, "/co " + corecommand));
|
||||
|
|
@ -135,35 +130,6 @@ public class CommandHandler implements CommandExecutor {
|
|||
Chat.sendMessage(user, Color.DARK_AQUA + "Griefus " + Color.WHITE + "- " + Phrase.build(Phrase.MISSING_PARAMETERS, Color.WHITE, "/co <parameters>"));
|
||||
}
|
||||
|
||||
if (user.isOp() && versionAlert.get(user.getName()) == null) {
|
||||
String latestVersion = NetworkHandler.latestVersion();
|
||||
String latestEdgeVersion = NetworkHandler.latestEdgeVersion();
|
||||
if (latestVersion != null || latestEdgeVersion != null) {
|
||||
versionAlert.put(user.getName(), true);
|
||||
class updateAlert implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
Chat.sendMessage(user, Color.WHITE + "----- " + Color.DARK_AQUA + Phrase.build(Phrase.UPDATE_HEADER, "Griefus" + (VersionUtils.isCommunityEdition() ? " " + ConfigHandler.COMMUNITY_EDITION : "")) + Color.WHITE + " -----");
|
||||
if (latestVersion != null) {
|
||||
Chat.sendMessage(user, Color.DARK_AQUA + Phrase.build(Phrase.UPDATE_NOTICE, Color.WHITE, "Griefus CE v" + latestVersion));
|
||||
Chat.sendMessage(user, Color.DARK_AQUA + Phrase.build(Phrase.LINK_DOWNLOAD, Color.WHITE, "www.griefus.zhdev.org/download/"));
|
||||
}
|
||||
else if (!VersionUtils.isCommunityEdition()) {
|
||||
Chat.sendMessage(user, Color.DARK_AQUA + Phrase.build(Phrase.UPDATE_NOTICE, Color.WHITE, "Griefus v" + latestEdgeVersion));
|
||||
Chat.sendMessage(user, Color.DARK_AQUA + Phrase.build(Phrase.LINK_DOWNLOAD, Color.WHITE, "www.griefus.zhdev.org/latest/"));
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
(new Thread(new updateAlert())).start();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,11 +14,9 @@ import net.coreprotect.consumer.process.Process;
|
|||
import net.coreprotect.language.Phrase;
|
||||
import net.coreprotect.language.Selector;
|
||||
import net.coreprotect.patch.Patch;
|
||||
import net.coreprotect.thread.NetworkHandler;
|
||||
import net.coreprotect.utility.Chat;
|
||||
import net.coreprotect.utility.Color;
|
||||
import net.coreprotect.utility.SystemUtils;
|
||||
import net.coreprotect.utility.VersionUtils;
|
||||
|
||||
public class StatusCommand {
|
||||
private static ConcurrentHashMap<String, Boolean> alert = new ConcurrentHashMap<>();
|
||||
|
|
@ -36,28 +34,8 @@ public class StatusCommand {
|
|||
CoreProtect instance = CoreProtect.getInstance();
|
||||
PluginDescriptionFile pdfFile = instance.getDescription();
|
||||
|
||||
String versionCheck = "";
|
||||
if (Config.getGlobal().CHECK_UPDATES) {
|
||||
String latestVersion = NetworkHandler.latestVersion();
|
||||
String latestEdgeVersion = NetworkHandler.latestEdgeVersion();
|
||||
if (latestVersion != null) {
|
||||
versionCheck = " (" + Phrase.build(Phrase.LATEST_VERSION, "v" + latestVersion) + ")";
|
||||
}
|
||||
else if (latestEdgeVersion != null && !VersionUtils.isCommunityEdition()) {
|
||||
versionCheck = " (" + Phrase.build(Phrase.LATEST_VERSION, "v" + latestEdgeVersion) + ")";
|
||||
}
|
||||
}
|
||||
|
||||
Chat.sendMessage(player, Color.WHITE + "----- " + Color.DARK_AQUA + "Griefus" + (VersionUtils.isCommunityEdition() ? " " + ConfigHandler.COMMUNITY_EDITION : "") + Color.WHITE + " -----");
|
||||
Chat.sendMessage(player, Color.DARK_AQUA + Phrase.build(Phrase.STATUS_VERSION, Color.WHITE, ConfigHandler.EDITION_NAME + " v" + pdfFile.getVersion() + ".") + versionCheck);
|
||||
|
||||
String donationKey = NetworkHandler.donationKey();
|
||||
if (donationKey != null) {
|
||||
Chat.sendMessage(player, Color.DARK_AQUA + Phrase.build(Phrase.STATUS_LICENSE, Color.WHITE, Phrase.build(Phrase.VALID_DONATION_KEY)) + " (" + donationKey + ")");
|
||||
}
|
||||
else {
|
||||
Chat.sendMessage(player, Color.DARK_AQUA + Phrase.build(Phrase.STATUS_LICENSE, Color.WHITE, Phrase.build(Phrase.INVALID_DONATION_KEY)) + Color.GREY + Color.ITALIC + " (" + Phrase.build(Phrase.CHECK_CONFIG) + ")");
|
||||
}
|
||||
Chat.sendMessage(player, Color.WHITE + "----- " + Color.DARK_AQUA + "Griefus" + Color.WHITE + " -----");
|
||||
Chat.sendMessage(player, Color.DARK_AQUA + Phrase.build(Phrase.STATUS_VERSION, Color.WHITE, ConfigHandler.EDITION_NAME + " v" + pdfFile.getVersion()));
|
||||
|
||||
/*
|
||||
Items processed (since server start)
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@ public class ConfigHandler extends Queue {
|
|||
public static final int EDITION_VERSION = 2;
|
||||
public static final String EDITION_BRANCH = VersionUtils.getBranch();
|
||||
public static final String EDITION_NAME = VersionUtils.getPluginName();
|
||||
public static final String COMMUNITY_EDITION = "Community Edition";
|
||||
public static final String JAVA_VERSION = "11.0";
|
||||
public static final String MINECRAFT_VERSION = "1.16";
|
||||
public static final String PATCH_VERSION = "23.0";
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public class VersionCheckService {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (VersionUtils.newVersion(ConfigHandler.LATEST_VERSION, bukkitVersion[0] + "." + bukkitVersion[1] + (bukkitVersion.length > 2 && bukkitVersion[2].matches("\\d+") ? "." + bukkitVersion[2] : "")) && VersionUtils.isCommunityEdition()) {
|
||||
if (VersionUtils.newVersion(ConfigHandler.LATEST_VERSION, bukkitVersion[0] + "." + bukkitVersion[1] + (bukkitVersion.length > 2 && bukkitVersion[2].matches("\\d+") ? "." + bukkitVersion[2] : ""))) {
|
||||
Chat.console(Phrase.build(Phrase.VERSION_INCOMPATIBLE, "Minecraft", bukkitVersion[0] + "." + bukkitVersion[1] + (bukkitVersion.length > 2 ? "." + bukkitVersion[2] : "")));
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,22 +39,12 @@ public class NetworkHandler extends Language implements Runnable {
|
|||
private boolean startup = true;
|
||||
private boolean background = false;
|
||||
private boolean translate = true;
|
||||
private static String latestVersion = null;
|
||||
private static String latestEdgeVersion = null;
|
||||
|
||||
public NetworkHandler(boolean startup, boolean background) {
|
||||
this.startup = startup;
|
||||
this.background = background;
|
||||
}
|
||||
|
||||
public static String latestVersion() {
|
||||
return latestVersion;
|
||||
}
|
||||
|
||||
public static String latestEdgeVersion() {
|
||||
return latestEdgeVersion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import org.bukkit.plugin.Plugin;
|
|||
import net.coreprotect.CoreProtect;
|
||||
import net.coreprotect.config.ConfigHandler;
|
||||
import net.coreprotect.language.Phrase;
|
||||
import net.coreprotect.thread.NetworkHandler;
|
||||
import net.coreprotect.worldedit.CoreProtectEditSessionEvent;
|
||||
|
||||
public class VersionUtils {
|
||||
|
|
@ -57,17 +56,7 @@ public class VersionUtils {
|
|||
return "Griefus";
|
||||
}
|
||||
|
||||
String name = instance.getDescription().getName();
|
||||
String branch = ConfigHandler.EDITION_BRANCH;
|
||||
|
||||
if (branch.startsWith("-edge")) {
|
||||
name = name + " " + branch.substring(1, 2).toUpperCase() + branch.substring(2, 5);
|
||||
}
|
||||
else if (isCommunityEdition()) {
|
||||
name = name + " " + ConfigHandler.COMMUNITY_EDITION;
|
||||
}
|
||||
|
||||
return name;
|
||||
return instance.getDescription().getName();
|
||||
}
|
||||
|
||||
public static boolean isSpigot() {
|
||||
|
|
@ -103,18 +92,10 @@ public class VersionUtils {
|
|||
return true;
|
||||
}
|
||||
|
||||
public static boolean isCommunityEdition() {
|
||||
return !isBranch("edge") && !isBranch("coreprotect") && !validDonationKey();
|
||||
}
|
||||
|
||||
public static boolean isBranch(String branch) {
|
||||
return ConfigHandler.EDITION_BRANCH.contains("-" + branch);
|
||||
}
|
||||
|
||||
public static boolean validDonationKey() {
|
||||
return NetworkHandler.donationKey() != null;
|
||||
}
|
||||
|
||||
public static String getBranch() {
|
||||
String branch = "";
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue