pumpkin-api-py 0.1.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.
Files changed (108) hide show
  1. componentize_py_async_support/__init__.py +570 -0
  2. componentize_py_async_support/futures.py +149 -0
  3. componentize_py_async_support/streams.py +345 -0
  4. componentize_py_runtime.pyi +40 -0
  5. componentize_py_types.py +32 -0
  6. poll_loop.py +440 -0
  7. pumpkin_api/__init__.py +41 -0
  8. pumpkin_api/build.py +68 -0
  9. pumpkin_api/impl.py +355 -0
  10. pumpkin_api/wit/advancement.wit +41 -0
  11. pumpkin_api/wit/attributes.wit +56 -0
  12. pumpkin_api/wit/bedrock-packets.wit +1709 -0
  13. pumpkin_api/wit/biomes.wit +72 -0
  14. pumpkin_api/wit/block-entity.wit +423 -0
  15. pumpkin_api/wit/boss-bar.wit +83 -0
  16. pumpkin_api/wit/command.wit +244 -0
  17. pumpkin_api/wit/common.wit +261 -0
  18. pumpkin_api/wit/context.wit +61 -0
  19. pumpkin_api/wit/damage-types.wit +57 -0
  20. pumpkin_api/wit/data-components.wit +117 -0
  21. pumpkin_api/wit/datapack.wit +54 -0
  22. pumpkin_api/wit/display.wit +171 -0
  23. pumpkin_api/wit/enchantments.wit +102 -0
  24. pumpkin_api/wit/entity-statuses.wit +68 -0
  25. pumpkin_api/wit/entity-types.wit +164 -0
  26. pumpkin_api/wit/entity.wit +1 -0
  27. pumpkin_api/wit/event.wit +2435 -0
  28. pumpkin_api/wit/forms.wit +51 -0
  29. pumpkin_api/wit/game-events.wit +67 -0
  30. pumpkin_api/wit/game-rules.wit +69 -0
  31. pumpkin_api/wit/gui.wit +39 -0
  32. pumpkin_api/wit/i18n.wit +21 -0
  33. pumpkin_api/wit/inventory.wit +78 -0
  34. pumpkin_api/wit/ipc.wit +7 -0
  35. pumpkin_api/wit/item-stack.wit +104 -0
  36. pumpkin_api/wit/java-dialogs.wit +155 -0
  37. pumpkin_api/wit/java-packets.wit +1838 -0
  38. pumpkin_api/wit/log.wit +14 -0
  39. pumpkin_api/wit/metadata.wit +19 -0
  40. pumpkin_api/wit/particles.wit +131 -0
  41. pumpkin_api/wit/permission.wit +46 -0
  42. pumpkin_api/wit/player.wit +1432 -0
  43. pumpkin_api/wit/plugin.wit +121 -0
  44. pumpkin_api/wit/potions.wit +52 -0
  45. pumpkin_api/wit/recipe.wit +88 -0
  46. pumpkin_api/wit/scheduler.wit +24 -0
  47. pumpkin_api/wit/scoreboard.wit +111 -0
  48. pumpkin_api/wit/screens.wit +31 -0
  49. pumpkin_api/wit/server.wit +286 -0
  50. pumpkin_api/wit/sounds.wit +1987 -0
  51. pumpkin_api/wit/statistics.wit +94 -0
  52. pumpkin_api/wit/status-effect.wit +54 -0
  53. pumpkin_api/wit/text.wit +68 -0
  54. pumpkin_api/wit/uuid.wit +16 -0
  55. pumpkin_api/wit/world.wit +1050 -0
  56. pumpkin_api_py-0.1.0.dist-info/METADATA +53 -0
  57. pumpkin_api_py-0.1.0.dist-info/RECORD +108 -0
  58. pumpkin_api_py-0.1.0.dist-info/WHEEL +4 -0
  59. pumpkin_api_py-0.1.0.dist-info/entry_points.txt +2 -0
  60. pumpkin_api_py-0.1.0.dist-info/licenses/LICENSE-APACHE +176 -0
  61. pumpkin_api_py-0.1.0.dist-info/licenses/LICENSE-MIT +21 -0
  62. wit_world/__init__.py +114 -0
  63. wit_world/exports/__init__.py +19 -0
  64. wit_world/exports/metadata.py +24 -0
  65. wit_world/imports/__init__.py +0 -0
  66. wit_world/imports/advancement.py +56 -0
  67. wit_world/imports/attributes.py +66 -0
  68. wit_world/imports/bedrock_packets.py +2413 -0
  69. wit_world/imports/biomes.py +81 -0
  70. wit_world/imports/block_entity.py +1353 -0
  71. wit_world/imports/boss_bar.py +137 -0
  72. wit_world/imports/command.py +705 -0
  73. wit_world/imports/common.py +335 -0
  74. wit_world/imports/context.py +91 -0
  75. wit_world/imports/damage_types.py +66 -0
  76. wit_world/imports/data_components.py +126 -0
  77. wit_world/imports/datapack.py +124 -0
  78. wit_world/imports/display.py +295 -0
  79. wit_world/imports/enchantments.py +129 -0
  80. wit_world/imports/entity_statuses.py +77 -0
  81. wit_world/imports/entity_types.py +173 -0
  82. wit_world/imports/event.py +3558 -0
  83. wit_world/imports/forms.py +98 -0
  84. wit_world/imports/game_events.py +76 -0
  85. wit_world/imports/game_rules.py +88 -0
  86. wit_world/imports/gui.py +81 -0
  87. wit_world/imports/i18n.py +35 -0
  88. wit_world/imports/inventory.py +159 -0
  89. wit_world/imports/ipc.py +20 -0
  90. wit_world/imports/item_stack.py +206 -0
  91. wit_world/imports/java_dialogs.py +208 -0
  92. wit_world/imports/java_packets.py +3560 -0
  93. wit_world/imports/logging.py +30 -0
  94. wit_world/imports/particles.py +140 -0
  95. wit_world/imports/permission.py +71 -0
  96. wit_world/imports/player.py +1753 -0
  97. wit_world/imports/potions.py +61 -0
  98. wit_world/imports/recipe.py +120 -0
  99. wit_world/imports/scheduler.py +44 -0
  100. wit_world/imports/scoreboard.py +167 -0
  101. wit_world/imports/screens.py +40 -0
  102. wit_world/imports/server.py +493 -0
  103. wit_world/imports/sounds.py +1996 -0
  104. wit_world/imports/statistics.py +103 -0
  105. wit_world/imports/status_effect.py +63 -0
  106. wit_world/imports/text.py +156 -0
  107. wit_world/imports/uuid.py +36 -0
  108. wit_world/imports/world.py +1640 -0
@@ -0,0 +1,493 @@
1
+ # This file is automatically generated by componentize-py
2
+ # It is not intended for manual editing.
3
+ from typing import TypeVar, Generic, Union, Optional, Protocol, Tuple, List, Any, Self, Callable
4
+ from types import TracebackType
5
+ from enum import Flag, Enum, auto
6
+ from dataclasses import dataclass
7
+ from abc import abstractmethod
8
+ import weakref
9
+
10
+ from componentize_py_types import Result, Ok, Err, Some
11
+ from ..imports import common
12
+ from ..imports import datapack
13
+ from ..imports import permission
14
+ from ..imports import text
15
+ from ..imports import advancement
16
+ from ..imports import enchantments
17
+ from ..imports import recipe
18
+ from ..imports import uuid
19
+ from ..imports import world
20
+ from ..imports import player
21
+
22
+ @dataclass
23
+ class OpEntry:
24
+ """
25
+ Represents an operator entry in the ops configuration.
26
+ """
27
+ uuid: uuid.Uuid
28
+ name: str
29
+ level: permission.PermissionLevel
30
+ bypasses_player_limit: bool
31
+
32
+ class OpManager:
33
+ """
34
+ Interface for querying and managing server operators.
35
+ """
36
+
37
+ def is_op(self, id: uuid.Uuid) -> bool:
38
+ """
39
+ Checks if a player UUID is currently an operator.
40
+ """
41
+ raise NotImplementedError
42
+ def get_op(self, id: uuid.Uuid) -> Optional[OpEntry]:
43
+ """
44
+ Retrieves the operator entry for a player UUID, if present.
45
+ """
46
+ raise NotImplementedError
47
+ def get_permission_level(self, id: uuid.Uuid) -> permission.PermissionLevel:
48
+ """
49
+ Gets the effective permission level for a player UUID (returns zero if not op).
50
+ """
51
+ raise NotImplementedError
52
+ def op_player(self, name: str, id: uuid.Uuid, level: permission.PermissionLevel, bypasses_player_limit: bool) -> None:
53
+ """
54
+ Grants operator status to a player (online or offline) with the specified level and bypass setting.
55
+ """
56
+ raise NotImplementedError
57
+ def deop_player(self, id: uuid.Uuid) -> bool:
58
+ """
59
+ Revokes operator status from a player (online or offline). Returns true if the player was previously op.
60
+ """
61
+ raise NotImplementedError
62
+ def list_ops(self) -> List[OpEntry]:
63
+ """
64
+ Returns a list of all operator entries on the server.
65
+ """
66
+ raise NotImplementedError
67
+ def __enter__(self) -> Self:
68
+ """Returns self"""
69
+ return self
70
+
71
+ def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
72
+ """
73
+ Release this resource.
74
+ """
75
+ raise NotImplementedError
76
+
77
+
78
+ @dataclass
79
+ class BannedPlayerEntry:
80
+ """
81
+ Represents a banned player entry in the ban list.
82
+ """
83
+ uuid: uuid.Uuid
84
+ name: str
85
+ created: str
86
+ source: str
87
+ expires: Optional[str]
88
+ reason: str
89
+
90
+ @dataclass
91
+ class BannedIpEntry:
92
+ """
93
+ Represents a banned IP entry in the IP ban list.
94
+ """
95
+ ip: str
96
+ created: str
97
+ source: str
98
+ expires: Optional[str]
99
+ reason: str
100
+
101
+ class BanManager:
102
+ """
103
+ Global manager for player and IP bans.
104
+ """
105
+
106
+ def is_player_banned(self, id: uuid.Uuid) -> bool:
107
+ """
108
+ Checks if a player UUID is currently banned.
109
+ """
110
+ raise NotImplementedError
111
+ def get_player_ban(self, id: uuid.Uuid) -> Optional[BannedPlayerEntry]:
112
+ """
113
+ Retrieves the ban entry for a player UUID, if banned.
114
+ """
115
+ raise NotImplementedError
116
+ def ban_player(self, name: str, id: uuid.Uuid, options: player.BanPlayerOptions) -> None:
117
+ """
118
+ Bans a player by name and UUID with the specified options (works for online and offline players).
119
+ """
120
+ raise NotImplementedError
121
+ def unban_player(self, id: uuid.Uuid) -> bool:
122
+ """
123
+ Removes a player ban by UUID. Returns true if the player was banned.
124
+ """
125
+ raise NotImplementedError
126
+ def list_player_bans(self) -> List[BannedPlayerEntry]:
127
+ """
128
+ Returns all currently active player bans.
129
+ """
130
+ raise NotImplementedError
131
+ def is_ip_banned(self, ip: str) -> bool:
132
+ """
133
+ Checks if an IP address is currently banned.
134
+ """
135
+ raise NotImplementedError
136
+ def get_ip_ban(self, ip: str) -> Optional[BannedIpEntry]:
137
+ """
138
+ Retrieves the ban entry for an IP address, if banned.
139
+ """
140
+ raise NotImplementedError
141
+ def ban_ip(self, ip: str, options: player.BanIpOptions) -> None:
142
+ """
143
+ Bans an IP address with the specified options.
144
+ """
145
+ raise NotImplementedError
146
+ def unban_ip(self, ip: str) -> bool:
147
+ """
148
+ Removes an IP ban. Returns true if the IP was banned.
149
+ """
150
+ raise NotImplementedError
151
+ def list_ip_bans(self) -> List[BannedIpEntry]:
152
+ """
153
+ Returns all currently active IP bans.
154
+ """
155
+ raise NotImplementedError
156
+ def __enter__(self) -> Self:
157
+ """Returns self"""
158
+ return self
159
+
160
+ def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
161
+ """
162
+ Release this resource.
163
+ """
164
+ raise NotImplementedError
165
+
166
+
167
+ @dataclass
168
+ class WhitelistEntry:
169
+ """
170
+ Represents a player entry in the server whitelist.
171
+ """
172
+ uuid: uuid.Uuid
173
+ name: str
174
+
175
+ class WhitelistManager:
176
+ """
177
+ Global manager for the server whitelist.
178
+ """
179
+
180
+ def is_enabled(self) -> bool:
181
+ """
182
+ Returns whether the whitelist is currently enabled.
183
+ """
184
+ raise NotImplementedError
185
+ def set_enabled(self, enabled: bool) -> None:
186
+ """
187
+ Enables or disables the server whitelist. If enabled and enforce-whitelist is set, kicks non-whitelisted players.
188
+ """
189
+ raise NotImplementedError
190
+ def is_whitelisted(self, id: uuid.Uuid) -> bool:
191
+ """
192
+ Checks if a player UUID is on the whitelist.
193
+ """
194
+ raise NotImplementedError
195
+ def add_player(self, name: str, id: uuid.Uuid) -> bool:
196
+ """
197
+ Adds a player to the whitelist (online or offline). Returns true if newly added.
198
+ """
199
+ raise NotImplementedError
200
+ def remove_player(self, id: uuid.Uuid) -> bool:
201
+ """
202
+ Removes a player from the whitelist. Returns true if the player was on the whitelist.
203
+ """
204
+ raise NotImplementedError
205
+ def list_entries(self) -> List[WhitelistEntry]:
206
+ """
207
+ Returns all whitelisted player entries.
208
+ """
209
+ raise NotImplementedError
210
+ def __enter__(self) -> Self:
211
+ """Returns self"""
212
+ return self
213
+
214
+ def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
215
+ """
216
+ Release this resource.
217
+ """
218
+ raise NotImplementedError
219
+
220
+
221
+ class Difficulty(Enum):
222
+ """
223
+ Represents the difficulty setting of a Minecraft server.
224
+ """
225
+ PEACEFUL = 0
226
+ EASY = 1
227
+ NORMAL = 2
228
+ HARD = 3
229
+
230
+ class Dimension(Enum):
231
+ """
232
+ Represents the three main Minecraft dimensions.
233
+ """
234
+ OVERWORLD = 0
235
+ NETHER = 1
236
+ END = 2
237
+
238
+ @dataclass
239
+ class SysInfo:
240
+ cpu_count: Optional[int]
241
+ total_memory: Optional[int]
242
+ used_memory: Optional[int]
243
+ os_name: Optional[str]
244
+ os_version: Optional[str]
245
+ pumpkin_version: str
246
+
247
+
248
+ @dataclass
249
+ class CommandSender_Console:
250
+ pass
251
+
252
+
253
+ @dataclass
254
+ class CommandSender_Player:
255
+ value: player.Player
256
+
257
+
258
+ CommandSender = Union[CommandSender_Console, CommandSender_Player]
259
+
260
+
261
+ class Server:
262
+ """
263
+ Represents the global server instance.
264
+ """
265
+
266
+ def get_sys_info(self) -> SysInfo:
267
+ """
268
+ Returns system information (CPU, Memory, OS).
269
+ Fields are returned only if the plugin has the corresponding permissions.
270
+ """
271
+ raise NotImplementedError
272
+ def get_difficulty(self) -> Difficulty:
273
+ """
274
+ Returns the current difficulty level of the server.
275
+ """
276
+ raise NotImplementedError
277
+ def get_player_count(self) -> int:
278
+ """
279
+ Returns the total number of players currently connected to the server.
280
+ """
281
+ raise NotImplementedError
282
+ def get_mspt(self) -> float:
283
+ """
284
+ Returns the rolling average Milliseconds Per Tick (MSPT).
285
+ A value below 50.0 is required for a stable 20 TPS.
286
+ """
287
+ raise NotImplementedError
288
+ def get_tps(self) -> float:
289
+ """
290
+ Returns the effective Ticks Per Second (TPS).
291
+ Ideal value is 20.0.
292
+ """
293
+ raise NotImplementedError
294
+ def get_all_players(self) -> List[player.Player]:
295
+ """
296
+ Returns a list of all online players across all worlds.
297
+ """
298
+ raise NotImplementedError
299
+ def get_player_by_name(self, name: str) -> Optional[player.Player]:
300
+ """
301
+ Searches for a player by their exact name.
302
+ """
303
+ raise NotImplementedError
304
+ def get_player_by_uuid(self, id: uuid.Uuid) -> Optional[player.Player]:
305
+ """
306
+ Searches for a player by their UUID string.
307
+ """
308
+ raise NotImplementedError
309
+ def get_all_worlds(self) -> List[world.World]:
310
+ """
311
+ Returns a list of all worlds on this server.
312
+ """
313
+ raise NotImplementedError
314
+ def get_world_by_name(self, name: str) -> Optional[world.World]:
315
+ """
316
+ Gets a world by its dimension name (e.g., "minecraft:overworld") or custom world name (e.g., "world", "arena_1").
317
+ """
318
+ raise NotImplementedError
319
+ def has_world(self, name: str) -> bool:
320
+ """
321
+ Checks if a world exists by name or dimension.
322
+ """
323
+ raise NotImplementedError
324
+ def execute_command(self, command: str, sender: CommandSender) -> None:
325
+ raise NotImplementedError
326
+ def create_world(self, name: str, dimension: Dimension) -> world.World:
327
+ """
328
+ Creates or loads a world by its name and dimension.
329
+ If a world with the given name already exists, it will be returned.
330
+ """
331
+ raise NotImplementedError
332
+ def unload_world(self, name: str) -> None:
333
+ """
334
+ Unloads and saves a world by its name or dimension.
335
+ Returns an error if the world cannot be found, is the primary/default world, or still has players inside.
336
+
337
+ Raises: `componentize_py_types.Err(wit_world.imports.str)`
338
+ """
339
+ raise NotImplementedError
340
+ def save_all(self) -> None:
341
+ """
342
+ Saves all players, player advancements, and loaded worlds to disk.
343
+
344
+ Raises: `componentize_py_types.Err(wit_world.imports.str)`
345
+ """
346
+ raise NotImplementedError
347
+ def get_players_in_world(self, world_ref: world.World) -> List[player.Player]:
348
+ """
349
+ Returns a list of all online players in a specific world.
350
+ """
351
+ raise NotImplementedError
352
+ def get_player_count_in_world(self, world_ref: world.World) -> int:
353
+ """
354
+ Returns the number of online players in a specific world.
355
+ """
356
+ raise NotImplementedError
357
+ def broadcast(self, message: str) -> None:
358
+ """
359
+ Broadcasts a system chat message to all players.
360
+ """
361
+ raise NotImplementedError
362
+ def delete_message_by_signature(self, signature: bytes) -> None:
363
+ """
364
+ Deletes a signed chat message from all players' chat windows using its 256-byte signature.
365
+ """
366
+ raise NotImplementedError
367
+ def delete_message_by_id(self, signature_id: int) -> None:
368
+ """
369
+ Deletes a signed chat message from all players' chat windows using its signature cache ID.
370
+ """
371
+ raise NotImplementedError
372
+ def broadcast_tab_list_header_footer(self, header: text.TextComponent, footer: text.TextComponent) -> None:
373
+ """
374
+ Broadcasts a tab list header and footer to all players.
375
+ """
376
+ raise NotImplementedError
377
+ def get_max_players(self) -> int:
378
+ """
379
+ Returns the maximum number of players allowed on the server.
380
+ """
381
+ raise NotImplementedError
382
+ def is_hardcore(self) -> bool:
383
+ """
384
+ Returns whether the server is in hardcore mode.
385
+ """
386
+ raise NotImplementedError
387
+ def is_online_mode(self) -> bool:
388
+ """
389
+ Returns whether the server is in online mode (authenticates with Mojang).
390
+ """
391
+ raise NotImplementedError
392
+ def get_motd(self) -> str:
393
+ """
394
+ Returns the server's Message of the Day (MOTD).
395
+ """
396
+ raise NotImplementedError
397
+ def has_whitelist(self) -> bool:
398
+ """
399
+ Returns whether the server has a whitelist enabled.
400
+ """
401
+ raise NotImplementedError
402
+ def get_allow_nether(self) -> bool:
403
+ """
404
+ Returns whether the server allows the Nether dimension.
405
+ """
406
+ raise NotImplementedError
407
+ def get_allow_end(self) -> bool:
408
+ """
409
+ Returns whether the server allows the End dimension.
410
+ """
411
+ raise NotImplementedError
412
+ def get_view_distance(self) -> int:
413
+ """
414
+ Returns the server's maximum view distance.
415
+ """
416
+ raise NotImplementedError
417
+ def get_simulation_distance(self) -> int:
418
+ """
419
+ Returns the server's maximum simulation distance.
420
+ """
421
+ raise NotImplementedError
422
+ def get_default_gamemode(self) -> common.GameMode:
423
+ """
424
+ Returns the server's default gamemode.
425
+ """
426
+ raise NotImplementedError
427
+ def get_recipe_manager(self) -> recipe.RecipeManager:
428
+ """
429
+ Returns the recipe manager to register custom recipes.
430
+ """
431
+ raise NotImplementedError
432
+ def get_op_manager(self) -> OpManager:
433
+ """
434
+ Returns the operator manager to query or modify server operators.
435
+ """
436
+ raise NotImplementedError
437
+ def get_ban_manager(self) -> BanManager:
438
+ """
439
+ Returns the global ban manager for querying and modifying player and IP bans.
440
+ """
441
+ raise NotImplementedError
442
+ def get_whitelist_manager(self) -> WhitelistManager:
443
+ """
444
+ Returns the global whitelist manager for querying and modifying the server whitelist.
445
+ """
446
+ raise NotImplementedError
447
+ def get_advancement(self, id: str) -> Optional[advancement.AdvancementInfo]:
448
+ """
449
+ Returns detailed information about an advancement by its ID (e.g., "minecraft:story/mine_stone" or "story/mine_stone").
450
+ """
451
+ raise NotImplementedError
452
+ def get_all_advancement_ids(self) -> List[str]:
453
+ """
454
+ Returns a list of all registered advancement IDs on the server.
455
+ """
456
+ raise NotImplementedError
457
+ def get_enchantment_manager(self) -> enchantments.EnchantmentManager:
458
+ """
459
+ Returns the global enchantment manager for registering and querying custom enchantments.
460
+ """
461
+ raise NotImplementedError
462
+ def get_enchantment(self, id: str) -> Optional[enchantments.CustomEnchantment]:
463
+ """
464
+ Returns information about an enchantment by its ID (vanilla or custom).
465
+ """
466
+ raise NotImplementedError
467
+ def get_all_enchantment_ids(self) -> List[str]:
468
+ """
469
+ Returns a list of all registered enchantment IDs (custom and vanilla) on the server.
470
+ """
471
+ raise NotImplementedError
472
+ def get_datapack_manager(self) -> datapack.DatapackManager:
473
+ """
474
+ Returns the global datapack manager for inspecting, enabling, disabling, and reloading datapacks.
475
+ """
476
+ raise NotImplementedError
477
+ def set_server_links(self, links: List[player.ServerLink]) -> None:
478
+ """
479
+ Broadcasts custom server links to all connected players (displayed in the client Esc pause menu in 1.21+).
480
+ """
481
+ raise NotImplementedError
482
+ def __enter__(self) -> Self:
483
+ """Returns self"""
484
+ return self
485
+
486
+ def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
487
+ """
488
+ Release this resource.
489
+ """
490
+ raise NotImplementedError
491
+
492
+
493
+