Added support for Community Edition builds

This commit is contained in:
Intelli 2024-08-19 20:55:35 -06:00
parent cff6be6d90
commit c493a0dece
4 changed files with 20 additions and 2 deletions

View File

@ -1290,7 +1290,7 @@ public class CommandHandler implements CommandExecutor {
public void run() {
try {
Thread.sleep(5000);
Chat.sendMessage(user, Color.WHITE + "----- " + Color.DARK_AQUA + Phrase.build(Phrase.UPDATE_HEADER, "CoreProtect") + Color.WHITE + " -----");
Chat.sendMessage(user, Color.WHITE + "----- " + Color.DARK_AQUA + Phrase.build(Phrase.UPDATE_HEADER, "CoreProtect" + (Util.isCommunityEdition() ? " " + ConfigHandler.COMMUNITY_EDITION : "")) + Color.WHITE + " -----");
Chat.sendMessage(user, Color.DARK_AQUA + Phrase.build(Phrase.UPDATE_NOTICE, Color.WHITE, "CoreProtect v" + latestVersion));
Chat.sendMessage(user, Color.DARK_AQUA + Phrase.build(Phrase.LINK_DOWNLOAD, Color.WHITE, "www.coreprotect.net/download/"));
}

View File

@ -17,6 +17,7 @@ import net.coreprotect.patch.Patch;
import net.coreprotect.thread.NetworkHandler;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.Color;
import net.coreprotect.utility.Util;
public class StatusCommand {
private static ConcurrentHashMap<String, Boolean> alert = new ConcurrentHashMap<>();
@ -42,7 +43,7 @@ public class StatusCommand {
}
}
Chat.sendMessage(player, Color.WHITE + "----- " + Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "-----");
Chat.sendMessage(player, Color.WHITE + "----- " + Color.DARK_AQUA + "CoreProtect" + (Util.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();

View File

@ -43,6 +43,7 @@ public class ConfigHandler extends Queue {
public static final int EDITION_VERSION = 2;
public static final String EDITION_BRANCH = Util.getBranch();
public static final String EDITION_NAME = Util.getPluginName();
public static final String COMMUNITY_EDITION = "Community Edition";
public static final String JAVA_VERSION = "11.0";
public static final String SPIGOT_VERSION = "1.15";
public static String path = "plugins/CoreProtect/";

View File

@ -63,6 +63,7 @@ import net.coreprotect.database.rollback.Rollback;
import net.coreprotect.language.Phrase;
import net.coreprotect.model.BlockGroup;
import net.coreprotect.thread.CacheHandler;
import net.coreprotect.thread.NetworkHandler;
import net.coreprotect.thread.Scheduler;
import net.coreprotect.utility.serialize.ItemMetaHandler;
import net.coreprotect.worldedit.CoreProtectEditSessionEvent;
@ -112,6 +113,9 @@ public class Util extends Queue {
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;
}
@ -1385,6 +1389,18 @@ public class Util extends Queue {
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 {