3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-17 05:20:14 +01:00

Update /velocity version so implementation stuff can be changed.

Dieser Commit ist enthalten in:
Andrew Steinborn 2018-10-25 01:56:41 -04:00
Ursprung c977ddec61
Commit 3f612fb5c2
2 geänderte Dateien mit 24 neuen und 17 gelöschten Zeilen

Datei anzeigen

@ -18,7 +18,9 @@ jar {
def version = "${project.version} (git-${project.ext.getCurrentShortRevision()}-b${buildNumber})" def version = "${project.version} (git-${project.ext.getCurrentShortRevision()}-b${buildNumber})"
attributes 'Main-Class': 'com.velocitypowered.proxy.Velocity' attributes 'Main-Class': 'com.velocitypowered.proxy.Velocity'
attributes 'Implementation-Title': "Velocity"
attributes 'Implementation-Version': version attributes 'Implementation-Version': version
attributes 'Implementation-Vendor': "Velocity Contributors"
} }
} }

Datei anzeigen

@ -1,5 +1,6 @@
package com.velocitypowered.proxy.command; package com.velocitypowered.proxy.command;
import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.velocitypowered.api.command.Command; import com.velocitypowered.api.command.Command;
@ -80,14 +81,20 @@ public class VelocityCommand implements Command {
@Override @Override
public void execute(@NonNull CommandSource source, @NonNull String[] args) { public void execute(@NonNull CommandSource source, @NonNull String[] args) {
String implVersion = VelocityServer.class.getPackage().getImplementationVersion(); String implName = MoreObjects.firstNonNull(VelocityServer.class.getPackage().getImplementationTitle(), "Velocity");
TextComponent velocity = TextComponent.builder("Velocity ") String implVersion = MoreObjects.firstNonNull(VelocityServer.class.getPackage().getImplementationVersion(), "<unknown>");
String implVendor = MoreObjects.firstNonNull(VelocityServer.class.getPackage().getImplementationVendor(), "Velocity Contributors");
TextComponent velocity = TextComponent.builder(implName + " ")
.decoration(TextDecoration.BOLD, true) .decoration(TextDecoration.BOLD, true)
.color(TextColor.DARK_AQUA) .color(TextColor.DARK_AQUA)
.append(TextComponent.of(implVersion == null ? "<unknown>" : implVersion).decoration(TextDecoration.BOLD, false)) .append(TextComponent.of(implVersion == null ? "<unknown>" : implVersion).decoration(TextDecoration.BOLD, false))
.build(); .build();
TextComponent copyright = TextComponent.of("Copyright 2018 Velocity Contributors. Velocity is freely licensed under the terms of the " + TextComponent copyright = TextComponent.of("Copyright 2018 " + implVendor + ". " + implName + " is freely licensed under the terms of the " +
"MIT License."); "MIT License.");
source.sendMessage(velocity);
source.sendMessage(copyright);
if (implName.equals("Velocity")) {
TextComponent velocityWebsite = TextComponent.builder() TextComponent velocityWebsite = TextComponent.builder()
.content("Visit the ") .content("Visit the ")
.append(TextComponent.builder("Velocity website") .append(TextComponent.builder("Velocity website")
@ -100,11 +107,9 @@ public class VelocityCommand implements Command {
.clickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://github.com/VelocityPowered/Velocity")) .clickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://github.com/VelocityPowered/Velocity"))
.build()) .build())
.build(); .build();
source.sendMessage(velocity);
source.sendMessage(copyright);
source.sendMessage(velocityWebsite); source.sendMessage(velocityWebsite);
} }
}
@Override @Override
public boolean hasPermission(@NonNull CommandSource source, @NonNull String[] args) { public boolean hasPermission(@NonNull CommandSource source, @NonNull String[] args) {