Giter VIP home page Giter VIP logo

lobster's Introduction

LobsterChat

A Minecraft Chat Component and Adventure MiniMessage implementation in Rust.

Examples

Without minimessage

use lobsterchat::component::*;

let text_component: Component = Component::text("Hello, World! ")
                    .color(0xFFAAFF)
                    .click_event(ClickEvent::open_url("https://github.com/Maxuss/lobster"))
                    .append(
                        Component::translatable("my.translation.key")
                        .color(NamedColor::Gold)
                        .hover_event(HoverEvent::ShowText(Component::text("Click for surprise!")))
                        .insert_text("I love lobsterchat!")
                    )
                    .append(
                        Component::keybind("key.sprint")
                        .bold(true)
                        .italic(false)
                    );

println!("{}", text_component.to_string());

With minimessage

use lobsterchat::message::*;
use lobsterchat::component::{Component, Colored, NamedColor};

let component: Component = lobster("<gold><bold>This is some message!</bold> <blue>Some blue text <#AAFFAA>Some hex text!");
let placeholdered: Component = placeholder_lobster(
    "Some normal text. <first> And then <gold><second>.",
    [
        (
            "first",
            Component::text("Some replacement.").color(NamedColor::Gold)
        ),
        (
            "second",
            Component::translatable("translated.text.key")
        )
    ])

Enable minimessage with the minimessage crate feature

Speed:

running 1 test
test tests::benchmark_lobster ... bench:       6,335 ns/iter (+/- 147)

So around 6mcs to convert message into a component.

Features

  • Components:

  • Component types (literal, translatable, etc.)

  • Formatting and colors

  • Click / Hover events in components

  • MiniMessage

  • Named color tags (e.g. <red>, <blue>)

  • Hex color tags (e.g. <#AAFFAA>)

  • Formatting tags (e.g. <bold>, <reset>)

  • Placeholder tags

  • Hover / Click Events

  • Advanced formatting tags (e.g. <rainbow>, <gradient>)

lobster's People

Contributors

maxuss avatar

Stargazers

 avatar  avatar

Watchers

 avatar

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.