Skip to content

Commit 0328028

Browse files
committed
slightly different javadoc
1 parent 45146b9 commit 0328028

File tree

3 files changed

+10
-41
lines changed

3 files changed

+10
-41
lines changed

api/src/main/java/com/velocitypowered/api/util/buildinfo/ServerBuildInfo.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import java.util.OptionalInt;
1313
import net.kyori.adventure.key.Key;
1414
import net.kyori.adventure.text.Component;
15+
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
1516
import net.kyori.adventure.util.Services;
1617
import org.jetbrains.annotations.ApiStatus;
1718
import 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.

proxy/src/main/java/com/velocitypowered/proxy/util/JarManifests.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@
2424
import java.util.Map;
2525
import java.util.WeakHashMap;
2626
import java.util.jar.Manifest;
27+
2728
import org.jetbrains.annotations.ApiStatus;
2829
import org.jetbrains.annotations.NotNull;
2930
import 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
3636
public 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) {

proxy/src/main/java/com/velocitypowered/proxy/util/buildinfo/ServerBuildInfoImpl.java

+1-35
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
import 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)
4343
public 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();

0 commit comments

Comments
 (0)