Skip to content

Commit

Permalink
Update locales, commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Rothes committed Jul 26, 2024
1 parent 619915c commit ad9e6e6
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import io.github.rothes.protocolstringreplacer.PsrLocalization;
import io.github.rothes.protocolstringreplacer.ProtocolStringReplacer;
import io.github.rothes.protocolstringreplacer.api.user.PsrUser;
import io.github.rothes.protocolstringreplacer.command.subcommands.About;
import io.github.rothes.protocolstringreplacer.util.ArgUtils;
import io.github.rothes.protocolstringreplacer.command.subcommands.Capture;
import io.github.rothes.protocolstringreplacer.command.subcommands.Edit;
Expand Down Expand Up @@ -30,9 +31,10 @@ public void initialize() {
plugin.getCommand("ProtocolStringReplacer").setExecutor(this);
plugin.getCommand("ProtocolStringReplacer").setTabCompleter(this);

subCommands.add(new Capture());
subCommands.add(new Edit());
subCommands.add(new Parse());
subCommands.add(new Capture());
subCommands.add(new About());
subCommands.add(new Reload());
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package io.github.rothes.protocolstringreplacer.command.subcommands

import io.github.rothes.protocolstringreplacer.PsrLocalization
import io.github.rothes.protocolstringreplacer.api.user.PsrUser
import io.github.rothes.protocolstringreplacer.command.SubCommand
import io.github.rothes.protocolstringreplacer.plugin

class About: SubCommand("about", "protocolstringreplacer.command.about", PsrLocalization.getLocaledMessage("Sender.Commands.About.Description")) {

override fun onExecute(user: PsrUser, args: Array<out String>) {
user.msg("Header")
user.msg("Plugin")
user.msg("Version", plugin.description.version)
user.msg("Author", "Rothes")
user.msg("Donate", "https://ko-fi.com/rothes")
user.msg("GitHub", "https://github.com/Rothes/ProtocolStringReplacer")
user.msg("To-Say")
user.msg("Footer")
}

override fun onTab(user: PsrUser, args: Array<out String>): MutableList<String> {
return mutableListOf()
}

override fun sendHelp(user: PsrUser) {
}

private fun PsrUser.msg(key: String, append: String = "", vararg rep: String) {
this.sendFilteredText(PsrLocalization.getLocaledMessage("Sender.Commands.About.$key", *rep) + append)
}

}
24 changes: 17 additions & 7 deletions bukkit/src/main/resources/Languages/en-US/Locales/Locale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Console-Sender:
Backing-Up-Configs: '&aBacking up configurations to folder: %0%'
Upgrading-Configs: '&aUpgrading configurations version: %0% -> %1%'
Replacer-Config:
Pre-Loaded-Replacers: '&aPre-loaded %0% replacer config(s). &8Took %1%ms'
Pre-Loaded-Replacers: '&aFound %0% replacer config(s). &8Took %1%ms'
Replacer-Load-Complete: '&aSuccessfully loaded replacer config: %0%. &8Took %1%ms'
Replacer-Failed-To-Load: '&cFailed to load replacer config %0% . Please fix the problem with the trace stack.'
Replacer-Regex-Exception: '&cFailed to load replacer config %0% , because there''s a regex syntax error in it:'
Expand Down Expand Up @@ -52,14 +52,14 @@ Sender:
Subcommand-Help-Format: '&7 * &e%0% &7- &b%1%'
Help:
Header: '&7&m------&7&l &7[ &c&lProtocol&6&lString&3&lReplacer&7 ]&l &7&m------'
Footer: '&7&m-----------------------------------------'
Footer: '&7&m----------------------------------------'
Confirm:
Expired: '&cOperation confirm has timed out. Please execute again.'
Nothing-To-Confirm: '&cYou have no pending operations to confirm.'
Capture:
Description: 'Capture contents in a packet'
Help:
Header: '&7&m------------&7&l &7[ &c&lP&6&lS&3&lR &7- &eCapture Tool&7 ]&l &7&m------------'
Header: '&7&m-------------&7&l &7[ &c&lP&6&lS&3&lR &7- &eCapture Tool&7 ]&l &7&m-------------'
Footer: '&7&m-----------------------------------------------'
Add-Capture-Tip: '&cExecute &e/psr capture add %0% &cto enable capture.'
Remove-Capture-Tip: '&cExecute &e/psr capture remove %0% &cto disable capture.'
Expand All @@ -80,11 +80,11 @@ Sender:
List:
Simple-Help: '&7 * &e/psr capture list &7- &bList captured contents'
Detailed-Help: '&7 * &e/psr capture list <Listen type> [page] &7- &bList captured contents'
Results-Header: '&7&m---------&7&l &7[ &c&lP&6&lS&3&lR &7- &eCaptured list&7 ]&l &7&m---------'
Results-Footer: '&7&m------------------------------------------'
Results-Header: '&7&m-------&7&l &7[ &c&lP&6&lS&3&lR &7- &eCaptured list&7 ]&l &7&m-------'
Results-Footer: '&7&m-----------------------------------'
Not-Capturing-Listen-Type: '&cYou are not capturing &f%0% &c.'
Capture-Info:
Captured-Contents: '&3&l&m----------------------&3&l Captured Contents &m----------------------'
Captured-Contents: '&3&l&m----------------&3&l Captured Contents &m----------------'
Click-For-Clipboard: '&aClick for clipboard'
Click-To-Copy: '&aClick to copy'
Click-Any-Entry-To-Copy: '&aClick any entry to copy'
Expand All @@ -93,7 +93,7 @@ Sender:
Description: 'Replacers editor'
Help:
Header: '&7&m------------&7&l &7[ &c&lP&6&lS&3&lR &7- &eEditor&7 ]&l &7&m------------'
Footer: '&7&m-----------------------------------------'
Footer: '&7&m----------------------------------------'
Children:
File:
Description: 'Replacer files commands'
Expand Down Expand Up @@ -228,6 +228,16 @@ Sender:
Tab-Complete:
String-To-Parse: '<String to parse>'
PAPI-Target: '<PAPI target>'
About:
Description: 'About plugin'
Header: '&7&m-------------&7&l &7[ &c&lP&6&lS&3&lR &7- &eAbout&7 ]&l &7&m-------------'
Plugin: ' &c&lProtocol&6&lString&3&lReplacer &bis...'
Version: ' &3Version&7: &b'
Author: ' &3Author&7: &b'
Donate: ' &3Donate&7: &b'
GitHub: ' &3GitHub&7: &b'
To-Say: ' &aPlease leave a &e⭐Star &afor our free plugin!'
Footer: '&7&m-----------------------------------------'
Reload:
Description: 'Reload configs'
Already-Reloading: '&cPlugin is already reloading. Please reload later.'
Expand Down
24 changes: 17 additions & 7 deletions bukkit/src/main/resources/Languages/zh-CN/Locales/Locale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Console-Sender:
Backing-Up-Configs: '&a正在备份配置文件到文件夹: %0%'
Upgrading-Configs: '&a正在升级配置文件版本 %0% -> %1%'
Replacer-Config:
Pre-Loaded-Replacers: '&a预加载 %0% 个替换配置文件. &8耗时 %1%ms'
Pre-Loaded-Replacers: '&a发现 %0% 个替换配置文件. &8耗时 %1%ms'
Replacer-Load-Complete: '&a成功载入替换配置: %0%. &8耗时 %1%ms'
Replacer-Failed-To-Load: '&c无法载入配置文件 %0% , 请通过下面的报错堆栈检查错误.'
Replacer-Regex-Exception: '&c无法载入配置文件 %0% , 因为正则表达式有问题:'
Expand Down Expand Up @@ -52,14 +52,14 @@ Sender:
Subcommand-Help-Format: '&7 * &e%0% &7- &b%1%'
Help:
Header: '&7&m------&7&l &7[ &c&lProtocol&6&lString&3&lReplacer&7 ]&l &7&m------'
Footer: '&7&m-----------------------------------------'
Footer: '&7&m----------------------------------------'
Confirm:
Expired: '&c确认操作已超时. 请重新执行.'
Nothing-To-Confirm: '&c您没有待确认的操作.'
Capture:
Description: '捕获数据包的文本内容'
Help:
Header: '&7&m-----------&7&l &7[ &c&lP&6&lS&3&lR &7- &e捕获工具&7 ]&l &7&m-----------'
Header: '&7&m-------------&7&l &7[ &c&lP&6&lS&3&lR &7- &e捕获工具&7 ]&l &7&m-------------'
Footer: '&7&m-------------------------------------------'
Add-Capture-Tip: '&c使用指令 &e/psr capture add %0% &c即可开启捕获.'
Remove-Capture-Tip: '&c使用指令 &e/psr capture remove %0% &c即可取消捕获.'
Expand All @@ -81,7 +81,7 @@ Sender:
Simple-Help: '&7 * &e/psr capture list &7- &b列出捕获的文本信息'
Detailed-Help: '&7 * &e/psr capture list <监听类型> [页码] &7- &b列出捕获的文本信息'
Results-Header: '&7&m---------&7&l &7[ &c&lP&6&lS&3&lR &7- &e捕获列表&7 ]&l &7&m---------'
Results-Footer: '&7&m---------------------------------------'
Results-Footer: '&7&m-----------------------------------'
Not-Capturing-Listen-Type: '&c您未在捕获 &f%0% &c.'
Capture-Info:
Captured-Contents: '&3&l&m----------------------&3&l 捕获内容 &m----------------------'
Expand All @@ -92,14 +92,14 @@ Sender:
Edit:
Description: '替换配置编辑器'
Help:
Header: '&7&m-----------&7&l &7[ &c&lP&6&lS&3&lR &7- &e编辑器&7 ]&l &7&m-----------'
Header: '&7&m-------------&7&l &7[ &c&lP&6&lS&3&lR &7- &e编辑器&7 ]&l &7&m-------------'
Footer: '&7&m-----------------------------------------'
Children:
File:
Description: '替换配置文件相关指令'
Help:
Header: '&7&m-----------&7&l &7[ &c&lP&6&lS&3&lR &7- &e文件编辑器&7 ]&l &7&m-----------'
Footer: '&7&m---------------------------------------------'
Footer: '&7&m----------------------------------------'
Children:
Cannot-Find-Replacer-Config: '&c找不到此替换配置文件: &f%0%'
List:
Expand All @@ -118,7 +118,7 @@ Sender:
Enabled: '&a启用'
Not-Enabled: '&c禁用'
Not-Configured: '&7未定义'
Footer: '&7&m-----------------------------------------------'
Footer: '&7&m------------------------------------------'
Select:
Simple-Help: '&7 * &e/psr edit file select &7- &b选定一个替换配置文件'
Detailed-Help: '&7 * &e/psr file select <替换配置文件|索引> &7- &b选定编辑的替换配置'
Expand Down Expand Up @@ -228,6 +228,16 @@ Sender:
Tab-Complete:
String-To-Parse: '<要测试的字符串>'
PAPI-Target: '<占位符目标玩家>'
About:
Description: '关于插件'
Header: '&7&m--------------&7&l &7[ &c&lP&6&lS&3&lR &7- &e关于&7 ]&l &7&m--------------'
Plugin: ' &c&lProtocol&6&lString&3&lReplacer &b是...'
Version: ' &3版本&7: &b'
Author: ' &3作者&7: &b'
Donate: ' &3捐赠&7: &b'
GitHub: ' &3源代码&7: &b'
To-Say: ' &a请给我们的自由软件留下一个 &e⭐Star &a!'
Footer: '&7&m------------------------------------------'
Reload:
Description: '重载插件配置文件'
Already-Reloading: '&c插件已经在重载过程中. 请稍后再重载.'
Expand Down
3 changes: 3 additions & 0 deletions bukkit/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ commands:
aliases: [psr]
description: ProtocolStringReplacer commands.
permissions:
protocolstringreplacer.command.about:
description: See plugin info.
default: true
protocolstringreplacer.command.capture:
description: allow you to capture the packet contents.
default: op
Expand Down

0 comments on commit ad9e6e6

Please sign in to comment.