Skip to content

Commit 0e5f6d2

Browse files
committed
feat(command): 添加自动构建和封禁管理命令
- 在BuildManager中添加createAutoBuildCommand方法,实现智能构建爬塔记录功能 - 在PlayerManager中添加createBanCommand和createUnbanCommand方法,实现账户与IP封禁管理 - 更新messages_zh.properties文件,添加build、autobuild、ban、unban等命令的国际化配置 - 为新命令添加完整的参数说明和使用示例文档 - 修复参数配置中的文本错误,统一参数描述格式
1 parent a609f7a commit 0e5f6d2

6 files changed

Lines changed: 222 additions & 51 deletions

File tree

src/main/java/emu/nebula/nbcommand/service/command/manager/BuildManager.java

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ public class BuildManager extends BaseCommandManager {
1717
@Override
1818
public List<Supplier<Command>> getCategoryCommands() {
1919
return List.of(
20-
this::createBuildCommand
20+
this::createBuildCommand,
21+
this::createAutoBuildCommand
2122
);
2223
}
2324

@@ -40,4 +41,27 @@ private Command createBuildCommand() {
4041
syntax
4142
);
4243
}
44+
45+
46+
/**
47+
* build 命令 - 构建角色和光锥配置
48+
*/
49+
private Command createAutoBuildCommand() {
50+
Syntax syntax = new Syntax()
51+
.add("autobuild")
52+
.add("characters", getI18Name("param.character_id"), FieldMode.MULTI_SELECT_CONTAINER, " ")
53+
.add("discs", getI18Name("param.disc_id"), FieldMode.MULTI_SELECT_CONTAINER, " ")
54+
.add("potentials", getI18Name("param.potential_id"), FieldMode.MULTI_SELECT_CONTAINER_WITH_COUNT, " ")
55+
.add("subNoteSkills", getI18Name("param.melody_id"), FieldMode.MULTI_SELECT_CONTAINER_WITH_COUNT, " ")
56+
.add("lv(level)", getI18Name("param.level"), FieldMode.SPECIAL_PREFIX, "lv")
57+
.add("s(score)", getI18Name("param.record_score"), FieldMode.SPECIAL_PREFIX, "s")
58+
;
59+
60+
return createCommand(
61+
"command.auto_build.name",
62+
"command.auto_build.description",
63+
"command.auto_build.full_description",
64+
syntax
65+
);
66+
}
4367
}

src/main/java/emu/nebula/nbcommand/service/command/manager/PlayerManager.java

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ public class PlayerManager extends BaseCommandManager {
1313
public List<Supplier<Command>> getCategoryCommands() {
1414
return List.of(
1515
this::createAccountCommand,
16-
this::createSetLevelCommand
16+
this::createSetLevelCommand,
17+
this::createBanCommand,
18+
this::createUnbanCommand
1719
);
1820
}
1921

@@ -50,4 +52,43 @@ private Command createSetLevelCommand() {
5052
syntax
5153
);
5254
}
55+
56+
57+
/**
58+
* ban命令 - 设置等级
59+
*/
60+
private Command createBanCommand() {
61+
Syntax syntax = new Syntax()
62+
.add("ban")
63+
.add("{ip | uid | all}", getI18Name("param.action"), FieldMode.SIMPLE_RADIO)
64+
.add("[ip/uid]", getI18Name("param.ban_mode"))
65+
.add("[end timestamp]", getI18Name("param.endtime"))
66+
.add("[reason]", getI18Name("param.reason"))
67+
;
68+
69+
return createCommand(
70+
"command.ban.name",
71+
"command.ban.description",
72+
"command.ban.full_description",
73+
syntax
74+
);
75+
}
76+
77+
/**
78+
* unban命令 - 设置等级
79+
*/
80+
private Command createUnbanCommand() {
81+
Syntax syntax = new Syntax()
82+
.add("unban")
83+
.add("{ip | uid | all}", getI18Name("param.action"), FieldMode.SIMPLE_RADIO)
84+
.add("[ip/uid]", getI18Name("param.ban_mode"))
85+
;
86+
87+
return createCommand(
88+
"command.unban.name",
89+
"command.unban.description",
90+
"command.unban.full_description",
91+
syntax
92+
);
93+
}
5394
}

src/main/resources/lang/messages_en.properties

Lines changed: 39 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ category.mail_system=Mail System
4747
category.build_system=Build System
4848

4949
# Messages
50-
message.category_not_found=Category not found:
50+
message.category_not_found=Category not found:
5151
message.config_saved=Configuration saved
5252
message.config_save_failed=Failed to save configuration
5353
message.execute_command_failed=Failed to execute command: No command selected
@@ -56,8 +56,8 @@ message.execute_custom_command_failed=Failed to execute custom command: Command
5656
# Dialogs
5757
dialog.update_available_title=Update Available
5858
dialog.update_available_header=New version found
59-
dialog.current_version=Current version:
60-
dialog.latest_version=Latest version:
59+
dialog.current_version=Current version:
60+
dialog.latest_version=Latest version:
6161
dialog.no_updates_title=Update Check
6262
dialog.no_updates_message=You are using the latest version
6363
dialog.update_check_failed_title=Update Check Failed
@@ -89,6 +89,20 @@ command.setlevel.name=setlevel
8989
command.setlevel.description=Set Level
9090
command.setlevel.full_description=Set account level
9191

92+
# ban command
93+
command.ban.name=ban
94+
command.ban.description=Ban account and IP
95+
command.ban.full_description=When the operation type is uid, only the related player account is banned, and the following parameters should be filled with uid\n\
96+
When the operation type is ip, only the related IP is banned, and the following parameters should be filled with IP\n\
97+
When the operation type is all, both IP and player account are banned, and the following parameters should be filled with uid instead of IP
98+
99+
# unban command
100+
command.unban.name=unban
101+
command.unban.description=Unban account and IP
102+
command.unban.full_description=When the operation type is uid, only the related player account is unbanned, and the following parameters should be filled with uid\n\
103+
When the operation type is ip, only the related IP is unbanned, and the following parameters should be filled with IP\n\
104+
When the operation type is all, both IP and player account are unbanned, and the following parameters should be filled with uid instead of IP
105+
92106
# Give command
93107
command.give.name=give
94108
command.give.description=Give Single Item
@@ -129,11 +143,6 @@ command.disc_single.name=disc
129143
command.disc_single.description=Get Single Disc
130144
command.disc_single.full_description=Get single disc
131145

132-
# Dungeon command
133-
command.dungeon.name=dungeon
134-
command.dungeon.description=test
135-
command.dungeon.full_description=test
136-
137146
# Reload command
138147
command.reload.name=reload
139148
command.reload.description=Server Reload
@@ -151,25 +160,42 @@ command.mail.full_description=Mail system todo
151160

152161
# Build command
153162
command.build.name=build
154-
command.build.description=Build
163+
command.build.description=Build Record
155164
command.build.full_description=This code implements a build record command, parsing player input character, light cone IDs and generating build data. If character count is not 3 or light cone count is not between 3 and 6 then returns an error. Finally saves legal builds and notifies the client.
156165

166+
# AutoBuild command
167+
command.auto_build.name=autobuild
168+
command.auto_build.description=Smart Build Record
169+
command.auto_build.full_description=Example:\n\
170+
`!autobuild s99999` = Create a record with a random Trailblazer and reach the highest score.\n\
171+
`!autobuild 103 lv30` = Create a record with this Trailblazer and level 30.\n\
172+
`!autobuild 155 132 107 s25000` = Create a record using these Trailblazers with an approximate score of 25000.\n\
173+
`!autobuild 103 510301 510302 510303 510304 lv20` = Create a record with this Trailblazer and these potentials, level 20.\n\
174+
\n\
175+
Notes:\n\
176+
- Target level will override target score. So `!autobuild lv30 s1000` will result in level 30, not score 1000.\n\
177+
- If no target level or score is specified, the default target level is 40.
178+
157179
# Parameters
158180
param.action=Action
159181
param.email=Email
160-
param.uid=Reserved Player UID
182+
param.uid=Player UID
161183
param.level=Level
184+
param.ban_mode=ip or uid
185+
param.endtime=End Time (64-bit timestamp)
186+
param.reason=Reason (Notes)
162187
param.item_id=Item ID
163188
param.amount=Amount
164189
param.type=Type
165190
param.talent_level=Talent/Crescendo Level
166191
param.skill_level=Skill Level
167192
param.clean_type=Clean Type
168-
param.ids=ID
169-
param.id=IDS
193+
param.id=id
194+
param.ids=ids
170195
param.character_id=Character ID
171196
param.disc_id=Disc ID
172197
param.potential_id=Character Potential ID
173198
param.melody_id=Disc melody ID
174199
param.ascension=Ascension
175-
param.affinity_level=Affinity Level
200+
param.affinity_level=Affinity Level
201+
param.record_score=Target Score

src/main/resources/lang/messages_ja.properties

Lines changed: 42 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
message.app_started=The program is started
1+
message.app_started=プログラムが開始しました
22

33
# Menu
44
menu.options=オプション
55
menu.check_update=アップデートを確認
66
menu.about=情報
7-
menu.language=言語
7+
menu.language=言語-Language
88

99
# Toolbar
1010
toolbar.server_address=サーバーアドレス:
@@ -49,8 +49,8 @@ category.build_system=ビルドシステム
4949
# Dialogs
5050
dialog.update_available_title=アップデートのお知らせ
5151
dialog.update_available_header=新しいバージョンが見つかりました
52-
dialog.current_version=現在のバージョン:
53-
dialog.latest_version=最新バージョン:
52+
dialog.current_version=現在のバージョン:
53+
dialog.latest_version=最新バージョン:
5454
dialog.no_updates_title=アップデート確認
5555
dialog.no_updates_message=最新バージョンを使用しています
5656
dialog.update_check_failed_title=アップデート確認失敗
@@ -61,7 +61,7 @@ dialog.update_open_failed_message=ブラウザを開けませんので、手動
6161
dialog.cancel=キャンセル
6262

6363
# Messages
64-
message.category_not_found=カテゴリが見つかりません:
64+
message.category_not_found=カテゴリが見つかりません:
6565
message.config_saved=設定が保存されました
6666
message.config_save_failed=設定の保存に失敗しました
6767
message.execute_command_failed=コマンド実行に失敗しました: コマンドが選択されていません
@@ -73,6 +73,7 @@ ui.clear=クリア
7373
ui.search=検索
7474
ui.select_type=タイプ選択
7575
ui.all=すべて
76+
ui.selected_items=選択された項目
7677

7778
# Commands
7879
command.label=コマンド
@@ -88,6 +89,20 @@ command.setlevel.name=setlevel
8889
command.setlevel.description=レベル設定
8990
command.setlevel.full_description=アカウントレベルの設定
9091

92+
# ban command
93+
command.ban.name=ban
94+
command.ban.description=アカウントとIPをBAN
95+
command.ban.full_description=操作タイプがuidの場合は、関連プレイヤーアカウントのみをBANし、後のパラメータにはuidを入力してください\n\
96+
操作タイプがipの場合は、関連IPのみをBANし、後のパラメータにはipを入力してください\n\
97+
操作タイプがallの場合は、IPとプレイヤーアカウントの両方をBANし、後のパラメータにはIPではなくuidを入力してください
98+
99+
# unban command
100+
command.unban.name=unban
101+
command.unban.description=アカウントとIPのBAN解除
102+
command.unban.full_description=操作タイプがuidの場合は、関連プレイヤーアカウントのみのBANを解除し、後のパラメータにはuidを入力してください\n\
103+
操作タイプがipの場合は、関連IPのみのBANを解除し、後のパラメータにはipを入力してください\n\
104+
操作タイプがallの場合は、IPとプレイヤーアカウントの両方のBANを解除し、後のパラメータにはIPではなくuidを入力してください
105+
91106
# Give command
92107
command.give.name=give
93108
command.give.description=単一アイテムを与える
@@ -128,11 +143,6 @@ command.disc_single.name=disc
128143
command.disc_single.description=単一ディスクを取得
129144
command.disc_single.full_description=単一ディスクを取得
130145

131-
# Dungeon command
132-
command.dungeon.name=dungeon
133-
command.dungeon.description=テスト
134-
command.dungeon.full_description=テスト
135-
136146
# Reload command
137147
command.reload.name=reload
138148
command.reload.description=サーバーリロード
@@ -150,25 +160,42 @@ command.mail.full_description=メールシステムtodo
150160

151161
# Build command
152162
command.build.name=build
153-
command.build.description=ビルド
163+
command.build.description=ビルド記録
154164
command.build.full_description=このコードはビルド記録コマンドを実装し、プレイヤーの入力するキャラクター、ライトコーン等のIDを解析し、ビルドデータを生成します。キャラクター数が3でなく、ライトコーンのエネルギー数が3から6の間でない場合はエラーを返します。最終的に合法なビルドを保存し、クライアントに通知します。
155165

166+
# AutoBuild command
167+
command.auto_build.name=autobuild
168+
command.auto_build.description=スマートビルド記録
169+
command.auto_build.full_description=例:\n\
170+
`!autobuild s99999` = ランダムな開拓者で最高スコアを達成する記録を作成します。\n\
171+
`!autobuild 103 lv30` = この開拓者でレベル30の記録を作成します。\n\
172+
`!autobuild 155 132 107 s25000` = これらの開拓者を使用して約25000のスコア記録を作成します。\n\
173+
`!autobuild 103 510301 510302 510303 510304 lv20` = この開拓者とこれらのポテンシャルでレベル20の記録を作成します。\n\
174+
\n\
175+
注意:\n\
176+
- 目標レベルは目標スコアより優先されます。よって`!autobuild lv30 s1000`はスコア1000ではなくレベル30になります。\n\
177+
- 目標レベルやスコアが指定されていない場合、デフォルトの目標レベルは40です。
178+
156179
# Parameters
157180
param.action=アクション
158181
param.email=メール
159-
param.uid=予約プレイヤーuid
182+
param.uid=プレイヤーuid
160183
param.level=レベル
184+
param.ban_mode=ip または uid
185+
param.endtime=終了時間(64ビットタイムスタンプ)
186+
param.reason=理由(備考)
161187
param.item_id=アイテムID
162188
param.amount=数量
163189
param.type=タイプ
164190
param.talent_level=タレント/クレッシェンドレベル
165191
param.skill_level=スキルレベル
166192
param.clean_type=クリーンタイプ
167-
param.ids=ID
168-
param.id=IDS
193+
param.id=id
194+
param.ids=ids
169195
param.character_id=キャラクターID
170196
param.disc_id=ディスクID
171197
param.potential_id=キャラクターポテンシャルID
172198
param.melody_id=ディスクメロディID
173199
param.ascension=アセンション
174-
param.affinity_level=親密度レベル
200+
param.affinity_level=親密度レベル
201+
param.record_score=目標スコア

0 commit comments

Comments
 (0)