Skip to content

Commit

Permalink
v0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zyxkad committed Feb 3, 2024
1 parent 3d17a80 commit 14c3b5d
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@

# python
__pycache__
/*_cache
4 changes: 2 additions & 2 deletions mcdreforged.plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "tpm",
"version": "0.3.4",
"version": "0.4.0",
"name": "TpManager",
"description": {
"en_us": "A Minecraft teleport manager",
Expand All @@ -10,7 +10,7 @@
"link": "https://github.com/kmcsr/tpmanager_mcdr",
"dependencies": {
"mcdreforged": "^2.3.0",
"kpi": "~1.4.3"
"kpi": "~1.4.6"
},
"resources": [
"LICENSE",
Expand Down
18 changes: 18 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

[tool.ruff]

ignore = [
"F403",
"F405",
"E701",
]

line-length = 100

[tool.mypy]

mypy_path = "${MYPY_CONFIG_FILE_DIR}/../kpi_mcdr/"
ignore_missing_imports = true
disable_error_code = ['misc']

[tool.poetry]
2 changes: 1 addition & 1 deletion tpm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

__all__ = []

export_pkg(globals_(), api)
__all__.extend(api.__all__)

def on_load(server: MCDR.PluginServerInterface, prev_module):
if prev_module is None:
Expand Down
2 changes: 1 addition & 1 deletion tpm/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from .utils import *

__all__ = []
__all__: list[str] = []

def on_load(server: MCDR.PluginServerInterface, prev_module):
pass
Expand Down
6 changes: 3 additions & 3 deletions tpm/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def askhere(self, source: MCDR.PlayerCommandSource, target: str):
def accept(self, source: MCDR.PlayerCommandSource):
cbs = self.__tpask_map.pop(source.player, None)
if cbs is None:
send_message(s, MCDR.RText(tr('word.no_action'), color=MCDR.RColor.red))
send_message(source, MCDR.RText(tr('word.no_action'), color=MCDR.RColor.red))
return
cbs[0](source)

Expand All @@ -124,7 +124,7 @@ def accept(self, source: MCDR.PlayerCommandSource):
def reject(self, source: MCDR.PlayerCommandSource):
cbs = self.__tpask_map.pop(source.player, None)
if cbs is None:
send_message(s, MCDR.RText(tr('word.no_action'), color=MCDR.RColor.red))
send_message(source, MCDR.RText(tr('word.no_action'), color=MCDR.RColor.red))
return
cbs[1](source)

Expand All @@ -133,7 +133,7 @@ def reject(self, source: MCDR.PlayerCommandSource):
def cancel(self, source: MCDR.PlayerCommandSource):
cb = self.__tpsender_map.pop(source.player, None)
if cb is None:
send_message(s, MCDR.RText(tr('word.no_action'), color=MCDR.RColor.red))
send_message(source, MCDR.RText(tr('word.no_action'), color=MCDR.RColor.red))
return
cb(source)

Expand Down
1 change: 1 addition & 0 deletions tpm/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import mcdreforged.api.all as MCDR

from kpi.config import *
from kpi.utils import LazyData
from .utils import *

__all__ = [
Expand Down
11 changes: 6 additions & 5 deletions tpm/utils.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@

import mcdreforged.api.all as MCDR

import kpi.utils
from kpi.utils import *

__all__ = [
'new_thread', 'tr'
'new_thread', 'tr', 'debug', 'log_info', 'log_warn', 'log_error',
'get_server_instance',
'new_timer', 'new_command', 'join_rtext', 'send_message', 'broadcast_message',
'assert_instanceof', 'require_player',
]

kpi.utils.export_pkg(globals(), kpi.utils)

def new_thread(call):
return MCDR.new_thread('tp_manager')(call)

def tr(key: str, *args, **kwargs):
return MCDR.ServerInterface.get_instance().rtr(f'tpm.{key}', *args, **kwargs)
return get_server_instance().rtr(f'tpm.{key}', *args, **kwargs)

0 comments on commit 14c3b5d

Please sign in to comment.