Skip to content

[FEAT] Add Component TextIterators #127

Open

Description

@mzcydev

Currently, as I checked, only normal java.lang.String can be used for TextIterators. Would be nice to add Component support (finally), eh?

Activity

  1. mzcydev commented on May 8, 2026

    @mzcydev
    Author

    This would be my current SidebarTitle:

    package dev.mzcy.minera.lobby.sidebar;
    
    import me.catcoder.sidebar.text.TextIterator;
    
    public class SidebarTitle extends TextIterator {
    
        private static final String TEXT = "MineraMC";
        private final String textAfterGradient;
    
        private int step = 0;
    
        public SidebarTitle(String textAfterGradient) {
            this.textAfterGradient = textAfterGradient;
        }
    
        @Override
        public String next() {
            String[] colors = {
                    "#ff4dff",
                    "#ff66ff",
                    "#cc99ff",
                    "#99ccff",
                    "#66ffff"
            };
    
            StringBuilder builder = new StringBuilder("<gradient:");
    
            for (int i = 0; i < colors.length; i++) {
                int index = (i + step) % colors.length;
                builder.append(colors[index]);
    
                if (i != colors.length - 1) {
                    builder.append(":");
                }
            }
    
            builder.append("><b>");
            builder.append(TEXT);
            builder.append("</b></gradient>");
            builder.append(textAfterGradient);
    
            step++;
    
            if (step >= colors.length) {
                step = 0;
            }
    
            return builder.toString();
        }
    }
  2. self-assigned this
    on Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions