Skip to content

Commit

Permalink
Update version table format
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexProgrammerDE committed Oct 15, 2024
1 parent 4a4da64 commit 826c674
Showing 1 changed file with 12 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -649,30 +649,25 @@ public void postConstruct() {
.executes(
privateCommand(
c -> {
var yesEmoji = "✅";
var noEmoji = "❌";

var builder = new StringBuilder("\n");
ProtocolVersionList.getProtocolsNewToOld()
.forEach(
version -> {
var versionId = "%s\\|%d".formatted(version.getVersionType().name(), version.getOriginalVersion());
var nativeVersion =
SFVersionConstants.CURRENT_PROTOCOL_VERSION == version
? yesEmoji
: noEmoji;
var bedrockVersion =
SFVersionConstants.isBedrock(version) ? yesEmoji : noEmoji;
var javaVersion =
!SFVersionConstants.isBedrock(version) ? yesEmoji : noEmoji;
var snapshotVersion =
SFVersionConstants.isAprilFools(version) ? yesEmoji : noEmoji;
var legacyVersion =
SFVersionConstants.isLegacy(version) ? yesEmoji : noEmoji;
String type;
if (SFVersionConstants.isBedrock(version)) {
type = "BEDROCK";
} else if (SFVersionConstants.isLegacy(version)) {
type = "LEGACY";
} else if (SFVersionConstants.isAprilFools(version)) {
type = "SNAPSHOT";
} else {
type = "JAVA";
}

builder.append(
"| `%s` | `%s` | %s | %s | %s | %s | %s |\n".formatted(version.getName(), versionId, nativeVersion, javaVersion,
snapshotVersion, legacyVersion, bedrockVersion));
"| `%s`%s | `%s` | `%s` |\n".formatted(version.getName(), SFVersionConstants.CURRENT_PROTOCOL_VERSION == version
? " (native)" : "", versionId, type));
});
c.getSource().sendInfo(builder.toString());

Expand Down

0 comments on commit 826c674

Please sign in to comment.