Giter VIP home page Giter VIP logo

Comments (4)

MiniDigger avatar MiniDigger commented on July 19, 2024

not really a solution but the lib is unit tested so those can serve as an example:
https://github.com/KyoriPowered/text/tree/master/api/src/test/java/net/kyori/text

edit: just looked, the readme is pretty good at explaining what to do

edit edit: for your questions:
hover:

TextComponent.builder().content("SomeText").hoverEvent(HoverEvent.showText(TextComponent.builder().content("some text").build())

if you want to create your hover text from a list you can either just collect your list into a single string via the stream/string joiner api, or you could just iterate your list and append to a component builder and use that to create the hover event component.

for deserialization, Component component = GsonComponentSerializer.INSTANCE.deserialize(json); should do the job (be sure to add text-serializer-gson to your dependencies).

from adventure.

Andre601 avatar Andre601 commented on July 19, 2024

Wouldn't it still be benefitial to have a wiki page that f.e. explains some of the more important classes, what they can (and even more important what they cannot) do and some common use examples.

I agree that the readme already explains most commonly used stuff, but things like the Hovertext are missing and maybe a section about certain limitations could also be useful.

Also another question... When I f.e. would iterate through the different lines. Could I just use the translateAlternateColorCodes method to make the hover coloured? Or would I need to use a separate method for this?

from adventure.

kashike avatar kashike commented on July 19, 2024

@Andre601 No, you'd create a Component with colour - for example:

  • TextComponent.of("meow", TextColor.DARK_PURPLE)
  • LegacyComponentSerializer.legacy().deserialize("&5meow", '&') to create a Component from legacy formatting codes

from adventure.

kashike avatar kashike commented on July 19, 2024

https://docs.adventure.kyori.net/

from adventure.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.