mcserver-cli 3.0.0__tar.gz → 4.0.0.dev0__tar.gz

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.
Files changed (102) hide show
  1. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/CHANGELOG.md +29 -3
  2. mcserver_cli-4.0.0.dev0/CONTRIBUTING.md +9 -0
  3. mcserver_cli-4.0.0.dev0/LICENSE +9 -0
  4. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/NOTES.txt +101 -29
  5. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/PKG-INFO +22 -15
  6. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/README.md +20 -12
  7. mcserver_cli-4.0.0.dev0/a.py +72 -0
  8. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/pyproject.toml +2 -5
  9. mcserver_cli-4.0.0.dev0/src/mcserver/__init__.py +1 -0
  10. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/src/mcserver/app.py +13 -9
  11. mcserver_cli-4.0.0.dev0/src/mcserver/caching.py +16 -0
  12. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/src/mcserver/cli.py +117 -71
  13. mcserver_cli-4.0.0.dev0/src/mcserver/commands/add_projects.py +148 -0
  14. mcserver_cli-4.0.0.dev0/src/mcserver/commands/import_setup.py +9 -0
  15. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/src/mcserver/commands/initialize_server.py +17 -4
  16. mcserver_cli-4.0.0.dev0/src/mcserver/commands/list_projects.py +8 -0
  17. mcserver_cli-4.0.0.dev0/src/mcserver/commands/op_grant.py +9 -0
  18. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/src/mcserver/commands/op_list.py +4 -4
  19. mcserver_cli-4.0.0.dev0/src/mcserver/commands/op_revoke.py +9 -0
  20. mcserver_cli-4.0.0.dev0/src/mcserver/commands/remove_projects.py +8 -0
  21. mcserver_cli-4.0.0.dev0/src/mcserver/commands/search_projects.py +109 -0
  22. mcserver_cli-4.0.0.dev0/src/mcserver/commands/server_status.py +8 -0
  23. mcserver_cli-4.0.0.dev0/src/mcserver/commands/show_projects.py +29 -0
  24. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/src/mcserver/commands/start_server.py +22 -9
  25. mcserver_cli-4.0.0.dev0/src/mcserver/commands/stop_server.py +30 -0
  26. mcserver_cli-4.0.0.dev0/src/mcserver/commands/update_projects.py +8 -0
  27. mcserver_cli-4.0.0.dev0/src/mcserver/commands/whitelist_add.py +9 -0
  28. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/src/mcserver/commands/whitelist_list.py +4 -3
  29. mcserver_cli-4.0.0.dev0/src/mcserver/commands/whitelist_remove.py +33 -0
  30. mcserver_cli-4.0.0.dev0/src/mcserver/config.py +66 -0
  31. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/src/mcserver/constants.py +0 -2
  32. mcserver_cli-4.0.0.dev0/src/mcserver/mcserver_v2.0.0.py +1119 -0
  33. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/src/mcserver/metadata.py +2 -2
  34. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/src/mcserver/modrinth/api.py +158 -47
  35. mcserver_cli-4.0.0.dev0/src/mcserver/modrinth/apis/__init__.py +9 -0
  36. mcserver_cli-4.0.0.dev0/src/mcserver/modrinth/apis/get_project_informations.py +216 -0
  37. mcserver_cli-4.0.0.dev0/src/mcserver/modrinth/apis/get_project_versions.py +131 -0
  38. mcserver_cli-4.0.0.dev0/src/mcserver/modrinth/apis/search_projects.py +122 -0
  39. mcserver_cli-4.0.0.dev0/src/mcserver/modrinth/constants.py +1 -0
  40. mcserver_cli-4.0.0.dev0/src/mcserver/modrinth/paths.py +3 -0
  41. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/src/mcserver/modrinth/project_records/relationships.py +5 -3
  42. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/src/mcserver/modrinth/project_records/shared.py +1 -2
  43. mcserver_cli-4.0.0.dev0/src/mcserver/modrinth/project_records.py +104 -0
  44. mcserver_cli-4.0.0.dev0/src/mcserver/modrinth/shared.py +93 -0
  45. mcserver_cli-4.0.0.dev0/src/mcserver/modrinth/slug_index.py +132 -0
  46. mcserver_cli-4.0.0.dev0/src/mcserver/modrinth/typings/__init__.py +38 -0
  47. mcserver_cli-4.0.0.dev0/src/mcserver/modrinth/typings/project_informations.py +137 -0
  48. mcserver_cli-4.0.0.dev0/src/mcserver/modrinth/typings/search_projects.py +94 -0
  49. mcserver_cli-4.0.0.dev0/src/mcserver/modrinth/typings/shared.py +17 -0
  50. mcserver_cli-4.0.0.dev0/src/mcserver/mysterious.py +25 -0
  51. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/src/mcserver/networking.py +14 -7
  52. mcserver_cli-4.0.0.dev0/src/mcserver/paths.py +18 -0
  53. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/src/mcserver/resolver.py +63 -14
  54. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/src/mcserver/server_files/properties.py +8 -7
  55. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/src/mcserver/server_files/whitelist.py +60 -39
  56. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/src/mcserver/shared.py +59 -17
  57. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/src/mcserver/state.py +22 -14
  58. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/zip_app.py +12 -6
  59. mcserver_cli-3.0.0/LICENSE +0 -9
  60. mcserver_cli-3.0.0/mcserver_search.txt +0 -20
  61. mcserver_cli-3.0.0/mcserver_test.py +0 -23
  62. mcserver_cli-3.0.0/src/mcserver/__init__.py +0 -1
  63. mcserver_cli-3.0.0/src/mcserver/caching.py +0 -0
  64. mcserver_cli-3.0.0/src/mcserver/commands/add_projects.py +0 -7
  65. mcserver_cli-3.0.0/src/mcserver/commands/import_setup.py +0 -6
  66. mcserver_cli-3.0.0/src/mcserver/commands/list_projects.py +0 -6
  67. mcserver_cli-3.0.0/src/mcserver/commands/op_grant.py +0 -7
  68. mcserver_cli-3.0.0/src/mcserver/commands/op_revoke.py +0 -7
  69. mcserver_cli-3.0.0/src/mcserver/commands/remove_projects.py +0 -6
  70. mcserver_cli-3.0.0/src/mcserver/commands/search_projects.py +0 -7
  71. mcserver_cli-3.0.0/src/mcserver/commands/server_status.py +0 -6
  72. mcserver_cli-3.0.0/src/mcserver/commands/show_projects.py +0 -26
  73. mcserver_cli-3.0.0/src/mcserver/commands/stop_server.py +0 -46
  74. mcserver_cli-3.0.0/src/mcserver/commands/update_projects.py +0 -6
  75. mcserver_cli-3.0.0/src/mcserver/commands/whitelist_add.py +0 -7
  76. mcserver_cli-3.0.0/src/mcserver/commands/whitelist_remove.py +0 -31
  77. mcserver_cli-3.0.0/src/mcserver/commandsa.py +0 -1297
  78. mcserver_cli-3.0.0/src/mcserver/config.py +0 -37
  79. mcserver_cli-3.0.0/src/mcserver/modrinth/shared.py +0 -13
  80. mcserver_cli-3.0.0/src/mcserver/modrinth/slug_index.py +0 -36
  81. mcserver_cli-3.0.0/src/mcserver/mysterious.py +0 -5
  82. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/.gitignore +0 -0
  83. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/src/__main__.py +0 -0
  84. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/src/mcserver/__main__.py +0 -0
  85. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/src/mcserver/commands/__init__.py +1 -1
  86. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/src/mcserver/commands/print_help.py +0 -0
  87. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/src/mcserver/fabricmc/meta.py +0 -0
  88. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/src/mcserver/legacyfabric/meta.py +0 -0
  89. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/src/mcserver/minecraft/api.py +0 -0
  90. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/src/mcserver/minecraft/player_identity.py +0 -0
  91. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/src/mcserver/modrinth/modpack.py +0 -0
  92. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/src/mcserver/modrinth/project_records/metadata.py +0 -0
  93. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/src/mcserver/modrinth/projects.py +0 -0
  94. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/src/mcserver/mojang/eula.py +0 -0
  95. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/src/mcserver/mojang/manifest.py +0 -0
  96. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/src/mcserver/papermc/api.py +0 -0
  97. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/src/mcserver/purpurmc/api.py +0 -0
  98. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/src/mcserver/quiltmc/meta.py +0 -0
  99. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/src/mcserver/server_files/banned_ips.py +0 -0
  100. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/src/mcserver/server_files/banned_players.py +0 -0
  101. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/src/mcserver/server_files/ops.py +0 -0
  102. {mcserver_cli-3.0.0 → mcserver_cli-4.0.0.dev0}/src/mcserver/server_files/usercaches.py +0 -0
@@ -9,9 +9,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  ### Added
11
11
 
12
- - Paper and Purpur as server software
12
+ - New `--game-version` and `--loader` options to the `search` command
13
+ - New `--search-sort` and `--search-limit` options to the `init` command
14
+ -
15
+
16
+ ### Changed
17
+
18
+ - Better `search` info message
19
+ - slug_index.json is now a global cache
20
+
21
+ ### Fixes
22
+
23
+ - Typo in the `add` command help
24
+
25
+ ## [3.0.0] - 2026-08-18
26
+
27
+ ### Added
28
+
29
+ - Command to stop the Minecraft server
30
+ - Paper and Purpur server software
13
31
  - Metadata to keep information of what version of MCServer is used
14
- - State to keep information of a running MCServer to avoid conflict
32
+ - State to keep information of a running MCServer to avoid conflicting command
33
+ - Listing whitelisted players
34
+ - Listing operator players
35
+
36
+ ### Changed
37
+
38
+ - Uh... add, search, and show, are being worked on (they're not available for now)
39
+ - The codebase is now bigger with small gain (for the user)
15
40
 
16
41
  ## [2.0.0] - 2026-06-14
17
42
 
@@ -187,7 +212,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
187
212
  - Better mod conflict error
188
213
  - Faster mod resolving
189
214
 
190
- [unreleased]: https://github.com/Othecat35/MCServer/compare/v2.0.0...HEAD
215
+ [unreleased]: https://github.com/Othecat35/MCServer/compare/v3.0.0...HEAD
216
+ [3.0.0]: https://github.com/Othecat35/MCServer/compare/v2.0.0...v3.0.0
191
217
  [2.0.0]: https://github.com/Othecat35/MCServer/compare/v1.13.16...v2.0.0
192
218
  [1.13.16]: https://github.com/Othecat35/MCServer/compare/v1.13.15...v1.13.16
193
219
  [1.13.15]: https://github.com/Othecat35/MCServer/compare/v1.13.14...v1.13.15
@@ -0,0 +1,9 @@
1
+ # License
2
+
3
+ By submitting a pull request, you agree that your contribution is licensed under the MIT License.
4
+
5
+ # Development
6
+
7
+ - Python >= 3.14
8
+ - Install with `pip install -e .`
9
+ - Use `black` to reformat code
@@ -0,0 +1,9 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2026 Othecat35
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -119,22 +119,27 @@ mod indexing, don't forget! don't remind me the... 3rd time?
119
119
  Gemini suggest adding "status" command and get ram usage info, sure but not now. oh good idea I guess
120
120
 
121
121
  Things that MCServer can touch (In theory):
122
+
123
+ XDG Cache
124
+ - mcserver
125
+ - slug_index.json
126
+
127
+
128
+ Home Directory
129
+ - .cache # Failback if XDG Cache is not set
130
+ - mcserver
131
+ - slug_index.json
132
+
133
+
122
134
  Server Root
123
135
  - .mcserver/
124
- - caches/
125
- - modrinth/
126
- - versions/
127
- - <project_id>.json
128
136
  - configs/
129
137
  - launcher.json
130
138
  - modrinth.json
131
139
  - server.json
132
140
  - modrinth/
133
- - slug_index.json
134
- - projects/
135
- - <project_id>
136
- - metadata.json
137
- - relationships.json
141
+ - projects_records/
142
+ - <project_id>.json
138
143
  - tempfiles/
139
144
  - <file_hash>
140
145
  - <url_hash> #if file hash does not exist, use hash from digesting the URL
@@ -239,32 +244,99 @@ I definitely broke my promise. (oops)
239
244
  - init command could take some sort of "target dir"
240
245
  - make src/mcserver/modrinth/projects.py into a dir, ans inside it we have metadata.py and relationship.py
241
246
  - flowchart TD
242
- A[Did you fix a bug?]
243
- A -- Yes --> B[It's fix]
244
- A -- No --> C[Did you change functionality or affect UI?]
247
+ A[Did you fix a bug?]
248
+ A -- Yes --> B[It's fix]
249
+
250
+ A -- No --> C[Did you change functionality or affect UI?]
251
+ C -- Yes --> D[It's feat]
252
+
253
+ C -- No --> E[Did you add or change tests?]
254
+ E -- Yes --> F[It's test]
245
255
 
246
- C -- Yes --> D[It's feat]
247
- C -- No --> E[Did you add or change tests?]
256
+ E -- No --> G[Did you change code style or formatting?]
257
+ G -- Yes --> H[It's style]
248
258
 
249
- E -- Yes --> F[It's test]
250
- E -- No --> G[Did you change code style or formatting?]
259
+ G -- No --> I[Did you make changes to documentation?]
260
+ I -- Yes --> J[It's docs]
251
261
 
252
- G -- Yes --> H[It's style]
253
- G -- No --> I[Did you make changes to documentation?]
262
+ I -- No --> K[Did you change things related to build or deploy operations?]
263
+ K -- Yes --> L[It's build]
254
264
 
255
- I -- Yes --> J[It's docs]
256
- I -- No --> K[Did you change things related to build or deploy operations?]
265
+ K -- No --> M[Did you change something related to devops, infrastructure or backups?]
266
+ M -- Yes --> N[It's ops]
257
267
 
258
- K -- Yes --> L[It's build]
259
- K -- No --> M[Did you change something related to devops, infrastructure or backups?]
268
+ M -- No --> O[Did you complete a maintenance task or other non-code task?]
269
+ O -- Yes --> P[It's chore]
260
270
 
261
- M -- Yes --> N[It's ops]
262
- M -- No --> O[Did you complete a maintenance task or other non-code task?]
271
+ O -- No --> Q[Did you rewrite or restructure code specifically for performance?]
272
+ Q -- Yes --> R[It's perf]
263
273
 
264
- O -- Yes --> P[It's chore]
265
- O -- No --> Q[Did you rewrite or restructure code specifically for performance?]
274
+ Q -- No --> S[It's refactor]
266
275
 
267
- Q -- Yes --> R[It's perf]
268
- Q -- No --> S[It's refactor]
269
276
  - commit convention reference: https://gist.github.com/qoomon/5dfcdf8eec66a051ecd85625518cfd13
270
- - or more "official" looking: https://www.conventionalcommits.org/en/v1.0.0/
277
+ - or more "official" looking: https://www.conventionalcommits.org/en/v1.0.0/
278
+
279
+ Othecat35's Development Setup (For anyone if wondering):
280
+ - VSCodium
281
+ - Extensions:
282
+ Pyright
283
+ Python
284
+
285
+ that's all lol
286
+
287
+
288
+ so, Modrinth has new way to represent which mod go to which environment right?
289
+ so it make the older 'server_side' and 'client_side' obselete.
290
+ but, most of my code rely on them.
291
+ what if, I make a 'translator' between the new 'environment' and the old '*_side'?
292
+ "How can you do that?" said Othecat35.
293
+ well, just convert one value into two values. like if the environment is 'client_and_server',
294
+ then the server_side is required and server_side is required
295
+ required = you need this mod on this side
296
+ recommended = this mod is recommended to be installed on this side
297
+ optional = you can have this mod in this side, or not
298
+ unsupported = basically this side is a side effect (it works but uh...)
299
+ incompatible = this mod may crash on this side
300
+ unknown = the dev doesn't even know their mod, wth
301
+ the mapping table (as for 2026-09-05, basically the time I wrote this):
302
+ | environment | server side | client side |
303
+ |-------------------------------|---------------|---------------|
304
+ | client_and_server | required | required |
305
+ | client_only | unsupported | required |
306
+ | client_only_server_optional | optional | required |
307
+ | singleplayer_only | incompactible | required |
308
+ | server_only | required | unsupported |
309
+ | server_only_client_optional | required | optional |
310
+ | dedicated_server_only | required | incompactible |
311
+ | client_or_server | optional | optional |
312
+ | client_or_server_prefers_both | recommended | recommended |
313
+ | unknown | unknown | unknown |
314
+
315
+ todo: move src/mcserver/server to src/mcserver/minecraft/server
316
+ because it make more sense I think
317
+
318
+ the export command... ".mcserver" and ".mrpack" format.
319
+ .mrpack is Modrinth Modpack format, I already know that.
320
+ .mcserver? what's this? a custom format? why?
321
+ idk, maybe it can store the actual configs of the server
322
+ the mod relationships, the metadata, etc
323
+ the pros is can contain more metadata of the server.
324
+ okay. but why? idk, maybe it looks cool? yea sure.
325
+
326
+ warning for those who want to interact with .properties,
327
+ consider bring your own module and don't use my parser.
328
+ why? its not perfect, and, basically don't. I only make it
329
+ to work with Minecraft, properties files like server.properties
330
+ and eula.txt.
331
+
332
+ 4.0.0:
333
+ no add/remove for whitelist yet
334
+ no grant/revoke for op yet
335
+ no update command yet
336
+ and actually, no import command
337
+
338
+ for the remove command, I would use the resolver I already had. But it would be more complicated once we're dealing with mod that shared dependencies with other. I don't know ;-; I haven't even finished the add commad yet, but it is in incremental so don't rush me >:c
339
+ make a visualize command to visualize installed projects that output to graphviz format seems really cool
340
+ we should merge the metadata.json and relationships.json back into one file :o
341
+
342
+ look at myterious.py, idk why yiu thought it would be a good idea to make it more fun, and dynamic even.
@@ -1,15 +1,14 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: mcserver-cli
3
- Version: 3.0.0
3
+ Version: 4.0.0.dev0
4
4
  Summary: A CLI tool to manage Minecraft: Java Edition servers.
5
5
  Project-URL: Homepage, https://github.com/Othecat35/MCServer
6
6
  Project-URL: Repository, https://github.com/Othecat35/MCServer.git
7
7
  Project-URL: Changelog, https://github.com/Othecat35/MCServer/blob/main/CHANGELOG.md
8
8
  Author-email: Othecat35 <othecat35@gmail.com>
9
- Maintainer-email: Othecat35 <othecat35@gmail.com>
10
9
  License-Expression: MIT
11
10
  License-File: LICENSE
12
- Requires-Python: >=3.14
11
+ Requires-Python: >=3.12
13
12
  Description-Content-Type: text/markdown
14
13
 
15
14
  # MCServer
@@ -22,10 +21,13 @@ Supported platforms:
22
21
  - and Termux.
23
22
 
24
23
  ## Requirements
25
- - Python 3.14 or newer
24
+ - Python 3.12 or newer (Python 3.14 is recommended)
26
25
  - JRE (depends on Minecraft version)
27
26
 
28
27
  ## How to install
28
+ - Using pip:
29
+ 1. Run `pip install mcserver-cli`
30
+
29
31
  - System-wide (Requires root):
30
32
  1. Download the `mcserver` script file from GitHub releases
31
33
  2. Move the file to `/usr/local/bin`
@@ -40,24 +42,29 @@ Supported platforms:
40
42
  - Run `fish_add_path ~/bin` if you're using FISH
41
43
 
42
44
  ## Usage
43
- - Add mods (and its dependencies): `mcserver add <mods>`
44
- - Import a modpack: `mcserver import [file]`
45
- - Initialize the server: `mcserver init [options]`
46
- - Manage operator status: `mcserver op`
47
- - Search mods from Modrinth: `mcserver search [<query>] [options]`
48
- - Show mod information from Modrinth: `mcserver show <mods>`
45
+ - Initialize a server: `mcserver init [options]`
46
+ - List operator players: `mcserver op list`
49
47
  - Start the server: `mcserver start`
50
48
  - Stop the server: `mcserver stop`
51
- - Manage the whitelist: `mcserver whitelist`
49
+ - List whitelisted players: `mcserver whitelist list`
52
50
 
53
51
  ### Example
52
+ - Create a 1.20.1 Fabric (0.19.5) server on current directory
54
53
  ```bash
55
- mcserver init --mc-version=1.20.1 --loader=fabric --loader-version=0.19.3
56
- mcserver search --no-filter thdilos
57
- mcserver show thdilos-fox-origin thdilos-fox-origin-expanded
58
- mcserver add thdilos-fox-origin-expanded lithium tick-stasis ferrite-core krypton
54
+ mcserver init --mc-version=1.20.1 --loader=fabric --loader-version=0.19.5
59
55
  mcserver start
60
56
  ```
61
57
 
58
+ - List all operator and whitelisted players on current directory
59
+ ```bash
60
+ mcserver op list
61
+ mcserver whitelist list
62
+ ```
63
+ - Stop (sigterm) a server on current directory
64
+ ```bash
65
+ mcserver stop
66
+ ```
67
+
68
+
62
69
  ## Note
63
70
  This is a **Personal Project**, things may be unstable.
@@ -8,10 +8,13 @@ Supported platforms:
8
8
  - and Termux.
9
9
 
10
10
  ## Requirements
11
- - Python 3.14 or newer
11
+ - Python 3.12 or newer (Python 3.14 is recommended)
12
12
  - JRE (depends on Minecraft version)
13
13
 
14
14
  ## How to install
15
+ - Using pip:
16
+ 1. Run `pip install mcserver-cli`
17
+
15
18
  - System-wide (Requires root):
16
19
  1. Download the `mcserver` script file from GitHub releases
17
20
  2. Move the file to `/usr/local/bin`
@@ -26,24 +29,29 @@ Supported platforms:
26
29
  - Run `fish_add_path ~/bin` if you're using FISH
27
30
 
28
31
  ## Usage
29
- - Add mods (and its dependencies): `mcserver add <mods>`
30
- - Import a modpack: `mcserver import [file]`
31
- - Initialize the server: `mcserver init [options]`
32
- - Manage operator status: `mcserver op`
33
- - Search mods from Modrinth: `mcserver search [<query>] [options]`
34
- - Show mod information from Modrinth: `mcserver show <mods>`
32
+ - Initialize a server: `mcserver init [options]`
33
+ - List operator players: `mcserver op list`
35
34
  - Start the server: `mcserver start`
36
35
  - Stop the server: `mcserver stop`
37
- - Manage the whitelist: `mcserver whitelist`
36
+ - List whitelisted players: `mcserver whitelist list`
38
37
 
39
38
  ### Example
39
+ - Create a 1.20.1 Fabric (0.19.5) server on current directory
40
40
  ```bash
41
- mcserver init --mc-version=1.20.1 --loader=fabric --loader-version=0.19.3
42
- mcserver search --no-filter thdilos
43
- mcserver show thdilos-fox-origin thdilos-fox-origin-expanded
44
- mcserver add thdilos-fox-origin-expanded lithium tick-stasis ferrite-core krypton
41
+ mcserver init --mc-version=1.20.1 --loader=fabric --loader-version=0.19.5
45
42
  mcserver start
46
43
  ```
47
44
 
45
+ - List all operator and whitelisted players on current directory
46
+ ```bash
47
+ mcserver op list
48
+ mcserver whitelist list
49
+ ```
50
+ - Stop (sigterm) a server on current directory
51
+ ```bash
52
+ mcserver stop
53
+ ```
54
+
55
+
48
56
  ## Note
49
57
  This is a **Personal Project**, things may be unstable.
@@ -0,0 +1,72 @@
1
+ from typing import (
2
+ Literal,
3
+ Optional,
4
+ TypeAlias,
5
+ Union,
6
+ get_args,
7
+ get_origin,
8
+ get_type_hints,
9
+ )
10
+
11
+ # ---------- Define the same Literal three ways ----------
12
+ type EnvModern = Literal["a", "b", "c"] # PEP 695 (what you use)
13
+ EnvClassic: TypeAlias = Literal["a", "b", "c"] # 3.10 style
14
+ inline = Literal["a", "b", "c"] # plain value, no alias
15
+
16
+
17
+ def show(label, fn):
18
+ try:
19
+ print(f"{label:48} → {fn()!r}")
20
+ except Exception as e:
21
+ print(f"{label:48} → {type(e).__name__}: {e}")
22
+
23
+
24
+ print("=== PEP 695 `type` alias ===")
25
+ print(f"type(EnvModern) = {type(EnvModern)}")
26
+ show("get_args(EnvModern)", lambda: get_args(EnvModern))
27
+ show("EnvModern.__value__", lambda: EnvModern.__value__)
28
+ show("get_args(EnvModern.__value__)", lambda: get_args(EnvModern.__value__))
29
+ show("EnvModern.__value__.__args__", lambda: EnvModern.__value__.__args__)
30
+ show("EnvModern.__args__", lambda: EnvModern.__args__)
31
+ show("get_origin(EnvModern)", lambda: get_origin(EnvModern))
32
+ show("get_origin(EnvModern.__value__)", lambda: get_origin(EnvModern.__value__))
33
+ show(
34
+ "frozenset(get_args(EnvModern.__value__))",
35
+ lambda: frozenset(get_args(EnvModern.__value__)),
36
+ )
37
+ show("EnvModern.__parameters__", lambda: EnvModern.__parameters__)
38
+
39
+ print("\n=== Traditional `TypeAlias` ===")
40
+ print(f"type(EnvClassic) = {type(EnvClassic)}")
41
+ show("get_args(EnvClassic)", lambda: get_args(EnvClassic))
42
+ show("EnvClassic.__args__", lambda: EnvClassic.__args__)
43
+ show("get_origin(EnvClassic)", lambda: get_origin(EnvClassic))
44
+
45
+ print("\n=== Inline `Literal` ===")
46
+ print(f"type(inline) = {type(inline)}")
47
+ show("get_args(inline)", lambda: get_args(inline))
48
+ show("inline.__args__", lambda: inline.__args__)
49
+
50
+ print("\n=== Union / Optional (matters for NotRequired[X | None]) ===")
51
+ show("get_args(EnvModern | None)", lambda: get_args(EnvModern | None))
52
+ show("get_args(Union[EnvModern, None])", lambda: get_args(Union[EnvModern, None]))
53
+ show("get_args(Optional[EnvModern])", lambda: get_args(Optional[EnvModern]))
54
+ show("get_args(Union[EnvClassic, None])", lambda: get_args(Union[EnvClassic, None]))
55
+
56
+ type A = Literal["x", "y"]
57
+ type B = Literal["z"]
58
+ show("get_args(A | B)", lambda: get_args(A | B))
59
+ show("get_args(Union[A, B])", lambda: get_args(Union[A, B]))
60
+
61
+ print("\n=== get_type_hints (indirect path) ===")
62
+
63
+
64
+ def f(x: EnvModern) -> None: ...
65
+
66
+
67
+ try:
68
+ hints = get_type_hints(f)
69
+ print(f"hints['x'] = {hints['x']!r}")
70
+ show("get_args(hints['x'])", lambda: get_args(hints["x"]))
71
+ except Exception as e:
72
+ print(f"get_type_hints failed: {type(e).__name__}: {e}")
@@ -6,13 +6,10 @@ build-backend = "hatchling.build"
6
6
  name = "mcserver-cli"
7
7
  dynamic = ["version"]
8
8
  dependencies = []
9
- requires-python = ">= 3.14"
9
+ requires-python = ">=3.12"
10
10
  authors = [
11
11
  {name = "Othecat35", email = "othecat35@gmail.com"}
12
12
  ]
13
- maintainers = [
14
- { name = "Othecat35", email = "othecat35@gmail.com"}
15
- ]
16
13
  description = "A CLI tool to manage Minecraft: Java Edition servers."
17
14
  readme = "README.md"
18
15
  license = "MIT"
@@ -24,7 +21,7 @@ Repository = "https://github.com/Othecat35/MCServer.git"
24
21
  Changelog = "https://github.com/Othecat35/MCServer/blob/main/CHANGELOG.md"
25
22
 
26
23
  [project.scripts]
27
- mcserver = "mcserver:__main__"
24
+ mcserver = "mcserver.app:main"
28
25
 
29
26
  [tool.hatch.build.targets.wheel]
30
27
  packages = ["src/mcserver"]
@@ -0,0 +1 @@
1
+ __version__ = "4.0.0.dev0"
@@ -1,24 +1,28 @@
1
- def main() -> None:
1
+ def main():
2
2
  import sys
3
3
 
4
- if (sys.argv[1] if len(sys.argv) > 1 else "") == "cake":
5
- from .mysterious import nothing_to_see_here_move_along
6
-
7
- nothing_to_see_here_move_along()
8
-
9
- MIN_PYTHON_VERSION: tuple[int, int] = (3, 14)
4
+ MIN_PYTHON_VERSION: tuple[int, int] = (3, 12)
10
5
  if sys.version_info < MIN_PYTHON_VERSION:
11
6
  sys.exit(
12
7
  f"MCServer requires Python {'.'.join(map(str, MIN_PYTHON_VERSION))} or newer."
13
8
  )
14
9
 
10
+ if (sys.argv[1] if len(sys.argv) > 1 else "") == "uh...":
11
+ from .mysterious import nothing_to_see_here_move_along
12
+
13
+ nothing_to_see_here_move_along()
14
+
15
15
  import logging as log
16
16
  import os
17
17
 
18
18
  from . import cli
19
19
 
20
20
  debug_mode = os.getenv("MCSERVER_DEBUG") == "1"
21
- log_level = log.DEBUG if debug_mode else log.INFO
22
- log.basicConfig(level=log_level, format="[%(levelname)s]: %(message)s")
21
+ if debug_mode:
22
+ log.basicConfig(
23
+ level=log.DEBUG, format="[%(levelname)s] [%(module)s]: %(message)s"
24
+ )
25
+ else:
26
+ log.basicConfig(level=log.INFO, format="[%(levelname)s]: %(message)s")
23
27
 
24
28
  sys.exit(cli.main())
@@ -0,0 +1,16 @@
1
+ import os
2
+ from pathlib import Path
3
+
4
+ cache_dir = Path.home() / ".cache"
5
+
6
+ xdg_cache_dir = os.getenv("XDG_CACHE_DIR")
7
+ if xdg_cache_dir:
8
+ cache_dir = Path(xdg_cache_dir)
9
+
10
+ mcserver_cache_dir = cache_dir / "mcserver"
11
+
12
+
13
+ def create_file(file_name: str, file_data: bytes):
14
+ mcserver_cache_dir.mkdir(parents=True, exist_ok=True)
15
+ cache_file = mcserver_cache_dir / file_name
16
+ cache_file.write_bytes(file_data)