9
0
mirror of https://github.com/Dreeam-qwq/Gale.git synced 2025-12-21 07:49:22 +00:00
Files
Gale/patches/server/0007-Gale-semantic-version.patch
2024-06-21 11:23:41 +08:00

73 lines
3.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martijn Muijsers <martijnmuijsers@live.nl>
Date: Wed, 9 Aug 2023 19:04:22 +0200
Subject: [PATCH] Gale semantic version
License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
Gale - https://galemc.org
diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java
index 7e1405d5e2b847b28b07cb94fcbf5dec78706e34..66477f772ffb9271cf647dfb7567d75c3d5145fb 100644
--- a/src/main/java/com/destroystokyo/paper/Metrics.java
+++ b/src/main/java/com/destroystokyo/paper/Metrics.java
@@ -923,6 +923,16 @@ public class Metrics {
}));
// Gale end - metrics - runtime max memory
+ // Gale start - semantic version - include in metrics
+ Map<String, Map<String, Integer>> semanticVersionMap = new HashMap<>(2);
+ {
+ Map<String, Integer> entry = new HashMap<>(2);
+ entry.put(org.galemc.gale.version.GaleSemanticVersion.version, 1);
+ semanticVersionMap.put(org.galemc.gale.version.GaleSemanticVersion.majorMinorVersion, entry);
+ }
+ metrics.addCustomChart(new Metrics.DrilldownPie("gale_semantic_version", () -> semanticVersionMap));
+ // Gale end - semantic version - include in metrics
+
}
}
diff --git a/src/main/java/org/galemc/gale/version/GaleSemanticVersion.java b/src/main/java/org/galemc/gale/version/GaleSemanticVersion.java
new file mode 100644
index 0000000000000000000000000000000000000000..f873cac7566e1951fc2977d6f7c4ba3cefa1a9f1
--- /dev/null
+++ b/src/main/java/org/galemc/gale/version/GaleSemanticVersion.java
@@ -0,0 +1,37 @@
+// Gale - semantic version
+
+package org.galemc.gale.version;
+
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * A holder for the Gale semantic version.
+ */
+public final class GaleSemanticVersion {
+
+ private GaleSemanticVersion() {
+ throw new RuntimeException();
+ }
+
+ /**
+ * A semantic version in the format "<code>major.minor.patch</code>", for example "<code>1.5.1</code>".
+ * The <code>major</code> version is incremented when a large and overarching set of features, with a large
+ * and overarching common goal or effect, has been added compared to the first release with that major version.
+ * The <code>minor</code> version is incremented for each build that has a different intended feature set
+ * (for example, some features or part of them were added or removed).
+ * The <code>patch</code> version is incremented for small changes that do not affect the goal of any feature,
+ * such as bug fixes, performance improvements or changes in wording.
+ */
+ public static final @NotNull String version = "0.6.15";
+
+ /**
+ * The "<code>major.minor</code>" portion of the {@link #version}.
+ */
+ public static final @NotNull String majorMinorVersion;
+ static {
+ int firstDotIndex = version.indexOf('.');
+ int secondDotIndex = version.indexOf('.', firstDotIndex + 1);
+ majorMinorVersion = version.substring(0, secondDotIndex);
+ }
+
+}