mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-27 08:14:45 +00:00
Build the studio link button in core
- Keep relocated Adventure types out of the plugin module
This commit is contained in:
1 parent
2ae765ca16
commit
c6a7225fa8
2 files changed
+17
-14
No files matched your search
@@ -76,10 +76,6 @@ import art.arcane.iris.platform.bukkit.plugin.VolmitSender;
|
||||
import art.arcane.iris.world.task.J;
|
||||
import art.arcane.volmlib.util.scheduling.O;
|
||||
import art.arcane.volmlib.util.scheduling.PrecisionStopwatch;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.event.ClickEvent;
|
||||
import net.kyori.adventure.text.event.HoverEvent;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.FluidCollisionMode;
|
||||
@@ -453,16 +449,9 @@ public class CommandStudio implements DirectorExecutor {
|
||||
}
|
||||
|
||||
private void sendStudioLink(StudioLaunch launch, String link) {
|
||||
VolmitSender sender = sender();
|
||||
sender.sendMessage(C.RED + IrisLanguage.text(launch.failureMessage()));
|
||||
if (!sender.isPlayer()) {
|
||||
return;
|
||||
}
|
||||
Component button = Component.text(IrisLanguage.text(RuntimeUiMessages.STUDIO_LINK_COPY_BUTTON))
|
||||
.color(NamedTextColor.GREEN)
|
||||
.clickEvent(ClickEvent.copyToClipboard(link))
|
||||
.hoverEvent(HoverEvent.showText(Component.text(IrisLanguage.text(RuntimeUiMessages.STUDIO_LINK_COPY_HOVER))));
|
||||
sender.sendComponent(button);
|
||||
sender().sendMessage(C.RED + IrisLanguage.text(launch.failureMessage()));
|
||||
sender().sendCopyButton(IrisLanguage.text(RuntimeUiMessages.STUDIO_LINK_COPY_BUTTON),
|
||||
IrisLanguage.text(RuntimeUiMessages.STUDIO_LINK_COPY_HOVER), link);
|
||||
}
|
||||
|
||||
@Director(description = "Profiles the performance of a dimension", descriptionKey = "iris.director.commandstudio.director.profiles_performance_dimension", origin = DirectorOrigin.PLAYER)
|
||||
|
||||
@@ -32,6 +32,9 @@ import art.arcane.volmlib.util.math.M;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.event.ClickEvent;
|
||||
import net.kyori.adventure.text.event.HoverEvent;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.Sound;
|
||||
@@ -326,6 +329,17 @@ public class VolmitSender implements CommandSender {
|
||||
deliver(ComponentText.component(component));
|
||||
}
|
||||
|
||||
/** A green line that copies {@code payload} to a player's clipboard when clicked; a console gets nothing. */
|
||||
public void sendCopyButton(String label, String hover, String payload) {
|
||||
if (!isPlayer()) {
|
||||
return;
|
||||
}
|
||||
sendComponent(Component.text(label)
|
||||
.color(NamedTextColor.GREEN)
|
||||
.clickEvent(ClickEvent.copyToClipboard(payload))
|
||||
.hoverEvent(HoverEvent.showText(Component.text(hover))));
|
||||
}
|
||||
|
||||
private void deliver(ComponentText message) {
|
||||
ComponentMessenger.send(s, message);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user