Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
JAs0n319 authored Feb 3, 2023
1 parent 54696b6 commit 1676e33
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
18 changes: 18 additions & 0 deletions allow_suicide/__init__.py
Original file line number Diff line number Diff line change
@@ -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)))
)
14 changes: 14 additions & 0 deletions mcdreforged.plugin.json
Original file line number Diff line number Diff line change
@@ -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"
}

0 comments on commit 1676e33

Please sign in to comment.