mirror of
https://github.com/plexusorg/Plex.git
synced 2025-06-28 14:36:41 +00:00
Revamp the build system
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
package dev.plex;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import dev.plex.cache.DataUtils;
|
||||
import dev.plex.cache.PlayerCache;
|
||||
import dev.plex.config.Config;
|
||||
@ -18,13 +17,11 @@ import dev.plex.storage.punishment.SQLNotes;
|
||||
import dev.plex.storage.punishment.SQLPunishment;
|
||||
import dev.plex.util.*;
|
||||
import dev.plex.util.redis.MessageUtil;
|
||||
import dev.plex.util.sql.SQLUtil;
|
||||
import dev.plex.world.CustomWorld;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.milkbowl.vault.chat.Chat;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bstats.bukkit.Metrics;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
@ -46,7 +43,6 @@ public class Plex extends JavaPlugin
|
||||
public File modulesFolder;
|
||||
private StorageType storageType = StorageType.SQLITE;
|
||||
private SQLConnection sqlConnection;
|
||||
// private MongoConnection mongoConnection;
|
||||
private RedisConnection redisConnection;
|
||||
|
||||
private PlayerCache playerCache;
|
||||
|
@ -35,7 +35,7 @@ public class PlexCMD extends PlexCommand
|
||||
if (args.length == 0)
|
||||
{
|
||||
send(sender, mmString("<light_purple>Plex - A new freedom plugin."));
|
||||
send(sender, mmString("<light_purple>Plugin version: <gold>" + plugin.getDescription().getVersion() + " #" + BuildInfo.getNumber() + " <light_purple>Git: <gold>" + BuildInfo.getHead()));
|
||||
send(sender, mmString("<light_purple>Plugin version: <gold>" + plugin.getDescription().getVersion() + " #" + BuildInfo.getNumber() + " <light_purple>Git: <gold>" + BuildInfo.getCommit()));
|
||||
send(sender, mmString("<light_purple>Authors: <gold>Telesphoreo, Taahh"));
|
||||
send(sender, mmString("<light_purple>Built by: <gold>" + BuildInfo.getAuthor() + " <light_purple>on <gold>" + BuildInfo.getDate()));
|
||||
send(sender, mmString("<light_purple>Run <gold>/plex modules <light_purple>to see a list of modules."));
|
||||
|
@ -8,30 +8,30 @@ import java.util.Properties;
|
||||
|
||||
public class BuildInfo
|
||||
{
|
||||
@Getter
|
||||
public static String number;
|
||||
@Getter
|
||||
public static String author;
|
||||
@Getter
|
||||
public static String commit;
|
||||
@Getter
|
||||
public static String date;
|
||||
@Getter
|
||||
public static String head;
|
||||
public static String number;
|
||||
|
||||
public void load(Plex plugin)
|
||||
{
|
||||
try
|
||||
{
|
||||
Properties props;
|
||||
try (InputStream in = plugin.getResource("build.properties"))
|
||||
try (InputStream in = plugin.getResource("build-vars.properties"))
|
||||
{
|
||||
props = new Properties();
|
||||
props.load(in);
|
||||
}
|
||||
|
||||
author = props.getProperty("author", "unknown");
|
||||
commit = props.getProperty("gitCommit", "unknown");
|
||||
date = props.getProperty("date", "unknown");
|
||||
number = props.getProperty("buildNumber", "unknown");
|
||||
author = props.getProperty("buildAuthor", "unknown");
|
||||
date = props.getProperty("buildDate", "unknown");
|
||||
head = props.getProperty("buildHead", "unknown");
|
||||
}
|
||||
catch (Exception ignored)
|
||||
{
|
||||
|
@ -96,7 +96,7 @@ public class UpdateChecker implements PlexBase
|
||||
// If it's -4, it hasn't checked for updates yet
|
||||
if (distance == -4)
|
||||
{
|
||||
distance = fetchDistanceFromGitHub(REPO, BRANCH, BuildInfo.getHead());
|
||||
distance = fetchDistanceFromGitHub(REPO, BRANCH, BuildInfo.getCommit());
|
||||
PlexLog.debug("Never checked for updates, checking now...");
|
||||
}
|
||||
else
|
||||
@ -104,7 +104,7 @@ public class UpdateChecker implements PlexBase
|
||||
// If the request isn't asked to be cached, fetch it
|
||||
if (!cached)
|
||||
{
|
||||
distance = fetchDistanceFromGitHub(REPO, BRANCH, BuildInfo.getHead());
|
||||
distance = fetchDistanceFromGitHub(REPO, BRANCH, BuildInfo.getCommit());
|
||||
PlexLog.debug("We have checked for updates before, but this request was not asked to be cached.");
|
||||
}
|
||||
else
|
||||
|
10
server/src/main/resource-templates/build-vars.properties
Normal file
10
server/src/main/resource-templates/build-vars.properties
Normal file
@ -0,0 +1,10 @@
|
||||
author={{ author | default("unknown") }}
|
||||
|
||||
buildNumber={{ buildNumber }}
|
||||
|
||||
date={{ date }}
|
||||
|
||||
gitCommit={{ gitCommit | default("unknown") }}
|
||||
|
||||
gitHead={{ gitHead | default("unknown") }}
|
||||
|
Reference in New Issue
Block a user