File tree Expand file tree Collapse file tree 3 files changed +10
-41
lines changed
api/src/main/java/com/velocitypowered/api/util/buildinfo
proxy/src/main/java/com/velocitypowered/proxy/util Expand file tree Collapse file tree 3 files changed +10
-41
lines changed Original file line number Diff line number Diff line change 1212import java .util .OptionalInt ;
1313import net .kyori .adventure .key .Key ;
1414import net .kyori .adventure .text .Component ;
15+ import net .kyori .adventure .text .serializer .plain .PlainTextComponentSerializer ;
1516import net .kyori .adventure .util .Services ;
1617import org .jetbrains .annotations .ApiStatus ;
1718import org .jetbrains .annotations .NotNull ;
@@ -102,10 +103,12 @@ final class Holder {
102103 * @return a string
103104 */
104105 // This *could* be a PlainTextSerializer string of asComponent()?
105- @ NotNull String asString (final @ NotNull StringRepresentation representation );
106+ @ NotNull default String asString (final @ NotNull StringRepresentation representation ) {
107+ return PlainTextComponentSerializer .plainText ().serialize (asComponent (representation ));
108+ }
106109
107110 @ NotNull
108- default Component asComponent (final @ NotNull StringRepresentation representation ) { return Component . empty (); }
111+ Component asComponent (final @ NotNull StringRepresentation representation );
109112
110113 /**
111114 * String representation types.
Original file line number Diff line number Diff line change 2424import java .util .Map ;
2525import java .util .WeakHashMap ;
2626import java .util .jar .Manifest ;
27+
2728import org .jetbrains .annotations .ApiStatus ;
2829import org .jetbrains .annotations .NotNull ;
2930import org .jetbrains .annotations .Nullable ;
3031
3132/**
32- * This is the jar manifest class.
33- * It does manifest stuff.
33+ * Internal class that is able to do {@link Manifest} stuff.
3434 */
3535@ ApiStatus .Internal
3636public final class JarManifests {
@@ -40,9 +40,9 @@ private JarManifests() {
4040 private static final Map <ClassLoader , Manifest > MANIFESTS = Collections .synchronizedMap (new WeakHashMap <>());
4141
4242 /**
43- * Manifest. It gets a manifest from a jar .
43+ * Gets the {@link Manifest} from a class .
4444 *
45- * @param clazz the CLASS .
45+ * @param clazz the class to get the {@link Manifest} from .
4646 * @return the manifest or null.
4747 */
4848 public static @ Nullable Manifest manifest (final @ NotNull Class <?> clazz ) {
Original file line number Diff line number Diff line change 3737import org .jetbrains .annotations .NotNull ;
3838
3939/**
40- * This is internal it does not need a javadoc CHECKSTYLE .
40+ * Information about the current proxy build .
4141 */
4242@ AutoService (ServerBuildInfo .class )
4343public record ServerBuildInfoImpl (
@@ -94,40 +94,6 @@ public boolean isBrandCompatible(final @NotNull Key brandId) {
9494 return brandId .equals (this .brandId );
9595 }
9696
97- @ Override
98- public @ NotNull String asString (final @ NotNull StringRepresentation representation ) {
99- final StringBuilder sb = new StringBuilder ();
100- sb .append (this .velocityVersionName );
101- sb .append ('-' );
102- final OptionalInt buildNumber = this .buildNumber ;
103- if (buildNumber .isPresent ()) {
104- sb .append (buildNumber .getAsInt ());
105- } else {
106- sb .append (BUILD_DEV );
107- }
108- final boolean hasGitBranch = this .gitBranch .isPresent ();
109- final boolean hasGitCommit = this .gitCommit .isPresent ();
110- if (hasGitBranch || hasGitCommit ) {
111- sb .append ('-' );
112- }
113- if (hasGitBranch && representation == StringRepresentation .VERSION_FULL ) {
114- sb .append (this .gitBranch .get ());
115- if (hasGitCommit ) {
116- sb .append ('@' );
117- }
118- }
119- if (hasGitCommit ) {
120- sb .append (this .gitCommit .get ());
121- }
122- if (representation == StringRepresentation .VERSION_FULL ) {
123- sb .append (' ' );
124- sb .append ('(' );
125- sb .append (this .buildTime .truncatedTo (ChronoUnit .SECONDS ));
126- sb .append (')' );
127- }
128- return sb .toString ();
129- }
130-
13197 @ Override
13298 public @ NotNull Component asComponent (final @ NotNull StringRepresentation representation ) {
13399 final TextComponent .Builder sb = text ();
You can’t perform that action at this time.
0 commit comments