Ejemplos de uso - Majhrs16/ChatTranslator GitHub Wiki
from:
sourceLang: es
messages:
texts:
- "No está permitido hablar"
formats:
- "&c{0}&f."
from:
messages:
formats:
- "&f<&b%player_name%&f> &a%ct_messages%"
to:
messages:
formats:
- "&f<&b%player_name%&f> &a$ct_messages$"
toolTips:
formats:
- "&f[&6%ct_lang_source%&f] &a%ct_messages%"
Se requiere PlaceholderAPI para este ejemplo.
# FORMATS.yml
to:
messages:
formats:
- '&e[&6%cot_translate; es; %ct_lang_target%; Traducción%&e]'
- ''
toolTips:
formats:
- '&f[&6%ct_lang_source% &f-> &6$ct_lang_target$&f] &a%ct_messages%'
sounds:
ENTITY_EXPERIENCE_ORB_PICKUP:
volume: 1
pitch: 1
ORB_PICKUP:
volume: 1
pitch: 1
# CONFIG.yml
show-native-chat:
cancel-event: false
clear-recipients: false
to:
messages:
formats:
- '{"text": "", "extra": [{"text": "&a%player_name%", "hoverEvent": {"action": "SHOW_TEXT", "value": "&f[&6%ct_lang_source% &f-> &6$ct_lang_target$&f]"}}, {"text": " &f> "}, {"text": "%ct_messages%", "hoverEvent": {"action": "SHOW_TEXT", "value": "&a%ct_messages%"}}]}'
toolTips:
texts: []
formats: []
sounds:
ENTITY_EXPERIENCE_ORB_PICKUP:
volume: 1
pitch: 1
ORB_PICKUP:
volume: 1
pitch: 1
Para los siguientes 2 ejemplos, se necesitan algunas dependencias:
- ConditionalEvents
- ChatTranslator
- PlaceholderAPI
- Luckperms
- Luckperms
Para usar esta configuración tal como está, debes tener 2 grupos en Luckperms de antemano:
- default
- owner
Y dos formatos de grupo en formats.yml
de ChatTranslator, llamados: from_owner
y to_owner
.
ChT_Enhancer:
type: custom
custom_event_data:
event: me.majhrs16.cht.events.custom.Message
player_variable: getSender()
variables_to_capture:
- '%uuid%;getUUID()'
- '%last_path%;getLastFormatPath()'
conditions:
- "%last_path% !contains mention"
- "%luckperms_in_group_default% equals no"
- "%luckperms_in_group_owner% equals yes execute owner"
# ...
actions:
owner:
- 'console_message: %cot_var; {uuid}; #from.format("from_owner")%'
- 'console_message: %cot_var; {uuid}; #to.format("to_owner")%'
# ...
Otro ejemplo. Esta vez, se está re-coloreando el texto de los jugadores que tengan un permiso de Discord.
ChT_Colors:
type: custom
custom_event_data:
event: me.majhrs16.cht.events.custom.Message
player_variable: getSender()
variables_to_capture:
- '%uuid%;getUUID()'
- '%last_path%;getLastFormatPath()'
conditions:
- "%last_path% !contains mention"
- "%luckperms_in_group_default% equals no"
- "%player_has_permission_DiscordTranslator.sync.red% == yes execute red"
# ...
actions:
red:
- 'console_message: CoT: %cot_var; {uuid}; #from.getMessages().setText(0, "&4" + #from.getMessages().getText(0))% re colored!'
- 'console_message: CoT: %cot_var; {uuid}; #to.getMessages().setText(0, "&4" + #to.getMessages().getText(0))% re colored!'
# ...