9
0
mirror of https://github.com/Samsuik/Sakura.git synced 2026-01-06 15:41:49 +00:00

Update sakura branding

This commit is contained in:
Samsuik
2025-06-23 21:30:04 +01:00
parent f73970eabd
commit 85159be01d
4 changed files with 68 additions and 51 deletions

View File

@@ -57,6 +57,15 @@
implementation("ca.spottedleaf:concurrentutil:0.0.3")
implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+
implementation("org.jline:jline-terminal-jni:3.27.1") // fall back to jni on java 21
@@ -213,7 +_,7 @@
"Specification-Version" to project.version,
"Specification-Vendor" to "Paper Team",
"Brand-Id" to "papermc:paper",
- "Brand-Name" to "Paper",
+ "Brand-Name" to serverBrand,
"Build-Number" to (build ?: ""),
"Build-Time" to buildTime.toString(),
"Git-Branch" to gitBranch,
@@ -267,7 +_,7 @@
jvmArgumentProviders.add(provider)
}

View File

@@ -0,0 +1,29 @@
--- a/src/main/java/io/papermc/paper/command/PaperVersionCommand.java
+++ b/src/main/java/io/papermc/paper/command/PaperVersionCommand.java
@@ -52,8 +_,10 @@
final PaperVersionCommand command = new PaperVersionCommand();
return Commands.literal("version")
- .requires(source -> source.getSender().hasPermission("bukkit.command.version"))
+ // Sakura start - customise version command
.then(Commands.argument("plugin", StringArgumentType.word())
+ .requires(source -> source.getSender().hasPermission("bukkit.command.version"))
+ // Sakura end - customise version command
.suggests(command::suggestPlugins)
.executes(command::pluginVersion))
.executes(command::serverVersion)
@@ -130,7 +_,13 @@
}
private int serverVersion(CommandContext<CommandSourceStack> context) {
- sendVersion(context.getSource().getSender());
+ // Sakura start - customise version command
+ final CommandSender sender = context.getSource().getSender();
+ if (sender.hasPermission("bukkit.command.version")) {
+ sendVersion(sender);
+ }
+ me.samsuik.sakura.configuration.SakuraBrandInformation.sendBrandToPlayer(sender);
+ // Sakura end - customise version command
return Command.SINGLE_SUCCESS;
}

View File

@@ -0,0 +1,30 @@
package me.samsuik.sakura.configuration;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.event.HoverEvent;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
public final class SakuraBrandInformation {
private static final String VERSION_MESSAGE = """
<dark_purple>.
<dark_purple>| <white>This server is running <gradient:red:light_purple>Sakura</gradient>
<dark_purple>| <white>Commit<dark_gray>: \\<<commit>> <gray>targeting </gray>(<yellow>MC</yellow>: <gray><version></gray>)
<dark_purple>| <white>Github<dark_gray>: \\<<yellow><click:open_url:'https://github.com/Samsuik/Sakura'>link</click></yellow>>
<dark_purple>'""";
public static void sendBrandToPlayer(final CommandSender sender) {
sender.sendMessage(MiniMessage.miniMessage().deserialize(VERSION_MESSAGE,
Placeholder.component("commit", gitCommit()),
Placeholder.unparsed("version", Bukkit.getMinecraftVersion())
));
}
private static Component gitCommit() {
return Component.text("hover", NamedTextColor.YELLOW)
.hoverEvent(HoverEvent.showText(Component.text(Bukkit.getGitInformation())));
}
}