Skip to content

Commit

Permalink
Clickable addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
Seggan committed Mar 27, 2024
1 parent 3a74590 commit 045f433
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
import me.mrCookieSlime.Slimefun.api.BlockStorage;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.event.ClickEvent;
import net.kyori.adventure.text.format.NamedTextColor;

// TODO clean up if possible
public final class StargateController extends SlimefunItem implements Listener {
Expand Down Expand Up @@ -228,7 +231,13 @@ private ChestMenu getMenu(@Nonnull Block b) {
"&fAddress: " + address,
"&7Click to send the address to chat"
), (p, i, s, c) -> {
p.sendMessage(ChatColor.YELLOW + "Address: " + temp);
p.sendMessage(
Component.text()
.color(NamedTextColor.YELLOW)
.content("Address (click to copy): " + temp)
.clickEvent(ClickEvent.copyToClipboard(temp))
.build()
);
p.closeInventory();
return false;
});
Expand Down

0 comments on commit 045f433

Please sign in to comment.