mirror of
https://github.com/plexusorg/Plex.git
synced 2024-12-22 17:17:37 +00:00
fix it all
This commit is contained in:
parent
85f91b046b
commit
def38eed06
43
build.gradle
43
build.gradle
@ -41,10 +41,6 @@ group = "dev.plex"
|
|||||||
version = "0.10-SNAPSHOT"
|
version = "0.10-SNAPSHOT"
|
||||||
description = "Plex"
|
description = "Plex"
|
||||||
|
|
||||||
ext {
|
|
||||||
buildNumber = System.getenv("BUILD_NUMBER") ?: "unknown"
|
|
||||||
}
|
|
||||||
|
|
||||||
shadowJar {
|
shadowJar {
|
||||||
archiveClassifier.set("")
|
archiveClassifier.set("")
|
||||||
relocate "org.bstats", "dev.plex"
|
relocate "org.bstats", "dev.plex"
|
||||||
@ -60,9 +56,48 @@ bukkit {
|
|||||||
apiVersion = "1.18"
|
apiVersion = "1.18"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getGitHash() {
|
||||||
|
def stdout = new ByteArrayOutputStream()
|
||||||
|
try {
|
||||||
|
exec {
|
||||||
|
commandLine "git", "rev-parse", "--short", "HEAD"
|
||||||
|
standardOutput = stdout
|
||||||
|
ignoreExitValue = true
|
||||||
|
}
|
||||||
|
} catch (GradleException e) {
|
||||||
|
logger.error("Couldn't determine Git head because Git is not installed. " + e.getMessage())
|
||||||
|
}
|
||||||
|
return stdout.size() > 0 ? stdout.toString().trim() : "unknown"
|
||||||
|
}
|
||||||
|
|
||||||
|
String getBuildNumber() {
|
||||||
|
def stdout = new ByteArrayOutputStream()
|
||||||
|
try {
|
||||||
|
exec {
|
||||||
|
commandLine "git", "rev-list", "HEAD", "--count"
|
||||||
|
standardOutput = stdout
|
||||||
|
ignoreExitValue = true
|
||||||
|
}
|
||||||
|
} catch (GradleException e) {
|
||||||
|
logger.error("Couldn't determine build number because Git is not installed. " + e.getMessage())
|
||||||
|
}
|
||||||
|
return stdout.size() ? stdout.toString().trim() + " (local)" : "unknown"
|
||||||
|
}
|
||||||
|
|
||||||
|
static def getDate() {
|
||||||
|
return new Date().format("MM/dd/yyyy '<light_purple>at<gold>' hh:mm:ss a")
|
||||||
|
}
|
||||||
|
|
||||||
|
ext {
|
||||||
|
buildNumber = System.getenv("BUILD_NUMBER") + " (Jenkins)" ?: getBuildNumber()
|
||||||
|
}
|
||||||
|
|
||||||
task buildProperties {
|
task buildProperties {
|
||||||
ant.propertyfile(file: "$project.rootDir/src/main/resources/build.properties") {
|
ant.propertyfile(file: "$project.rootDir/src/main/resources/build.properties") {
|
||||||
|
entry(key: "buildAuthor", default: "unknown")
|
||||||
entry(key: "buildNumber", value: buildNumber)
|
entry(key: "buildNumber", value: buildNumber)
|
||||||
|
entry(key: "buildDate", value: getDate())
|
||||||
|
entry(key: "buildHead", value: getGitHash())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,6 +65,8 @@ public class Plex extends JavaPlugin
|
|||||||
|
|
||||||
private String system;
|
private String system;
|
||||||
|
|
||||||
|
public static final BuildProperties build = new BuildProperties();
|
||||||
|
|
||||||
public static Plex get()
|
public static Plex get()
|
||||||
{
|
{
|
||||||
return plugin;
|
return plugin;
|
||||||
@ -77,6 +79,7 @@ public class Plex extends JavaPlugin
|
|||||||
config = new Config(this, "config.yml");
|
config = new Config(this, "config.yml");
|
||||||
messages = new Config(this, "messages.yml");
|
messages = new Config(this, "messages.yml");
|
||||||
indefBans = new Config(this, "indefbans.yml");
|
indefBans = new Config(this, "indefbans.yml");
|
||||||
|
build.load(this);
|
||||||
|
|
||||||
modulesFolder = new File(this.getDataFolder() + File.separator + "modules");
|
modulesFolder = new File(this.getDataFolder() + File.separator + "modules");
|
||||||
if (!modulesFolder.exists())
|
if (!modulesFolder.exists())
|
||||||
@ -225,6 +228,9 @@ public class Plex extends JavaPlugin
|
|||||||
public static class BuildProperties
|
public static class BuildProperties
|
||||||
{
|
{
|
||||||
public String number;
|
public String number;
|
||||||
|
public String author;
|
||||||
|
public String date;
|
||||||
|
public String head;
|
||||||
|
|
||||||
public void load(Plex plugin)
|
public void load(Plex plugin)
|
||||||
{
|
{
|
||||||
@ -239,6 +245,9 @@ public class Plex extends JavaPlugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
number = props.getProperty("buildNumber", "unknown");
|
number = props.getProperty("buildNumber", "unknown");
|
||||||
|
author = props.getProperty("buildAuthor", "unknown");
|
||||||
|
date = props.getProperty("buildDate", "unknown");
|
||||||
|
head = props.getProperty("buildHead", "unknown");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -25,17 +25,15 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
public class PlexCMD extends PlexCommand
|
public class PlexCMD extends PlexCommand
|
||||||
{
|
{
|
||||||
// Don't modify this command
|
// Don't modify this command
|
||||||
Plex.BuildProperties build = new Plex.BuildProperties();
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args)
|
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args)
|
||||||
{
|
{
|
||||||
if (args.length == 0)
|
if (args.length == 0)
|
||||||
{
|
{
|
||||||
send(sender, mmString("<light_purple>Plex - A new freedom plugin."));
|
send(sender, mmString("<light_purple>Plex - A new freedom plugin."));
|
||||||
send(sender, mmString("<light_purple>Plugin version: <gold>" + plugin.getDescription().getVersion()));
|
send(sender, mmString("<light_purple>Plugin version: <gold>" + plugin.getDescription().getVersion() + " #" + Plex.build.number + " <light_purple>Git: <gold>" + Plex.build.head));
|
||||||
send(sender, mmString("<light_purple>Authors: <gold>Telesphoreo, Taahh"));
|
send(sender, mmString("<light_purple>Authors: <gold>Telesphoreo, Taahh"));
|
||||||
send(sender, mmString("<light_purple>Build: <gold>" + build.number));
|
send(sender, mmString("<light_purple>Built by: <gold>" + Plex.build.author + " <light_purple>on <gold>" + Plex.build.date));
|
||||||
send(sender, mmString("<light_purple>Run <gold>/plex modules <light_purple>to see a list of modules."));
|
send(sender, mmString("<light_purple>Run <gold>/plex modules <light_purple>to see a list of modules."));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user