Skip to content

Commit

Permalink
v0.3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
zyxkad committed Feb 26, 2023
1 parent 6ea4d22 commit 0544c84
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
6 changes: 3 additions & 3 deletions mcdreforged.plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "tpm",
"version": "0.3.2",
"version": "0.3.3",
"name": "TpManager",
"description": {
"en_us": "A Minecraft teleport manager",
Expand All @@ -9,8 +9,8 @@
"author": "zyxkad",
"link": "https://github.com/kmcsr/tpmanager_mcdr",
"dependencies": {
"mcdreforged": ">=2.0.0",
"kpi": "~1.4.1"
"mcdreforged": "~2.3.0",
"kpi": "~1.4.2"
},
"resources": [
"LICENSE",
Expand Down
18 changes: 12 additions & 6 deletions tpm/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,17 @@ def has_permission(self, src: MCDR.CommandSource, literal: str) -> bool:
def help(self, source: MCDR.CommandSource):
send_message(source, BIG_BLOCK_BEFOR, tr('help_msg', Prefix), BIG_BLOCK_AFTER, sep='\n')

@Literal('pos', player_only=True)
@Literal('pos')
@player_only
def tppos(self, source: MCDR.PlayerCommandSource, x: float, y: float, z: float):
server = source.get_server()
player = source.player
cfg = get_config()
cmd = cfg.teleport_xyz_command.format(name=player, x=x, y=y, z=z)
server.execute(cmd)

@Literal('ask', player_only=True)
@Literal('ask')
@player_only
def ask(self, source: MCDR.PlayerCommandSource, target: str):
server = source.get_server()
name = source.player
Expand All @@ -77,7 +79,8 @@ def ask(self, source: MCDR.PlayerCommandSource, target: str):
new_command('{} reject'.format(Prefix), '[{}]'.format(tr('word.reject')), color=MCDR.RColor.red),
))

@Literal('askhere', player_only=True)
@Literal('askhere')
@player_only
def askhere(self, source: MCDR.PlayerCommandSource, target: str):
server = source.get_server()
name = source.player
Expand All @@ -96,17 +99,20 @@ def askhere(self, source: MCDR.PlayerCommandSource, target: str):
new_command('{} reject'.format(Prefix), '[{}]'.format(tr('word.reject')), color=MCDR.RColor.red),
))

@Literal('accept', player_only=True)
@Literal('accept')
@player_only
def accept(self, source: MCDR.PlayerCommandSource):
self.__tpask_map.pop(source.player,
(lambda s: send_message(s, MCDR.RText(tr('word.no_action'), color=MCDR.RColor.red)), 0) )[0](source)

@Literal('reject', player_only=True)
@Literal('reject')
@player_only
def reject(self, source: MCDR.PlayerCommandSource):
self.__tpask_map.pop(source.player,
(0, lambda s: send_message(s, MCDR.RText(tr('word.no_action'), color=MCDR.RColor.red))) )[1](source)

@Literal('cancel', player_only=True)
@Literal('cancel')
@player_only
def cancel(self, source: MCDR.PlayerCommandSource):
self.__tpsender_map.pop(source.player,
lambda s: send_message(s, MCDR.RText(tr('word.no_action'), color=MCDR.RColor.red)))(source)
Expand Down

0 comments on commit 0544c84

Please sign in to comment.