mirror of
https://github.com/plexusorg/Plex.git
synced 2025-06-28 14:36:41 +00:00
Add build number
This commit is contained in:
@ -24,6 +24,8 @@ import dev.plex.util.PlexUtils;
|
||||
import dev.plex.util.UpdateChecker;
|
||||
import dev.plex.world.CustomWorld;
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
import java.util.UUID;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@ -219,4 +221,29 @@ public class Plex extends JavaPlugin
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static class BuildProperties
|
||||
{
|
||||
public String number;
|
||||
|
||||
public void load(Plex plugin)
|
||||
{
|
||||
try
|
||||
{
|
||||
final Properties props;
|
||||
|
||||
try (InputStream in = plugin.getResource("build.properties"))
|
||||
{
|
||||
props = new Properties();
|
||||
props.load(in);
|
||||
}
|
||||
|
||||
number = props.getProperty("buildNumber", "unknown");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
PlexLog.error("Could not load build properties! Did you compile with NetBeans/Maven?");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package dev.plex.command.impl;
|
||||
|
||||
import dev.plex.Plex;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
@ -24,6 +25,8 @@ import org.jetbrains.annotations.Nullable;
|
||||
public class PlexCMD extends PlexCommand
|
||||
{
|
||||
// Don't modify this command
|
||||
Plex.BuildProperties build = new Plex.BuildProperties();
|
||||
|
||||
@Override
|
||||
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args)
|
||||
{
|
||||
@ -32,6 +35,7 @@ public class PlexCMD extends PlexCommand
|
||||
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>Authors: <gold>Telesphoreo, Taahh"));
|
||||
send(sender, mmString("<light_purple>Build: <gold>" + build.number));
|
||||
send(sender, mmString("<light_purple>Run <gold>/plex modules <light_purple>to see a list of modules."));
|
||||
return null;
|
||||
}
|
||||
|
3
src/main/resources/build.properties
Normal file
3
src/main/resources/build.properties
Normal file
@ -0,0 +1,3 @@
|
||||
#Sat, 26 Mar 2022 16:36:02 -0500
|
||||
|
||||
buildNumber=unknown
|
Reference in New Issue
Block a user