mirror of
https://github.com/Samsuik/Sakura.git
synced 2025-12-19 14:59:30 +00:00
Update sakura branding
This commit is contained in:
@@ -1,51 +0,0 @@
|
||||
--- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java
|
||||
+++ b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
|
||||
@@ -31,6 +_,11 @@
|
||||
import net.kyori.adventure.text.event.ClickEvent;
|
||||
import net.kyori.adventure.text.format.TextDecoration;
|
||||
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
||||
+// Sakura start - customise version command
|
||||
+import net.kyori.adventure.text.event.HoverEvent;
|
||||
+import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
+import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||
+// Sakura end - customise version command
|
||||
|
||||
@Deprecated(forRemoval = true)
|
||||
public class VersionCommand extends BukkitCommand {
|
||||
@@ -43,6 +_,15 @@
|
||||
return versionFetcher;
|
||||
}
|
||||
|
||||
+ // Sakura start - customise version command
|
||||
+ 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>'""";
|
||||
+ // Sakura end - customise version command
|
||||
+
|
||||
public VersionCommand(@NotNull String name) {
|
||||
super(name);
|
||||
|
||||
@@ -54,11 +_,16 @@
|
||||
|
||||
@Override
|
||||
public boolean execute(@NotNull CommandSender sender, @NotNull String currentAlias, @NotNull String[] args) {
|
||||
- if (!testPermission(sender)) return true;
|
||||
-
|
||||
- if (args.length == 0) {
|
||||
+ // Sakura start - customise version command
|
||||
+ if (args.length == 0 || !this.testPermission(sender)) {
|
||||
+ sender.sendMessage(MiniMessage.miniMessage().deserialize(VERSION_MESSAGE,
|
||||
+ Placeholder.component("commit", Component.text("hover", NamedTextColor.YELLOW)
|
||||
+ .hoverEvent(HoverEvent.showText(Component.text(Bukkit.getGitInformation())))),
|
||||
+ Placeholder.unparsed("version", Bukkit.getMinecraftVersion())
|
||||
+ ));
|
||||
//sender.sendMessage("This server is running " + Bukkit.getName() + " version " + Bukkit.getVersion() + " (Implementing API version " + Bukkit.getBukkitVersion() + ")"); // Paper - moved to setVersionMessage
|
||||
- sendVersion(sender);
|
||||
+ //sendVersion(sender);
|
||||
+ // Sakura end - customise version command
|
||||
} else {
|
||||
StringBuilder name = new StringBuilder();
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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())));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user