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
3 files changed +10
-41
lines changed Original file line number Diff line number Diff line change 12
12
import java .util .OptionalInt ;
13
13
import net .kyori .adventure .key .Key ;
14
14
import net .kyori .adventure .text .Component ;
15
+ import net .kyori .adventure .text .serializer .plain .PlainTextComponentSerializer ;
15
16
import net .kyori .adventure .util .Services ;
16
17
import org .jetbrains .annotations .ApiStatus ;
17
18
import org .jetbrains .annotations .NotNull ;
@@ -102,10 +103,12 @@ final class Holder {
102
103
* @return a string
103
104
*/
104
105
// 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
+ }
106
109
107
110
@ NotNull
108
- default Component asComponent (final @ NotNull StringRepresentation representation ) { return Component . empty (); }
111
+ Component asComponent (final @ NotNull StringRepresentation representation );
109
112
110
113
/**
111
114
* String representation types.
Original file line number Diff line number Diff line change 24
24
import java .util .Map ;
25
25
import java .util .WeakHashMap ;
26
26
import java .util .jar .Manifest ;
27
+
27
28
import org .jetbrains .annotations .ApiStatus ;
28
29
import org .jetbrains .annotations .NotNull ;
29
30
import org .jetbrains .annotations .Nullable ;
30
31
31
32
/**
32
- * This is the jar manifest class.
33
- * It does manifest stuff.
33
+ * Internal class that is able to do {@link Manifest} stuff.
34
34
*/
35
35
@ ApiStatus .Internal
36
36
public final class JarManifests {
@@ -40,9 +40,9 @@ private JarManifests() {
40
40
private static final Map <ClassLoader , Manifest > MANIFESTS = Collections .synchronizedMap (new WeakHashMap <>());
41
41
42
42
/**
43
- * Manifest. It gets a manifest from a jar .
43
+ * Gets the {@link Manifest} from a class .
44
44
*
45
- * @param clazz the CLASS .
45
+ * @param clazz the class to get the {@link Manifest} from .
46
46
* @return the manifest or null.
47
47
*/
48
48
public static @ Nullable Manifest manifest (final @ NotNull Class <?> clazz ) {
Original file line number Diff line number Diff line change 37
37
import org .jetbrains .annotations .NotNull ;
38
38
39
39
/**
40
- * This is internal it does not need a javadoc CHECKSTYLE .
40
+ * Information about the current proxy build .
41
41
*/
42
42
@ AutoService (ServerBuildInfo .class )
43
43
public record ServerBuildInfoImpl (
@@ -94,40 +94,6 @@ public boolean isBrandCompatible(final @NotNull Key brandId) {
94
94
return brandId .equals (this .brandId );
95
95
}
96
96
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
-
131
97
@ Override
132
98
public @ NotNull Component asComponent (final @ NotNull StringRepresentation representation ) {
133
99
final TextComponent .Builder sb = text ();
You can’t perform that action at this time.
0 commit comments