Skip to content

Installation

Phinner edited this page Jan 9, 2025 · 6 revisions

Requirements

This plugin requires at least :

Configuration

The configuration file is located at /config/mods/flex/config.yaml:

# Builtin flex hooks configuration
hooks:
  # Redirect chat processing to flex (beware, it overrides the "send message" packet listener)
  # To change the format, define the template "mindustry_chat"
  chat: false
  # Use flex for displaying player join messages (beware, it will always set "showConnectMessages" to false to avoid conflicts)
  # To change the format, define the template "mindustry_join"
  join: false
  # Use flex for displaying player quit messages (beware, it will always set "showConnectMessages" to false to avoid conflicts)
  # To change the format, define the template "mindustry_quit"
  quit: false
  # Name hook configuration
  # To change the format, define the template "mindustry_name"
  name:
    # If enabled, flex will update the display name of all online players periodically
    enabled: false
    # The update interval of the name hook
    update-interval: "500ms"

# Translator configuration
translator:
  # Whether the built-in message translation processor should be registered
  register-message-processor: true
  # The translation backend, more details at "https://github.com/xpdustry/flex/wiki/Translator"
  backend: "None"

# Message pipeline configuration
messages:
  # Foo client has a few quirks regarding chat handling:
  # - It appends invisible characters at the end of messages, invisible to clients but not the server or other receivers.
  # - It does not use the chat formatting provided by flex (or even the vanilla chat formatter).
  # This option fixes these issues at the expense of disabling some foo client features.
  # Enabled by default
  foo-client-compatibility: true

# Statically defined templates
templates:
  # The name of your template
  greeting:
    # The steps composing your template
    steps:
      # A simple text step
      - text: "Hello "
      # This step has a filter, it will only append the text if the subject is an online player
      - if: "player:name"
        text: "%player:name%"
      # Let's add the same filter with a "not" condition so we can still have a fallback name
      - if: { not: "player:name" }
        text: "Unknown"
      # Finish up
      - text: ", nice to meet you"
  # An example custom player name template, see how simple and powerful it is
  mindustry_name:
    steps:
      - if: "my_processor:is_admin"
        text: "[red]<ADMIN> "
      - text: "[%player:color%]%player:name_colored%"

Development

Simply add the following in your build script to compile with flex api.

repositories {
    maven("https://maven.xpdustry.com/releases")
}

dependencies {
    compileOnly("com.xpdustry:flex:$VERSION")
}

And make sure flex is loaded before your plugin by adding the following in your plugin.json.

{
    "dependencies": [ "flex" ]
}
Clone this wiki locally