Skip to content

Commit

Permalink
feat(redirect_qb_to_pb): ✨ add plugin redirect_qb_to_pb
Browse files Browse the repository at this point in the history
  • Loading branch information
AnzhiZhang committed May 12, 2024
1 parent 7804bca commit a5e7e7a
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 0 deletions.
1 change: 1 addition & 0 deletions .release-please/.release-please-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
"src/online_player_api": "1.0.0",
"src/qq_api": "1.3.1",
"src/qq_chat": "2.1.0",
"src/redirect_qb_to_pb": "1.0.0",
"src/uuid_api": "0.1.2"
}
3 changes: 3 additions & 0 deletions .release-please/release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
"src/qq_chat": {
"package-name": "qq_chat"
},
"src/redirect_qb_to_pb": {
"package-name": "redirect_qb_to_pb"
},
"src/uuid_api": {
"package-name": "uuid_api"
}
Expand Down
11 changes: 11 additions & 0 deletions src/redirect_qb_to_pb/mcdreforged.plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"id": "redirect_qb_to_pb",
"version": "1.0.0",
"name": "Redirect qb to pb",
"description": {
"en_us": "Redirect !!qb to !!pb",
"zh_cn": "将 !!qb 重定向到 !!pb"
},
"author": "Andy Zhang",
"link": "https://github.com/AnzhiZhang/MCDReforgedPlugins/tree/master/src/redirect_qb_to_pb"
}
8 changes: 8 additions & 0 deletions src/redirect_qb_to_pb/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Redirect pb to qb

> [QuickBackupM](https://github.com/TISUnion/QuickBackupM) is a classic saves backup plugin. Recently, [PrimeBackup](https://github.com/TISUnion/PrimeBackup) has become its alternative. Due to historical reasons, many servers still have the historical habit of using `!!pb`. Since PrimeBackup does not support the multi-command prefix function, this plugin was made to solve this problem.
You can now use `!!qb` equivalent to `!!pb`.

> [!WARNING]
> There may be incompatibilities with the QuickBackupM plugin.
8 changes: 8 additions & 0 deletions src/redirect_qb_to_pb/readme_cn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Redirect pb to qb

> [QuickBackupM](https://github.com/TISUnion/QuickBackupM) 是经典的存档备份插件,近日,[PrimeBackup](https://github.com/TISUnion/PrimeBackup) 成为了它的替代品,由于历史原因,许多服务器仍然有使用 `!!pb` 的历史习惯。由于 PrimeBackup 无法支持多指令前缀的功能,由此诞生此插件。
您现在可以使用 `!!qb` 等效 `!!pb`

> [!WARNING]
> 可能会有与 QuickBackupM 插件不兼容的情况。
17 changes: 17 additions & 0 deletions src/redirect_qb_to_pb/redirect_qb_to_pb/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from mcdreforged.api.command import *
from mcdreforged.api.types import PluginServerInterface


def on_load(server: PluginServerInterface, prev_module):
server.register_command(
Literal('!!qb')
.runs(handler)
.then(
GreedyText('content')
.runs(handler)
)
)


def handler(src, ctx):
src.get_server().execute_command(f'!!pb {ctx.get("content", "")}', src)

0 comments on commit a5e7e7a

Please sign in to comment.