pumpkin-api-py 0.1.0.dev0__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 (75) hide show
  1. pumpkin_api/__init__.py +139 -0
  2. pumpkin_api/app.py +8 -0
  3. pumpkin_api/build.py +35 -0
  4. pumpkin_api/wit/componentize_py_async_support/__init__.py +529 -0
  5. pumpkin_api/wit/componentize_py_async_support/futures.py +93 -0
  6. pumpkin_api/wit/componentize_py_async_support/streams.py +189 -0
  7. pumpkin_api/wit/componentize_py_runtime.pyi +34 -0
  8. pumpkin_api/wit/componentize_py_types.py +19 -0
  9. pumpkin_api/wit/poll_loop.py +440 -0
  10. pumpkin_api/wit/wit_world/__init__.py +70 -0
  11. pumpkin_api/wit/wit_world/exports/__init__.py +19 -0
  12. pumpkin_api/wit/wit_world/exports/metadata.py +22 -0
  13. pumpkin_api/wit/wit_world/imports/__init__.py +0 -0
  14. pumpkin_api/wit/wit_world/imports/command.py +539 -0
  15. pumpkin_api/wit/wit_world/imports/common.py +213 -0
  16. pumpkin_api/wit/wit_world/imports/context.py +70 -0
  17. pumpkin_api/wit/wit_world/imports/entity.py +84 -0
  18. pumpkin_api/wit/wit_world/imports/event.py +434 -0
  19. pumpkin_api/wit/wit_world/imports/gui.py +61 -0
  20. pumpkin_api/wit/wit_world/imports/i18n.py +35 -0
  21. pumpkin_api/wit/wit_world/imports/logging.py +30 -0
  22. pumpkin_api/wit/wit_world/imports/permission.py +71 -0
  23. pumpkin_api/wit/wit_world/imports/player.py +350 -0
  24. pumpkin_api/wit/wit_world/imports/scheduler.py +44 -0
  25. pumpkin_api/wit/wit_world/imports/scoreboard.py +95 -0
  26. pumpkin_api/wit/wit_world/imports/server.py +75 -0
  27. pumpkin_api/wit/wit_world/imports/text.py +89 -0
  28. pumpkin_api/wit/wit_world/imports/world.py +215 -0
  29. pumpkin_api/wit_files/command.wit +189 -0
  30. pumpkin_api/wit_files/common.wit +201 -0
  31. pumpkin_api/wit_files/componentize_py_async_support/__init__.py +529 -0
  32. pumpkin_api/wit_files/componentize_py_async_support/futures.py +93 -0
  33. pumpkin_api/wit_files/componentize_py_async_support/streams.py +189 -0
  34. pumpkin_api/wit_files/componentize_py_runtime.pyi +34 -0
  35. pumpkin_api/wit_files/componentize_py_types.py +19 -0
  36. pumpkin_api/wit_files/context.wit +33 -0
  37. pumpkin_api/wit_files/entity.wit +36 -0
  38. pumpkin_api/wit_files/event.wit +311 -0
  39. pumpkin_api/wit_files/gui.wit +38 -0
  40. pumpkin_api/wit_files/i18n.wit +21 -0
  41. pumpkin_api/wit_files/log.wit +14 -0
  42. pumpkin_api/wit_files/metadata.wit +15 -0
  43. pumpkin_api/wit_files/permission.wit +46 -0
  44. pumpkin_api/wit_files/player.wit +172 -0
  45. pumpkin_api/wit_files/plugin.wit +61 -0
  46. pumpkin_api/wit_files/poll_loop.py +440 -0
  47. pumpkin_api/wit_files/scheduler.wit +24 -0
  48. pumpkin_api/wit_files/scoreboard.wit +72 -0
  49. pumpkin_api/wit_files/server.wit +41 -0
  50. pumpkin_api/wit_files/text.wit +41 -0
  51. pumpkin_api/wit_files/wit_world/__init__.py +70 -0
  52. pumpkin_api/wit_files/wit_world/exports/__init__.py +19 -0
  53. pumpkin_api/wit_files/wit_world/exports/metadata.py +22 -0
  54. pumpkin_api/wit_files/wit_world/imports/__init__.py +0 -0
  55. pumpkin_api/wit_files/wit_world/imports/command.py +539 -0
  56. pumpkin_api/wit_files/wit_world/imports/common.py +213 -0
  57. pumpkin_api/wit_files/wit_world/imports/context.py +70 -0
  58. pumpkin_api/wit_files/wit_world/imports/entity.py +84 -0
  59. pumpkin_api/wit_files/wit_world/imports/event.py +434 -0
  60. pumpkin_api/wit_files/wit_world/imports/gui.py +61 -0
  61. pumpkin_api/wit_files/wit_world/imports/i18n.py +35 -0
  62. pumpkin_api/wit_files/wit_world/imports/logging.py +30 -0
  63. pumpkin_api/wit_files/wit_world/imports/permission.py +71 -0
  64. pumpkin_api/wit_files/wit_world/imports/player.py +350 -0
  65. pumpkin_api/wit_files/wit_world/imports/scheduler.py +44 -0
  66. pumpkin_api/wit_files/wit_world/imports/scoreboard.py +95 -0
  67. pumpkin_api/wit_files/wit_world/imports/server.py +75 -0
  68. pumpkin_api/wit_files/wit_world/imports/text.py +89 -0
  69. pumpkin_api/wit_files/wit_world/imports/world.py +215 -0
  70. pumpkin_api/wit_files/world.wit +169 -0
  71. pumpkin_api_py-0.1.0.dev0.dist-info/METADATA +58 -0
  72. pumpkin_api_py-0.1.0.dev0.dist-info/RECORD +75 -0
  73. pumpkin_api_py-0.1.0.dev0.dist-info/WHEEL +4 -0
  74. pumpkin_api_py-0.1.0.dev0.dist-info/entry_points.txt +2 -0
  75. pumpkin_api_py-0.1.0.dev0.dist-info/licenses/LICENSE +677 -0
@@ -0,0 +1,15 @@
1
+ /// Plugin metadata describing the plugin and its compatibility.
2
+ interface metadata {
3
+ record plugin-metadata {
4
+ /// Name of the plugin.
5
+ name: string,
6
+ /// Plugin version (semver).
7
+ version: string,
8
+ /// Plugin authors.
9
+ authors: list<string>,
10
+ /// Short description of the plugin.
11
+ description: string,
12
+ }
13
+
14
+ get-metadata: func() -> plugin-metadata;
15
+ }
@@ -0,0 +1,46 @@
1
+ interface permission {
2
+ /// Represents the player's permission level
3
+ ///
4
+ /// Permission levels determine the player's access to commands and server operations.
5
+ /// Each numeric level corresponds to a specific role:
6
+ /// - `Zero`: `normal`: Player can use basic commands.
7
+ /// - `One`: `moderator`: Player can bypass spawn protection.
8
+ /// - `Two`: `gamemaster`: Player or executor can use more commands and player can use command blocks.
9
+ /// - `Three`: `admin`: Player or executor can use commands related to multiplayer management.
10
+ /// - `Four`: `owner`: Player or executor can use all of the commands, including commands related to server management.
11
+ enum permission-level {
12
+ zero,
13
+ one,
14
+ two,
15
+ three,
16
+ four,
17
+ }
18
+
19
+ /// Describes the default behavior for permissions
20
+ variant permission-default {
21
+ /// Permission is not granted by default
22
+ deny,
23
+ /// Permission is granted by default
24
+ allow,
25
+ /// Permission is granted by default to operators
26
+ op(permission-level),
27
+ }
28
+
29
+ /// A child permission entry
30
+ record permission-child {
31
+ node: string,
32
+ value: bool,
33
+ }
34
+
35
+ /// Defines a permission node in the system
36
+ record permission {
37
+ /// The full node name (e.g., "minecraft:command.gamemode")
38
+ node: string,
39
+ /// Description of what this permission does
40
+ description: string,
41
+ /// The default value of this permission
42
+ default: permission-default,
43
+ /// Children nodes that are affected by this permission
44
+ children: list<permission-child>,
45
+ }
46
+ }
@@ -0,0 +1,172 @@
1
+ /// Represents a player connected to the Minecraft server.
2
+ interface player {
3
+ use common.{hand, item-stack, position, game-mode};
4
+ use %world.{%world};
5
+ use permission.{permission-level};
6
+ use text.{text-component};
7
+ use gui.{gui};
8
+
9
+ /// Various abilities a player can have.
10
+ record player-abilities {
11
+ /// Whether the player is invulnerable to damage.
12
+ invulnerable: bool,
13
+ /// Whether the player is currently flying.
14
+ flying: bool,
15
+ /// Whether the player is allowed to fly.
16
+ allow-flying: bool,
17
+ /// Whether the player is in creative mode.
18
+ creative: bool,
19
+ /// Whether the player can modify the world.
20
+ allow-modify-world: bool,
21
+ /// The speed at which the player flies.
22
+ fly-speed: f32,
23
+ /// The speed at which the player walks.
24
+ walk-speed: f32,
25
+ }
26
+
27
+ /// A handle to a player on the server.
28
+ resource player {
29
+ /// Returns the player's unique UUID as a string.
30
+ get-id: func () -> string;
31
+ /// Returns the player's username.
32
+ get-name: func () -> string;
33
+
34
+ // Basic state
35
+
36
+ /// Returns the player's current position in the world.
37
+ get-position: func () -> position;
38
+ /// Returns the player's current yaw (horizontal rotation).
39
+ get-yaw: func () -> f32;
40
+ /// Returns the player's current pitch (vertical rotation).
41
+ get-pitch: func () -> f32;
42
+ /// Returns the world the player is currently in.
43
+ get-world: func () -> %world;
44
+ /// Returns the player's current game mode.
45
+ get-gamemode: func () -> game-mode;
46
+ /// Changes the player's game mode. Returns true if successful.
47
+ set-gamemode: func (mode: game-mode) -> bool;
48
+ /// Returns the player's locale (e.g., "en_us").
49
+ get-locale: func () -> string;
50
+ /// Returns the player's current ping in milliseconds.
51
+ get-ping: func () -> u32;
52
+
53
+ // Permissions & metadata
54
+
55
+ /// Returns the player's permission level (0-4).
56
+ get-permission-level: func () -> permission-level;
57
+ /// Sets the player's permission level.
58
+ set-permission-level: func (level: permission-level);
59
+ /// Checks if the player has a specific permission node.
60
+ has-permission: func (node: string) -> bool;
61
+ /// Returns the player's display name, which may include formatting.
62
+ get-display-name: func () -> text-component;
63
+
64
+ // Messaging & titles
65
+
66
+ /// Sends a system message to the player's chat.
67
+ send-system-message: func (text: text-component, overlay: bool);
68
+ /// Shows a large title on the player's screen.
69
+ show-title: func (text: text-component);
70
+ /// Shows a smaller subtitle on the player's screen.
71
+ show-subtitle: func (text: text-component);
72
+ /// Shows a message in the action bar area.
73
+ show-actionbar: func (text: text-component);
74
+ /// Sets the fade-in, stay, and fade-out times for titles.
75
+ send-title-animation: func (fade-in: s32, stay: s32, fade-out: s32);
76
+
77
+ // Teleport & kick
78
+
79
+ /// Teleports the player to a position in a world.
80
+ teleport: func (position: position, yaw: option<f32>, pitch: option<f32>, %world: %world);
81
+ /// Teleports the player to another world at a specific position.
82
+ teleport-world: func (world-ref: %world, position: position, yaw: option<f32>, pitch: option<f32>);
83
+ /// Kicks the player from the server with the specified reason.
84
+ kick: func (message: text-component);
85
+ /// Forces the player to respawn.
86
+ respawn: func ();
87
+
88
+ /// Opens a GUI for the player.
89
+ open-gui: func (gui-ref: gui);
90
+
91
+ /// Bans the player with an optional reason.
92
+ ban: func (reason: option<text-component>);
93
+ /// Bans the player's IP address with an optional reason.
94
+ ban-ip: func (reason: option<text-component>);
95
+
96
+ // Inventory
97
+
98
+ /// Returns the index of the currently selected hotbar slot (0-8).
99
+ get-selected-slot: func () -> u8;
100
+ /// Returns the item currently in the specified hand.
101
+ get-item-in-hand: func (hand: hand) -> option<item-stack>;
102
+ /// Returns the item in the specified inventory slot.
103
+ get-inventory-item: func (slot: u8) -> option<item-stack>;
104
+
105
+ // Status
106
+
107
+ /// Returns the player's current health.
108
+ get-health: func () -> f32;
109
+ /// Sets the player's current health.
110
+ set-health: func (health: f32);
111
+ /// Returns the player's maximum health.
112
+ get-max-health: func () -> f32;
113
+ /// Sets the player's maximum health.
114
+ set-max-health: func (max-health: f32);
115
+ /// Returns the player's food level (0-20).
116
+ get-food-level: func () -> u8;
117
+ /// Sets the player's food level.
118
+ set-food-level: func (food-level: u8);
119
+ /// Returns the player's food saturation level.
120
+ get-saturation: func () -> f32;
121
+ /// Sets the player's food saturation level.
122
+ set-saturation: func (saturation: f32);
123
+ /// Returns the player's food exhaustion level.
124
+ get-exhaustion: func () -> f32;
125
+ /// Sets the player's food exhaustion level.
126
+ set-exhaustion: func (exhaustion: f32);
127
+ /// Returns the player's current absorption amount.
128
+ get-absorption: func () -> f32;
129
+ /// Sets the player's current absorption amount.
130
+ set-absorption: func (absorption: f32);
131
+
132
+ /// Returns the player's total experience level.
133
+ get-experience-level: func() -> s32;
134
+ /// Returns the player's progress toward the next level (0.0 to 1.0).
135
+ get-experience-progress: func() -> f32;
136
+ /// Returns the total experience points the player has.
137
+ get-experience-points: func() -> s32;
138
+ /// Sets the player's total experience level.
139
+ set-experience-level: func(level: s32);
140
+ /// Sets the player's progress toward the next level.
141
+ set-experience-progress: func(progress: f32);
142
+ /// Sets the player's total experience points.
143
+ set-experience-points: func(points: s32);
144
+ /// Adds experience levels to the player.
145
+ add-experience-levels: func(levels: s32);
146
+ /// Adds experience points to the player.
147
+ add-experience-points: func(points: s32);
148
+
149
+ /// Returns whether the player is currently sneaking.
150
+ is-sneaking: func() -> bool;
151
+ /// Sets whether the player is currently sneaking.
152
+ set-sneaking: func(sneaking: bool);
153
+ /// Returns whether the player is currently sprinting.
154
+ is-sprinting: func() -> bool;
155
+ /// Sets whether the player is currently sprinting.
156
+ set-sprinting: func(sprinting: bool);
157
+ /// Returns whether the player is currently on the ground.
158
+ is-on-ground: func() -> bool;
159
+ /// Returns whether the player is currently flying.
160
+ is-flying: func() -> bool;
161
+ /// Sets whether the player should be flying.
162
+ set-flying: func(flying: bool);
163
+
164
+ /// Returns the player's current abilities.
165
+ get-abilities: func() -> player-abilities;
166
+ /// Updates the player's abilities.
167
+ set-abilities: func(abilities: player-abilities);
168
+
169
+ /// Returns the player's IP address.
170
+ get-ip: func() -> string;
171
+ }
172
+ }
@@ -0,0 +1,61 @@
1
+ /// The main entry point for a Pumpkin plugin.
2
+ /// This world defines the exports that the plugin must provide to the host
3
+ /// and the imports that the host provides to the plugin.
4
+ package pumpkin:plugin;
5
+
6
+ world plugin {
7
+ use context.{context};
8
+ use event.{event};
9
+ use server.{server as server-instance};
10
+ use command.{command-sender, consumed-args, command-error};
11
+
12
+ // --- Host-provided imports ---
13
+
14
+ /// Provides logging capabilities to the plugin.
15
+ import logging;
16
+ /// Provides GUI creation and management.
17
+ import gui;
18
+ /// Provides scoreboard management.
19
+ import scoreboard;
20
+ /// Provides global server information and player lookup.
21
+ import server;
22
+ /// Provides text component building and formatting.
23
+ import text;
24
+ /// Provides command registration and argument parsing.
25
+ import command;
26
+ /// Provides the plugin execution context.
27
+ import context;
28
+ /// Provides internationalization and translation support.
29
+ import i18n;
30
+ /// Provides task scheduling for delayed or repeating logic.
31
+ import scheduler;
32
+
33
+ // --- Plugin-provided exports ---
34
+
35
+ /// Called by the host once to initialize the plugin.
36
+ /// Internal use only; plugins should use the `register_plugin!` macro.
37
+ export init-plugin: func();
38
+
39
+ /// Called when the plugin is being loaded.
40
+ /// Use this to register commands, events, and perform initial setup.
41
+ export on-load: func(context: context) -> result<_, string>;
42
+
43
+ /// Called when the plugin is being unloaded.
44
+ /// Use this to save data and clean up resources.
45
+ export on-unload: func(context: context) -> result<_, string>;
46
+
47
+ /// Provides plugin metadata (name, version, etc.) to the host.
48
+ export metadata;
49
+
50
+ /// Common types used across the API.
51
+ export common;
52
+
53
+ /// Dispatches an event to the plugin for handling.
54
+ export handle-event: func(event-id: u32, server: server-instance, event: event) -> event;
55
+
56
+ /// Dispatches a command execution to the plugin.
57
+ export handle-command: func(command-id: u32, sender: command-sender, server: server-instance, args: consumed-args) -> result<s32, command-error>;
58
+
59
+ /// Dispatches a scheduled task execution to the plugin.
60
+ export handle-task: func(handler-id: u32, server: server-instance);
61
+ }