mirror of
https://github.com/Melledy/LunarCore.git
synced 2025-12-16 15:24:44 +01:00
Show git hash when starting the server
This commit is contained in:
@@ -59,6 +59,7 @@ public class LunarCore {
|
||||
public static void main(String[] args) {
|
||||
// Start Server
|
||||
LunarCore.getLogger().info("Starting Lunar Core...");
|
||||
LunarCore.getLogger().info("Git hash: " + getGitHash());
|
||||
LunarCore.getLogger().info("Game version: " + GameConstants.VERSION);
|
||||
boolean generateHandbook = true;
|
||||
|
||||
@@ -168,6 +169,19 @@ public class LunarCore {
|
||||
getLogger().error("Config save error");
|
||||
}
|
||||
}
|
||||
|
||||
// Git hash
|
||||
|
||||
private static String getGitHash() {
|
||||
// Safely get the build config without errors even if it hasnt been generated yet
|
||||
try {
|
||||
Class<?> buildConfig = Class.forName("emu.lunarcore.BuildConfig");
|
||||
return buildConfig.getField("GIT_HASH").get(null).toString();
|
||||
} catch (Exception e) {
|
||||
// Ignored
|
||||
}
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
// Server console
|
||||
|
||||
|
||||
Reference in New Issue
Block a user