File tree Expand file tree Collapse file tree 3 files changed +9
-42
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 +9
-42
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,11 @@ 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
107- @ NotNull
108- default Component asComponent (final @ NotNull StringRepresentation representation ) { return Component .empty (); }
110+ @ NotNull Component asComponent (final @ NotNull StringRepresentation representation );
109111
110112 /**
111113 * String representation types.
Original file line number Diff line number Diff line change 2929import org .jetbrains .annotations .Nullable ;
3030
3131/**
32- * This is the jar manifest class.
33- * It does manifest stuff.
32+ * Internal class that is able to do {@link Manifest} stuff.
3433 */
3534@ ApiStatus .Internal
3635public final class JarManifests {
@@ -40,9 +39,9 @@ private JarManifests() {
4039 private static final Map <ClassLoader , Manifest > MANIFESTS = Collections .synchronizedMap (new WeakHashMap <>());
4140
4241 /**
43- * Manifest. It gets a manifest from a jar .
42+ * Gets the {@link Manifest} from a class .
4443 *
45- * @param clazz the CLASS .
44+ * @param clazz the class to get the {@link Manifest} from .
4645 * @return the manifest or null.
4746 */
4847 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