Inventory UI plugin for Endstone servers
Project description
endstone-inventoryui
Virtual inventory plugin for Endstone
API
MenuType
Enum for menu container types:
MenuType.CHEST— single chest (27 slots)MenuType.DOUBLE_CHEST— double chest (54 slots)MenuType.DISPENSER— dispenser (9 slots)MenuType.HOPPER— hopper (5 slots)
Menu
Menu(type: MenuType, name: str = "")
Properties:
inventory— theMenuInventoryinstance for this menu. Implements an API similar to Endstone'sInventory.name— display name shown at the top of the menutype— theMenuTypeused to create this menu
Methods:
set_name(name: str)— set the display nameset_listener(listener)— set the click callback (see MenuTransaction)set_open_listener(listener)— callback when a player opens the menu:(player: Player) -> Noneset_close_listener(listener)— callback when a player closes the menu:(player: Player) -> Nonesend_to(player: Player)— display the menu to a player. If the player already has a menu open, this menu is queued and shown after the current one closes.close(player: Player) -> bool— close this menu for a playerclose_all()— close this menu for all players currently viewing itget_viewers() -> list[Player]— list players who currently have this menu open
MenuTransaction
Properties:
player— the player who clickedslot— virtual inventory slot indexitem_clicked— item in the virtual slot before the actionitem_clicked_with— item in the other slot involved (player inventory or cursor)action_type— the underlyingItemStackRequestActionTypesource— source slot info from the requestdestination— destination slot info from the request
Methods:
proceed() -> MenuTransactionResult— allow the transaction to proceeddiscard() -> MenuTransactionResult— discard transaction
Usage
from endstone import Player
from endstone.inventory import ItemStack
from endstone_inventoryui import Menu, MenuType, MenuTransaction, MenuTransactionResult
menu = Menu(MenuType.CHEST)
menu.inventory.set_item(0, ItemStack("minecraft:diamond", 1))
menu.inventory.set_item(1, ItemStack("minecraft:emerald", 1))
def on_click(tr: MenuTransaction) -> MenuTransactionResult:
if tr.slot == 0:
tr.player.send_message("You clicked the diamond!")
return tr.discard()
elif tr.slot == 1:
tr.player.send_message("You clicked the emerald!")
return tr.discard()
return tr.proceed()
menu.set_listener(on_click)
menu.send_to(player)
See the example plugin for a full project.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file endstone_inventoryui-2.0.2.tar.gz.
File metadata
- Download URL: endstone_inventoryui-2.0.2.tar.gz
- Upload date:
- Size: 18.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
963b13a8e9628ac3201e32045a32af487036192852dfafb1bab90d452754b4c4
|
|
| MD5 |
a9ba2f2cd617103e8c0b91692b60f84d
|
|
| BLAKE2b-256 |
abcc743c090f9f4a40f45ccbf9d328ec623047af778b199ab40fb6fddfe1edfc
|
Provenance
The following attestation bundles were made for endstone_inventoryui-2.0.2.tar.gz:
Publisher:
publish.yml on Shock95/endstone-inventoryui
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
endstone_inventoryui-2.0.2.tar.gz -
Subject digest:
963b13a8e9628ac3201e32045a32af487036192852dfafb1bab90d452754b4c4 - Sigstore transparency entry: 2105151332
- Sigstore integration time:
-
Permalink:
Shock95/endstone-inventoryui@634638b962d17b2cb0ee59268933f5655ebeee02 -
Branch / Tag:
refs/tags/2.0.2 - Owner: https://github.com/Shock95
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@634638b962d17b2cb0ee59268933f5655ebeee02 -
Trigger Event:
release
-
Statement type: