use of net.kyori.text.event.HoverEvent in project VoxelGamesLibv2 by VoxelGamesLib.
the class LangFormatter method handleHover.
@Nonnull
private static HoverEvent handleHover(@Nonnull String token) {
String[] args = token.split(":");
HoverEvent hoverEvent;
if (args.length < 2)
throw new VoxelGameLibException("Can't parse hover action (too few args) " + token);
switch(args[1]) {
case "show_text":
hoverEvent = new HoverEvent(HoverEvent.Action.SHOW_TEXT, parseFormat(token.replace("hover:show_text:", "")));
break;
case "show_item":
hoverEvent = new HoverEvent(HoverEvent.Action.SHOW_ITEM, parseFormat(token.replace("hover:show_item:", "")));
break;
case "show_entity":
hoverEvent = new HoverEvent(HoverEvent.Action.SHOW_ENTITY, parseFormat(token.replace("hover:show_entity:", "")));
break;
default:
throw new VoxelGameLibException("Can't parse hover action (invalid type " + args[1] + ") " + token);
}
return hoverEvent;
}
Aggregations