Замена
Используется для замены триггеров на определённые значения












Как сделать свою замену? Например :ip:, которое заменяется на айпи сервера
В message.yml добавь триггер в format.replacement.triggers
triggers:
server_ip: "(?<!\\\\)(?<!\\S)(?i):ip:(?!\\S)"В localizations → язык.yml добавь то, на что триггер заменится, в message.format.replacement.values
values:
server_ip: "<fcolor:2><u><click:copy_to_clipboard:'flectone.net'>flectone.net</click></u>"В permission.yml добавь право в message.format.replacement.values
values:
server_ip:
name: "flectonepulse.module.message.format.replacement.server_ip"
type: "TRUE"Перезагрузи FlectonePulse с помощью /flectonepulse reload и напиши в чат :ip:
(?<!\\\\)(?<!\\S) и (?!\\S) нужны для того, чтобы триггер срабатывал только отдельным словом и его можно было экранировать с помощью \\
Локализация
Путьlocalizations → язык.yml → message.format.replacement
replacement:
spoiler_symbol: "-"
values:
ping: "<fcolor:2><value>"
tps: "<fcolor:2><value>"
online: "<fcolor:2><value>"
coords: "<fcolor:2><x> <y> <z>"
stats: "<color:#ff7171><hp>H</color> <color:#3de0d8><armor>A <color:#e33059><attack>D <color:#4eff52><exp>E <color:#f0a01f><food>F"
skin: "<click:open_url:\"<message_1>\"><hover:show_text:\"<fcolor:2><pixels>\"><fcolor:2><u>Skin</u></hover></click>"
item: "<fcolor:2>[<message_1>]"
url: "<click:open_url:\"<message_1>\"><hover:show_text:\"<fcolor:2>Открыть ссылку <br><u><message_1>\"><fcolor:2><u>Url</u></hover></click>"
image: "<click:open_url:\"<message_1>\"><hover:show_text:\"<fcolor:2><pixels>\"><fcolor:2><u>Image</u></hover></click>"
spoiler: "<hover:show_text:\"<fcolor:2><message_1>\"><fcolor:2><symbols></hover>"
bold: "<b><message_1></b>"
italic: "<i><message_1></i>"
underline: "<u><message_1></u>"
obfuscated: "<obf><message_1></obf>"
strikethrough: "<st><message_1></st>"spoiler_symbol
Символ, который будет заменять каждую букву слов у spoiler
values
Список сообщений, где ключом является название, а значением, что будет показано вместо триггера
Внутри значений можно использовать плейсхолдеры, которые зависят от замены
| Плейсхолдер | Где используется |
|---|---|
<value> | ping, tps, online – само значение |
<x>, <y>, <z> | coords – координаты игрока |
<hp>, <armor>, <attack>, <exp>, <food> | stats – статистика игрока |
<pixels> | skin и image – само изображение, которое собрано из символов |
<message_1> | Текст, который был найден по триггеру (ссылка, название предмета и т.д.) |
<symbols> | spoiler – скрытый текст, где каждая буква заменена на spoiler_symbol |
Настройка
Путьmessage.yml → format.replacement
replacement:
enable: true
triggers:
ping: "(?<!\\\\)(?<!\\S)%ping%(?!\\S)"
tps: "(?<!\\\\)(?<!\\S)%tps%(?!\\S)"
online: "(?<!\\\\)(?<!\\S)%online%(?!\\S)"
coords: "(?<!\\\\)(?<!\\S)%coords%(?!\\S)"
stats: "(?<!\\\\)(?<!\\S)%stats%(?!\\S)"
skin: "(?<!\\\\)(?<!\\S)%skin%(?!\\S)"
item: "(?<!\\\\)(?<!\\S)%item%(?!\\S)"
image: "(?<!\\\\{2,})(?<=\\s|^)((?i:https?)://(?:[a-zA-Z0-9-@]{1,63}\\.)*(?i:imgur\\.com|discordapp\\.net|cdn\\.discordapp\\.com)/[\\w\\-./?=&%!#$'()*+,;:=~@]*\\.(?:jpg|jpeg|png|gif|webp|bmp))(?!\\S)"
url: "(?<!\\\\{2,})(?<=\\s|^)((?i:https?|ftp)://(?:[\\p{L}a-zA-Z0-9-@]{1,63}\\.)+[\\p{L}a-zA-Z]{2,6}(?::\\d{1,5})?(?:/[\\w\\-./?=&%!#$'()*+,;:=~@]*)?)(?!\\S)"
spoiler: "(?<!\\S)\\|\\|([^\\|\\|\\n]+)\\|\\|(?!\\S)"
bold: "(?<!\\S)\\*\\*([^\\*\\*\\n]+)\\*\\*(?!\\S)"
italic: "(?<!\\S)\\*([^\\*\\n]+)\\*(?!\\S)"
underline: "(?<!\\S)__([^__\\n]+)__(?!\\S)"
obfuscated: "(?<!\\S)\\?\\?([^\\?\\?\\n]+)\\?\\?(?!\\S)"
strikethrough: "(?<!\\S)~~([^~~\\n]+)~~(?!\\S)"enable
Включает или выключает работоспособность модуля
triggers
Список всех доступных триггеров, где ключом является название, а значением сам trigger в формате регулярного выражения
Замену можно вставить и вручную в любое сообщение с помощью тега <replacement:название>, например <replacement:ping> или <replacement:tps>. Для url, image и spoiler нужно указать второй аргумент, например <replacement:url:'https://flectone.net'>
Если ты добавляшеь новый триггер, то обязательно добавь его также и в файл локализации, т.е. на что он будет заменяться
Права
Путьpermission.yml → message.format.replacement
replacement:
name: "flectonepulse.module.message.format.replacement"
type: "TRUE"
values:
smile:
name: "flectonepulse.module.message.format.replacement.smile"
type: "TRUE"
big_smile:
name: "flectonepulse.module.message.format.replacement.big_smile"
type: "TRUE"
sad:
name: "flectonepulse.module.message.format.replacement.sad"
type: "TRUE"
ok_hand:
name: "flectonepulse.module.message.format.replacement.ok_hand"
type: "TRUE"
thumbs_up:
name: "flectonepulse.module.message.format.replacement.thumbs_up"
type: "TRUE"
thumbs_down:
name: "flectonepulse.module.message.format.replacement.thumbs_down"
type: "TRUE"
cool_smile:
name: "flectonepulse.module.message.format.replacement.cool_smile"
type: "TRUE"
cool_glasses:
name: "flectonepulse.module.message.format.replacement.cool_glasses"
type: "TRUE"
clown:
name: "flectonepulse.module.message.format.replacement.clown"
type: "TRUE"
heart:
name: "flectonepulse.module.message.format.replacement.heart"
type: "TRUE"
laughing:
name: "flectonepulse.module.message.format.replacement.laughing"
type: "TRUE"
confused:
name: "flectonepulse.module.message.format.replacement.confused"
type: "TRUE"
happy:
name: "flectonepulse.module.message.format.replacement.happy"
type: "TRUE"
angry:
name: "flectonepulse.module.message.format.replacement.angry"
type: "TRUE"
ascii_idk:
name: "flectonepulse.module.message.format.replacement.ascii_idk"
type: "TRUE"
ascii_angry:
name: "flectonepulse.module.message.format.replacement.ascii_angry"
type: "TRUE"
ascii_happy:
name: "flectonepulse.module.message.format.replacement.ascii_happy"
type: "TRUE"
ping:
name: "flectonepulse.module.message.format.replacement.ping"
type: "TRUE"
tps:
name: "flectonepulse.module.message.format.replacement.tps"
type: "TRUE"
online:
name: "flectonepulse.module.message.format.replacement.online"
type: "TRUE"
coords:
name: "flectonepulse.module.message.format.replacement.coords"
type: "TRUE"
stats:
name: "flectonepulse.module.message.format.replacement.stats"
type: "TRUE"
skin:
name: "flectonepulse.module.message.format.replacement.skin"
type: "TRUE"
item:
name: "flectonepulse.module.message.format.replacement.item"
type: "TRUE"
url:
name: "flectonepulse.module.message.format.replacement.url"
type: "TRUE"
image:
name: "flectonepulse.module.message.format.replacement.image"
type: "TRUE"
spoiler:
name: "flectonepulse.module.message.format.replacement.spoiler"
type: "TRUE"
bold:
name: "flectonepulse.module.message.format.replacement.bold"
type: "TRUE"
italic:
name: "flectonepulse.module.message.format.replacement.italic"
type: "TRUE"
underline:
name: "flectonepulse.module.message.format.replacement.underline"
type: "TRUE"
obfuscated:
name: "flectonepulse.module.message.format.replacement.obfuscated"
type: "TRUE"
strikethrough:
name: "flectonepulse.module.message.format.replacement.strikethrough"
type: "TRUE"name
Название права
type
Вид права
| Вид | Объяснение |
|---|---|
TRUE | Доступно для любого игрока |
FALSE | Никому не доступно, должно быть выдано отдельно (например с помощью LuckPerms) |
OP | Доступно для операторов сервера |
NOT_OP | Доступно для НЕ операторов сервера |
values
Список замен с правами