Java Code Examples for net.kyori.text.event.HoverEvent#showText()
The following examples show how to use
net.kyori.text.event.HoverEvent#showText() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PermissionInfo.java From LuckPerms with MIT License | 6 votes |
private static Consumer<ComponentBuilder<?, ?>> makeFancy(PermissionHolder holder, String label, Node node) { HoverEvent hoverEvent = HoverEvent.showText(TextUtils.fromLegacy(TextUtils.joinNewline( "§3> " + (node.getValue() ? "§a" : "§c") + node.getKey(), " ", "§7Click to remove this node from " + holder.getPlainDisplayName() ), '§')); String id = holder.getType() == HolderType.GROUP ? holder.getObjectName() : holder.getPlainDisplayName(); boolean explicitGlobalContext = !holder.getPlugin().getConfiguration().getContextsFile().getDefaultContexts().isEmpty(); String command = "/" + label + " " + NodeCommandFactory.undoCommand(node, id, holder.getType(), explicitGlobalContext); ClickEvent clickEvent = ClickEvent.suggestCommand(command); return component -> { component.hoverEvent(hoverEvent); component.clickEvent(clickEvent); }; }
Example 2
Source File: MetaInfo.java From LuckPerms with MIT License | 6 votes |
private static Consumer<ComponentBuilder<?, ?>> makeFancy(PermissionHolder holder, String label, ChatMetaNode<?, ?> node) { String location = node.metadata(InheritanceOriginMetadata.KEY).getOrigin().getName(); if (!location.equals(holder.getObjectName())) { // inherited. Group group = holder.getPlugin().getGroupManager().getIfLoaded(location); if (group != null) { holder = group; } } HoverEvent hoverEvent = HoverEvent.showText(TextUtils.fromLegacy(TextUtils.joinNewline( "§3> §a" + node.getPriority() + " §7- §r" + node.getMetaValue(), " ", "§7Click to remove this " + node.getMetaType().name().toLowerCase() + " from " + holder.getPlainDisplayName() ), '§')); String id = holder.getType() == HolderType.GROUP ? holder.getObjectName() : holder.getFormattedDisplayName(); boolean explicitGlobalContext = !holder.getPlugin().getConfiguration().getContextsFile().getDefaultContexts().isEmpty(); String command = "/" + label + " " + NodeCommandFactory.undoCommand(node, id, holder.getType(), explicitGlobalContext); ClickEvent clickEvent = ClickEvent.suggestCommand(command); return component -> { component.hoverEvent(hoverEvent); component.clickEvent(clickEvent); }; }
Example 3
Source File: MetaInfo.java From LuckPerms with MIT License | 6 votes |
private static Consumer<ComponentBuilder<?, ?>> makeFancy(PermissionHolder holder, String label, MetaNode node) { String location = node.metadata(InheritanceOriginMetadata.KEY).getOrigin().getName(); if (!location.equals(holder.getObjectName())) { // inherited. Group group = holder.getPlugin().getGroupManager().getIfLoaded(location); if (group != null) { holder = group; } } HoverEvent hoverEvent = HoverEvent.showText(TextUtils.fromLegacy(TextUtils.joinNewline( "§3> §r" + node.getMetaKey() + " §7- §r" + node.getMetaValue(), " ", "§7Click to remove this meta pair from " + holder.getPlainDisplayName() ), '§')); String id = holder.getType() == HolderType.GROUP ? holder.getObjectName() : holder.getPlainDisplayName(); boolean explicitGlobalContext = !holder.getPlugin().getConfiguration().getContextsFile().getDefaultContexts().isEmpty(); String command = "/" + label + " " + NodeCommandFactory.undoCommand(node, id, holder.getType(), explicitGlobalContext); ClickEvent clickEvent = ClickEvent.suggestCommand(command); return component -> { component.hoverEvent(hoverEvent); component.clickEvent(clickEvent); }; }
Example 4
Source File: ParentInfo.java From LuckPerms with MIT License | 6 votes |
private static Consumer<ComponentBuilder<? ,?>> makeFancy(PermissionHolder holder, String label, InheritanceNode node) { HoverEvent hoverEvent = HoverEvent.showText(TextUtils.fromLegacy(TextUtils.joinNewline( "&3> &f" + node.getGroupName(), " ", "&7Click to remove this parent from " + holder.getPlainDisplayName() ), TextUtils.AMPERSAND_CHAR)); String id = holder.getType() == HolderType.GROUP ? holder.getObjectName() : holder.getPlainDisplayName(); boolean explicitGlobalContext = !holder.getPlugin().getConfiguration().getContextsFile().getDefaultContexts().isEmpty(); String command = "/" + label + " " + NodeCommandFactory.undoCommand(node, id, holder.getType(), explicitGlobalContext); ClickEvent clickEvent = ClickEvent.suggestCommand(command); return component -> { component.hoverEvent(hoverEvent); component.clickEvent(clickEvent); }; }
Example 5
Source File: SearchCommand.java From LuckPerms with MIT License | 6 votes |
private static Consumer<ComponentBuilder<?, ?>> makeFancy(String holderName, HolderType holderType, String label, NodeEntry<?, ?> perm, LuckPermsPlugin plugin) { HoverEvent hoverEvent = HoverEvent.showText(TextUtils.fromLegacy(TextUtils.joinNewline( "&3> " + (perm.getNode().getValue() ? "&a" : "&c") + perm.getNode().getKey(), " ", "&7Click to remove this node from " + holderName ), TextUtils.AMPERSAND_CHAR)); boolean explicitGlobalContext = !plugin.getConfiguration().getContextsFile().getDefaultContexts().isEmpty(); String command = "/" + label + " " + NodeCommandFactory.undoCommand(perm.getNode(), holderName, holderType, explicitGlobalContext); ClickEvent clickEvent = ClickEvent.suggestCommand(command); return component -> { component.hoverEvent(hoverEvent); component.clickEvent(clickEvent); }; }
Example 6
Source File: GroupListMembers.java From LuckPerms with MIT License | 5 votes |
private static Consumer<ComponentBuilder<? ,?>> makeFancy(String holderName, HolderType holderType, String label, NodeEntry<?, ?> perm, LuckPermsPlugin plugin) { HoverEvent hoverEvent = HoverEvent.showText(TextUtils.fromLegacy(TextUtils.joinNewline( "&3> &b" + ((InheritanceNode) perm.getNode()).getGroupName(), " ", "&7Click to remove this parent from " + holderName ), TextUtils.AMPERSAND_CHAR)); boolean explicitGlobalContext = !plugin.getConfiguration().getContextsFile().getDefaultContexts().isEmpty(); String command = "/" + label + " " + NodeCommandFactory.undoCommand(perm.getNode(), holderName, holderType, explicitGlobalContext); ClickEvent clickEvent = ClickEvent.suggestCommand(command); return component -> { component.hoverEvent(hoverEvent); component.clickEvent(clickEvent); }; }