diff --git a/allow_suicide/__init__.py b/allow_suicide/__init__.py new file mode 100644 index 0000000..947a15a --- /dev/null +++ b/allow_suicide/__init__.py @@ -0,0 +1,18 @@ +from mcdreforged.api.all import * + +def kill(server: ServerInterface,player: str): + if player != '(Console)': + server.execute('kill '+player) + +def player_name(is_player: bool,player: str): + if is_player: + return player + else: + return '(Console)' + +def on_load(server: PluginServerInterface, old): + server.register_help_message('!!kill','自杀') + server.register_command( + Literal('!!kill') + .runs(lambda src: kill(server,player_name(src.is_player,src.player))) + ) \ No newline at end of file diff --git a/mcdreforged.plugin.json b/mcdreforged.plugin.json new file mode 100644 index 0000000..386b3b6 --- /dev/null +++ b/mcdreforged.plugin.json @@ -0,0 +1,14 @@ +{ + "id": "allow_suicide", + "version": "1.0.0", + "name": "allow_suicide", + "description": { + "en_us": "allow player suicide with no op", + "zh_cn": "允许玩家在没有op权限时自杀" + }, + "dependencies": { + "mcdreforged": ">=2.1.0" + }, + "author": "JAs0n", + "link": "https://github.com/JAs0n319/allow_suicide" +} \ No newline at end of file