mcserver-cli 4.2.0__py3-none-any.whl → 4.4.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mcserver/__init__.py +1 -1
- mcserver/cli.py +138 -110
- mcserver/commands/__init__.py +24 -24
- mcserver/commands/{add.py → add_projects.py} +18 -11
- mcserver/commands/import_setup.py +1 -1
- mcserver/commands/{init.py → initialize_server.py} +1 -1
- mcserver/commands/list_projects.py +1 -1
- mcserver/commands/op_grant.py +1 -1
- mcserver/commands/op_list.py +20 -17
- mcserver/commands/op_revoke.py +39 -5
- mcserver/commands/print_help.py +1 -1
- mcserver/commands/remove_projects.py +1 -1
- mcserver/commands/{search.py → search_projects.py} +6 -10
- mcserver/commands/server_status.py +1 -1
- mcserver/commands/{show.py → show_projects.py} +1 -1
- mcserver/commands/{start.py → start_server.py} +1 -1
- mcserver/commands/{stop.py → stop_server.py} +1 -1
- mcserver/commands/update_projects.py +1 -1
- mcserver/commands/whitelist_add.py +1 -1
- mcserver/commands/whitelist_list.py +17 -16
- mcserver/commands/whitelist_remove.py +32 -24
- mcserver/config.py +6 -0
- mcserver/metadata.py +11 -3
- mcserver/modrinth/apis/get_project_informations.py +22 -15
- mcserver/modrinth/apis/get_project_versions.py +4 -1
- mcserver/modrinth/project_records.py +1 -0
- mcserver/resolver.py +1 -3
- mcserver/server_files/ops.py +87 -116
- mcserver/server_files/paths.py +4 -0
- mcserver/server_files/whitelist.py +72 -154
- {mcserver_cli-4.2.0.dist-info → mcserver_cli-4.4.0.dist-info}/METADATA +14 -7
- {mcserver_cli-4.2.0.dist-info → mcserver_cli-4.4.0.dist-info}/RECORD +35 -34
- {mcserver_cli-4.2.0.dist-info → mcserver_cli-4.4.0.dist-info}/WHEEL +0 -0
- {mcserver_cli-4.2.0.dist-info → mcserver_cli-4.4.0.dist-info}/entry_points.txt +0 -0
- {mcserver_cli-4.2.0.dist-info → mcserver_cli-4.4.0.dist-info}/licenses/LICENSE +0 -0
mcserver/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "4.
|
|
1
|
+
__version__ = "4.4.0"
|
mcserver/cli.py
CHANGED
|
@@ -1,115 +1,119 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
from types import FunctionType
|
|
5
|
-
|
|
6
|
-
from . import __version__
|
|
7
|
-
from .modrinth.shared import search_sort_index
|
|
8
|
-
from .shared import loader_list
|
|
9
|
-
|
|
10
|
-
def bound_int(min_integer: int, max_integer: int | None = None) -> FunctionType:
|
|
11
|
-
def parse(cli_string: str) -> int:
|
|
12
|
-
try:
|
|
13
|
-
integer = int(cli_string)
|
|
14
|
-
except ValueError:
|
|
15
|
-
raise argparse.ArgumentTypeError(f"{cli_string} is not an integer")
|
|
16
|
-
|
|
17
|
-
if integer < min_integer:
|
|
18
|
-
raise argparse.ArgumentTypeError(
|
|
19
|
-
f"{integer} must be higher than or equal to {min_integer}"
|
|
20
|
-
)
|
|
21
|
-
if max_integer is not None and integer > max_integer:
|
|
22
|
-
raise argparse.ArgumentTypeError(
|
|
23
|
-
f"{integer} must be between {min_integer} and {max_integer} (inclusive)"
|
|
24
|
-
)
|
|
25
|
-
return integer
|
|
26
|
-
|
|
27
|
-
return parse
|
|
28
|
-
|
|
29
|
-
def command_function(args: argparse.Namespace) -> int:
|
|
30
|
-
command_name: str = args.command_name
|
|
31
|
-
|
|
32
|
-
match command_name:
|
|
33
|
-
case "add":
|
|
34
|
-
from .commands import add
|
|
35
|
-
|
|
36
|
-
return add(args)
|
|
37
|
-
case "import":
|
|
38
|
-
from .commands import import_setup
|
|
39
|
-
|
|
40
|
-
return import_setup(args)
|
|
41
|
-
case "help":
|
|
42
|
-
from .commands import print_help
|
|
43
|
-
|
|
44
|
-
return print_help(args)
|
|
45
|
-
case "init":
|
|
46
|
-
from .commands import init
|
|
47
|
-
|
|
48
|
-
return init(args)
|
|
49
|
-
case "list":
|
|
50
|
-
from .commands import list_projects
|
|
51
|
-
|
|
52
|
-
return list_projects(args)
|
|
53
|
-
case "op_grant":
|
|
54
|
-
from .commands import op_grant
|
|
55
|
-
|
|
56
|
-
return op_grant(args)
|
|
57
|
-
case "op_list":
|
|
58
|
-
from .commands import op_list
|
|
59
|
-
|
|
60
|
-
return op_list(args)
|
|
61
|
-
case "op_revoke":
|
|
62
|
-
from .commands import op_revoke
|
|
63
|
-
|
|
64
|
-
return op_revoke(args)
|
|
65
|
-
case "remove":
|
|
66
|
-
from .commands import remove_projects
|
|
67
|
-
|
|
68
|
-
return remove_projects(args)
|
|
69
|
-
case "search":
|
|
70
|
-
from .commands import search
|
|
71
|
-
|
|
72
|
-
return search(args)
|
|
73
|
-
case "show":
|
|
74
|
-
from .commands import show
|
|
75
|
-
|
|
76
|
-
return show(args)
|
|
77
|
-
case "start":
|
|
78
|
-
from .commands import start
|
|
79
|
-
|
|
80
|
-
return start(args)
|
|
81
|
-
case "status":
|
|
82
|
-
from .commands import server_status
|
|
83
|
-
|
|
84
|
-
return server_status(args)
|
|
85
|
-
case "stop":
|
|
86
|
-
from .commands import stop
|
|
87
|
-
|
|
88
|
-
return stop(args)
|
|
89
|
-
case "update":
|
|
90
|
-
from .commands import update_projects
|
|
91
|
-
|
|
92
|
-
return update_projects(args)
|
|
93
|
-
case "whitelist_add":
|
|
94
|
-
from .commands import whitelist_add
|
|
95
|
-
|
|
96
|
-
return whitelist_add(args)
|
|
97
|
-
case "whitelist_list":
|
|
98
|
-
from .commands import whitelist_list
|
|
99
|
-
|
|
100
|
-
return whitelist_list(args)
|
|
101
|
-
case "whitelist_remove":
|
|
102
|
-
from .commands import whitelist_remove
|
|
103
|
-
|
|
104
|
-
return whitelist_remove(args)
|
|
105
|
-
case _:
|
|
106
|
-
import logging as log
|
|
107
|
-
|
|
108
|
-
log.error(f"Unknown command: {command_name}")
|
|
109
|
-
return 1
|
|
1
|
+
import argparse
|
|
2
|
+
import sys
|
|
3
|
+
from types import FunctionType
|
|
110
4
|
|
|
111
|
-
|
|
5
|
+
from . import __version__
|
|
6
|
+
from .modrinth.shared import search_sort_index
|
|
7
|
+
from .shared import loader_list
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def bound_int(min_integer: int, max_integer: int | None = None) -> FunctionType:
|
|
11
|
+
def parse(cli_string: str) -> int:
|
|
12
|
+
try:
|
|
13
|
+
integer = int(cli_string)
|
|
14
|
+
except ValueError:
|
|
15
|
+
raise argparse.ArgumentTypeError(f"{cli_string} is not an integer")
|
|
16
|
+
|
|
17
|
+
if integer < min_integer:
|
|
18
|
+
raise argparse.ArgumentTypeError(
|
|
19
|
+
f"{integer} must be higher than or equal to {min_integer}"
|
|
20
|
+
)
|
|
21
|
+
if max_integer is not None and integer > max_integer:
|
|
22
|
+
raise argparse.ArgumentTypeError(
|
|
23
|
+
f"{integer} must be between {min_integer} and {max_integer} (inclusive)"
|
|
24
|
+
)
|
|
25
|
+
return integer
|
|
26
|
+
|
|
27
|
+
return parse
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def command_function(args: argparse.Namespace) -> int:
|
|
31
|
+
command_name: str = args.command_name
|
|
32
|
+
|
|
33
|
+
match command_name:
|
|
34
|
+
case "add":
|
|
35
|
+
from .commands import add_projects
|
|
36
|
+
|
|
37
|
+
return add_projects(args)
|
|
38
|
+
case "import":
|
|
39
|
+
from .commands import import_setup
|
|
40
|
+
|
|
41
|
+
return import_setup(args)
|
|
42
|
+
case "help":
|
|
43
|
+
from .commands import print_help
|
|
44
|
+
|
|
45
|
+
return print_help(args)
|
|
46
|
+
case "init":
|
|
47
|
+
from .commands import initialize_server
|
|
48
|
+
|
|
49
|
+
return initialize_server(args)
|
|
50
|
+
case "list":
|
|
51
|
+
from .commands import list_projects
|
|
52
|
+
|
|
53
|
+
return list_projects(args)
|
|
54
|
+
case "op_grant":
|
|
55
|
+
from .commands import op_grant
|
|
56
|
+
|
|
57
|
+
return op_grant(args)
|
|
58
|
+
case "op_list":
|
|
59
|
+
from .commands import op_list
|
|
60
|
+
|
|
61
|
+
return op_list(args)
|
|
62
|
+
case "op_revoke":
|
|
63
|
+
from .commands import op_revoke
|
|
64
|
+
|
|
65
|
+
return op_revoke(args)
|
|
66
|
+
case "remove":
|
|
67
|
+
from .commands import remove_projects
|
|
68
|
+
|
|
69
|
+
return remove_projects(args)
|
|
70
|
+
case "search":
|
|
71
|
+
from .commands import search_projects
|
|
72
|
+
|
|
73
|
+
return search_projects(args)
|
|
74
|
+
case "show":
|
|
75
|
+
from .commands import show_projects
|
|
76
|
+
|
|
77
|
+
return show_projects(args)
|
|
78
|
+
case "start":
|
|
79
|
+
from .commands import start_server
|
|
112
80
|
|
|
81
|
+
return start_server(args)
|
|
82
|
+
case "status":
|
|
83
|
+
from .commands import server_status
|
|
84
|
+
|
|
85
|
+
return server_status(args)
|
|
86
|
+
case "stop":
|
|
87
|
+
from .commands import stop_server
|
|
88
|
+
|
|
89
|
+
return stop_server(args)
|
|
90
|
+
case "update":
|
|
91
|
+
from .commands import update_projects
|
|
92
|
+
|
|
93
|
+
return update_projects(args)
|
|
94
|
+
case "whitelist_add":
|
|
95
|
+
from .commands import whitelist_add
|
|
96
|
+
|
|
97
|
+
return whitelist_add(args)
|
|
98
|
+
case "whitelist_list":
|
|
99
|
+
from .commands import whitelist_list
|
|
100
|
+
|
|
101
|
+
return whitelist_list(args)
|
|
102
|
+
case "whitelist_remove":
|
|
103
|
+
from .commands import whitelist_remove
|
|
104
|
+
|
|
105
|
+
return whitelist_remove(args)
|
|
106
|
+
case _:
|
|
107
|
+
import logging
|
|
108
|
+
|
|
109
|
+
logger = logging.getLogger(__name__)
|
|
110
|
+
|
|
111
|
+
logger.error(f"Unknown command: {command_name}")
|
|
112
|
+
return 1
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def main() -> int:
|
|
116
|
+
# Parser Setup
|
|
113
117
|
parser = argparse.ArgumentParser(
|
|
114
118
|
prog="mcserver",
|
|
115
119
|
description="A CLI tool for managing Minecraft: Java Edition servers.",
|
|
@@ -220,6 +224,18 @@ def main() -> int:
|
|
|
220
224
|
|
|
221
225
|
op_list_command.set_defaults(command_name="op_list")
|
|
222
226
|
|
|
227
|
+
# 'op revoke'
|
|
228
|
+
op_revoke_command = op_subcommands.add_parser(
|
|
229
|
+
"revoke",
|
|
230
|
+
help="Revoke operator players permission",
|
|
231
|
+
description="Revoke operator players permission.",
|
|
232
|
+
)
|
|
233
|
+
|
|
234
|
+
op_revoke_command.set_defaults(command_name="op_revoke")
|
|
235
|
+
op_revoke_command.add_argument(
|
|
236
|
+
"players", nargs="+", type=str, help="List of player names or UUIDs"
|
|
237
|
+
)
|
|
238
|
+
|
|
223
239
|
# 'search' command
|
|
224
240
|
search_command = commands.add_parser(
|
|
225
241
|
"search",
|
|
@@ -328,5 +344,17 @@ def main() -> int:
|
|
|
328
344
|
|
|
329
345
|
whitelist_list_command.set_defaults(command_name="whitelist_list")
|
|
330
346
|
|
|
347
|
+
# 'whitelist remove'
|
|
348
|
+
whitelist_remove_command = whitelist_subcommands.add_parser(
|
|
349
|
+
"remove",
|
|
350
|
+
help="Remove players from the whitelist",
|
|
351
|
+
description="Remove players from the whitelist.",
|
|
352
|
+
)
|
|
353
|
+
|
|
354
|
+
whitelist_remove_command.set_defaults(command_name="whitelist_remove")
|
|
355
|
+
whitelist_remove_command.add_argument(
|
|
356
|
+
"players", nargs="+", type=str, help="List of player names or UUIDs"
|
|
357
|
+
)
|
|
358
|
+
|
|
331
359
|
args = parser.parse_args()
|
|
332
360
|
return args.func(args)
|
mcserver/commands/__init__.py
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
from .
|
|
2
|
-
from .import_setup import
|
|
3
|
-
from .
|
|
4
|
-
from .list_projects import
|
|
5
|
-
from .op_grant import
|
|
6
|
-
from .op_list import
|
|
7
|
-
from .op_revoke import
|
|
8
|
-
from .print_help import
|
|
9
|
-
from .remove_projects import
|
|
10
|
-
from .
|
|
11
|
-
from .server_status import
|
|
12
|
-
from .
|
|
13
|
-
from .
|
|
14
|
-
from .
|
|
15
|
-
from .update_projects import
|
|
16
|
-
from .whitelist_add import
|
|
17
|
-
from .whitelist_list import
|
|
18
|
-
from .whitelist_remove import
|
|
1
|
+
from .add_projects import run as add_projects
|
|
2
|
+
from .import_setup import run as import_setup
|
|
3
|
+
from .initialize_server import run as initialize_server
|
|
4
|
+
from .list_projects import run as list_projects
|
|
5
|
+
from .op_grant import run as op_grant
|
|
6
|
+
from .op_list import run as op_list
|
|
7
|
+
from .op_revoke import run as op_revoke
|
|
8
|
+
from .print_help import run as print_help
|
|
9
|
+
from .remove_projects import run as remove_projects
|
|
10
|
+
from .search_projects import run as search_projects
|
|
11
|
+
from .server_status import run as server_status
|
|
12
|
+
from .show_projects import run as show_projects
|
|
13
|
+
from .start_server import run as start_server
|
|
14
|
+
from .stop_server import run as stop_server
|
|
15
|
+
from .update_projects import run as update_projects
|
|
16
|
+
from .whitelist_add import run as whitelist_add
|
|
17
|
+
from .whitelist_list import run as whitelist_list
|
|
18
|
+
from .whitelist_remove import run as whitelist_remove
|
|
19
19
|
|
|
20
20
|
__all__ = [
|
|
21
|
-
"
|
|
21
|
+
"add_projects",
|
|
22
22
|
"import_setup",
|
|
23
|
-
"
|
|
23
|
+
"initialize_server",
|
|
24
24
|
"list_projects",
|
|
25
25
|
"op_grant",
|
|
26
26
|
"op_list",
|
|
27
27
|
"op_revoke",
|
|
28
28
|
"print_help",
|
|
29
29
|
"remove_projects",
|
|
30
|
-
"
|
|
30
|
+
"search_projects",
|
|
31
31
|
"server_status",
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
32
|
+
"show_projects",
|
|
33
|
+
"start_server",
|
|
34
|
+
"stop_server",
|
|
35
35
|
"update_projects",
|
|
36
36
|
"whitelist_add",
|
|
37
37
|
"whitelist_list",
|
|
@@ -3,7 +3,7 @@ from argparse import Namespace
|
|
|
3
3
|
|
|
4
4
|
from .. import config, paths, shared
|
|
5
5
|
from ..modrinth import apis as modrinth_apis
|
|
6
|
-
from ..modrinth import project_records
|
|
6
|
+
from ..modrinth import project_records
|
|
7
7
|
from ..resolver import (
|
|
8
8
|
Dependency,
|
|
9
9
|
human_to_resolver,
|
|
@@ -13,13 +13,18 @@ from ..resolver import (
|
|
|
13
13
|
|
|
14
14
|
logger = logging.getLogger(__name__)
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
|
|
17
|
+
def run(args: Namespace) -> int:
|
|
17
18
|
projects: list[str] = args.projects
|
|
18
19
|
|
|
19
20
|
if not (paths.configs_dir / "server.json").exists():
|
|
20
|
-
logger.error(
|
|
21
|
+
logger.error(
|
|
22
|
+
"Configuration file for server does not exist, is server initialized?"
|
|
23
|
+
)
|
|
21
24
|
|
|
22
|
-
server_config = config.read_config(
|
|
25
|
+
server_config = config.read_config(
|
|
26
|
+
"server", shared.default_configs["server"]["format_version"]
|
|
27
|
+
)
|
|
23
28
|
game_version = server_config["game_version"]
|
|
24
29
|
loader_name = server_config["loader"]["name"]
|
|
25
30
|
|
|
@@ -35,11 +40,12 @@ def add(args: Namespace) -> int:
|
|
|
35
40
|
dependencies: list[Dependency] = []
|
|
36
41
|
if project_records.record_exists(project_id):
|
|
37
42
|
project_record = project_records.read_record(project_id)
|
|
38
|
-
for dependency_id, dependency_type in project_record[
|
|
39
|
-
dependencies
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
for dependency_id, dependency_type in project_record[
|
|
44
|
+
"dependencies"
|
|
45
|
+
].items():
|
|
46
|
+
dependencies.append(
|
|
47
|
+
{"project_id": dependency_id, "dependency_type": dependency_type}
|
|
48
|
+
)
|
|
43
49
|
|
|
44
50
|
else:
|
|
45
51
|
project_version = modrinth_apis.get_project_versions(
|
|
@@ -64,7 +70,9 @@ def add(args: Namespace) -> int:
|
|
|
64
70
|
|
|
65
71
|
return human_to_resolver(dependencies)
|
|
66
72
|
|
|
67
|
-
resolved_dependencies = resolve_dependencies(
|
|
73
|
+
resolved_dependencies = resolve_dependencies(
|
|
74
|
+
projects, get_dependencies, required_only
|
|
75
|
+
)
|
|
68
76
|
print(resolved_dependencies)
|
|
69
77
|
return 0
|
|
70
78
|
|
|
@@ -154,7 +162,6 @@ def add(args: Namespace) -> int:
|
|
|
154
162
|
# ]
|
|
155
163
|
# return a
|
|
156
164
|
|
|
157
|
-
|
|
158
165
|
# server_config = config.read_config(
|
|
159
166
|
# "server", shared.default_configs["server"]["format_version"]
|
|
160
167
|
# )
|
mcserver/commands/op_grant.py
CHANGED
mcserver/commands/op_list.py
CHANGED
|
@@ -1,32 +1,35 @@
|
|
|
1
|
+
import logging
|
|
1
2
|
from argparse import Namespace
|
|
2
3
|
|
|
4
|
+
from ..server_files import ops
|
|
5
|
+
from ..shared import pluralize
|
|
3
6
|
|
|
4
|
-
|
|
5
|
-
import logging as log
|
|
7
|
+
logger = logging.getLogger(__name__)
|
|
6
8
|
|
|
7
|
-
from ..server_files import ops
|
|
8
|
-
from ..shared import pluralize
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
def run(args: Namespace) -> int:
|
|
11
|
+
ops_file = ops.ops_file_path
|
|
12
|
+
if not ops_file.exists():
|
|
13
|
+
logger.error(f"Operator file '{ops.ops_file_path}' not found.")
|
|
12
14
|
return 1
|
|
13
15
|
|
|
14
16
|
operator_players = ops.list_players()
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
player_count = len(operator_players)
|
|
19
|
+
if player_count == 0:
|
|
20
|
+
logger.info("There's no operator player.")
|
|
21
|
+
return 0
|
|
22
|
+
|
|
23
|
+
player_list: list[str] = []
|
|
17
24
|
for player in operator_players:
|
|
18
|
-
|
|
25
|
+
player_list.append(
|
|
19
26
|
f"{player['player_name']} ({player['player_uuid']}) Level: {player['permission_level']}"
|
|
20
27
|
)
|
|
21
28
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
player_count = len(operator_players)
|
|
26
|
-
if player_count == 0:
|
|
27
|
-
log.info("There's no operator player.")
|
|
28
|
-
return 0
|
|
29
|
+
logger.info(
|
|
30
|
+
f"There {pluralize('is', player_count)} {player_count} {pluralize('operator', player_count)}:"
|
|
31
|
+
)
|
|
29
32
|
|
|
30
|
-
|
|
31
|
-
print(
|
|
33
|
+
player_list.sort()
|
|
34
|
+
print("\n".join(player_list))
|
|
32
35
|
return 0
|
mcserver/commands/op_revoke.py
CHANGED
|
@@ -1,9 +1,43 @@
|
|
|
1
|
+
import logging
|
|
1
2
|
from argparse import Namespace
|
|
3
|
+
from uuid import UUID
|
|
2
4
|
|
|
5
|
+
from ..server_files import ops
|
|
6
|
+
from ..shared import pluralize
|
|
3
7
|
|
|
4
|
-
|
|
5
|
-
players: list[str] = args.players
|
|
6
|
-
import logging as log
|
|
8
|
+
logger = logging.getLogger(__name__)
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
|
|
11
|
+
def run(args: Namespace) -> int:
|
|
12
|
+
player_identifiers: list[str] = args.players
|
|
13
|
+
|
|
14
|
+
player_uuids: list[UUID] = []
|
|
15
|
+
player_names: list[str] = []
|
|
16
|
+
for player in player_identifiers:
|
|
17
|
+
if len(player) > 16:
|
|
18
|
+
logger.debug(f"{player} is probably an UUID")
|
|
19
|
+
player_uuids.append(UUID(player))
|
|
20
|
+
else:
|
|
21
|
+
logger.debug(f"{player} is probably a name")
|
|
22
|
+
player_names.append(player)
|
|
23
|
+
|
|
24
|
+
removed_players = ops.remove_players(player_uuids, player_names)
|
|
25
|
+
|
|
26
|
+
player_count: int = len(removed_players)
|
|
27
|
+
if player_count == 0:
|
|
28
|
+
logger.info("No matching player found.")
|
|
29
|
+
return 0
|
|
30
|
+
|
|
31
|
+
player_list: list[str] = []
|
|
32
|
+
for player in removed_players:
|
|
33
|
+
player_list.append(
|
|
34
|
+
f"{player['player_name']} ({player['player_uuid']}) Level: {player['permission_level']}"
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
logger.info(
|
|
38
|
+
f"There {pluralize('is', player_count)} {player_count} operator {pluralize('player', player_count)} that {pluralize('is', player_count)} removed:"
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
player_list.sort()
|
|
42
|
+
print("\n".join(player_list))
|
|
43
|
+
return 0
|
mcserver/commands/print_help.py
CHANGED
|
@@ -18,7 +18,7 @@ from ..shared import (
|
|
|
18
18
|
logger = logging.getLogger(__name__)
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
def
|
|
21
|
+
def run(args: Namespace) -> int:
|
|
22
22
|
search_query: list[str] = args.search_query
|
|
23
23
|
search_limit: int | None = args.search_limit
|
|
24
24
|
page_number: int = args.page_number
|
|
@@ -112,7 +112,7 @@ def search(args: Namespace) -> int:
|
|
|
112
112
|
search_facets.append([f"project_type:{project_label}"])
|
|
113
113
|
search_facets.append([f"categories:{loader_name}"])
|
|
114
114
|
else:
|
|
115
|
-
search_facets.append(["project_type:mod","project_type:plugin"])
|
|
115
|
+
search_facets.append(["project_type:mod", "project_type:plugin"])
|
|
116
116
|
|
|
117
117
|
search_info = f"Searching {pluralize(project_label, search_limit)}"
|
|
118
118
|
if search_query:
|
|
@@ -165,17 +165,13 @@ def search(args: Namespace) -> int:
|
|
|
165
165
|
for environment in environments:
|
|
166
166
|
readable_environments.append(project_environment_name(environment))
|
|
167
167
|
|
|
168
|
+
print(f"{hit['project_name']} ({slug_or_id}) {project_author}")
|
|
168
169
|
print(
|
|
169
|
-
f"{hit['
|
|
170
|
-
)
|
|
171
|
-
print(f"> Downloads: {format_number(hit['download_count'])} | Follows: {format_number(hit['follower_count'])}")
|
|
172
|
-
print(
|
|
173
|
-
f"> {', '.join(readable_environments)}"
|
|
170
|
+
f"> Downloads: {format_number(hit['download_count'])} | Follows: {format_number(hit['follower_count'])}"
|
|
174
171
|
)
|
|
172
|
+
print(f"> {', '.join(readable_environments)}")
|
|
175
173
|
print(f"> https://modrinth.com/{hit['all_project_types'][0]}/{slug_or_id}")
|
|
176
|
-
print(
|
|
177
|
-
f" {hit['short_description']}"
|
|
178
|
-
)
|
|
174
|
+
print(f" {hit['short_description']}")
|
|
179
175
|
|
|
180
176
|
if (count + 1) < len(search_hits):
|
|
181
177
|
print() # Print newline for readability
|