Towny Classic

Towny Classic

3.2k Downloads

Suggestion: Translatable Titles

darksaid98 opened this issue ยท 1 comments

commented

Please explain your feature request to the best of your abilities:

I know the issue name may be a bit ambiguous so here it goes. This has less to do with "translations" and more so with the customizability of the plugin (as far as looks go).

Problem:
These lines are hardcoded limiting the customizeability of certain parts of the plugin.

Lines:

  • private static final int DEFAULT_CHAT_WIDTH = 320;
    private static final float SPACE_WIDTH = FontUtil.measureWidth(' ');
    private static final float UNDERSCORE_WIDTH = FontUtil.measureWidth('_');
    // Padding used for the main title formatting
    private static final String WIDGET = ".oOo.";
    private static final float WIDGET_WIDTH = FontUtil.measureWidth(WIDGET);
    // Padding used for subtitle formatting
    private static final String SUBWIDGET = " .]|[. ";
    private static final float SUBWIDGET_WIDTH = FontUtil.measureWidth(SUBWIDGET);
  • title = ".[ " + Translation.of("status_title_secondary_colour") + title + Translation.of("status_title_primary_colour") + " ].";
    if (!FontUtil.isValidMinecraftFont(title))
    return legacyFormatTitle(title);
    final float width = FontUtil.measureWidth(TownyComponents.miniMessage(title));
    // Max width - widgetx2 (already padded with an extra 1px) - title - 2 (1px before and after the title.)
    float remainder = DEFAULT_CHAT_WIDTH - (WIDGET_WIDTH * 2) - width - 2;
    if (remainder < 1)
    return Translation.of("status_title_primary_colour") + title;
    if (remainder < 14)
    return Translation.of("status_title_primary_colour") + WIDGET + title + WIDGET;
    int times = (int) Math.floor(remainder / (UNDERSCORE_WIDTH * 2));
    return Translation.of("status_title_primary_colour") + WIDGET + repeatChar(times, "_") + title + repeatChar(times, "_") + WIDGET;

There is quite a bit more in the ChatTools file than the above :(

Perhaps I want my town info page title to be something like: <dark_gray><strikethrough> <reset> Town <dark_gray><strikethrough> <reset>, rather than the towny default of .oOo.____.

Request:

  • Unhardcode the entire title/subtitle and expose either through translations or config.
  • It'd be nice to completely be able to disable the padding on both title and subtitle.
commented

https://github.com/TownyAdvanced/Towny#a-special-message-from-llmdl-precedes-the-normal-readme-

99/100 servers are not sponsoring right now so I'm not taking on suggestions. If you'd like to code this and make a PR you're welcome to do that.