{"id":24425856,"url":"https://github.com/39software/invuilib","last_synced_at":"2025-03-13T15:29:24.328Z","repository":{"id":230307388,"uuid":"779068121","full_name":"39software/InvUILib","owner":"39software","description":"WIP Minecraft library \u0026 plugin to create GUI interfaces","archived":false,"fork":false,"pushed_at":"2024-04-02T23:51:10.000Z","size":89,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-10T16:01:08.232Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/39software.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-29T01:07:24.000Z","updated_at":"2025-01-13T11:07:58.000Z","dependencies_parsed_at":"2024-11-08T10:54:59.602Z","dependency_job_id":"a3722df9-ba3a-458d-96bd-93918faa6d11","html_url":"https://github.com/39software/InvUILib","commit_stats":null,"previous_names":["diademiemi/invuilib","x86-39/invuilib","39software/invuilib"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/39software%2FInvUILib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/39software%2FInvUILib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/39software%2FInvUILib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/39software%2FInvUILib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/39software","download_url":"https://codeload.github.com/39software/InvUILib/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243431798,"owners_count":20289959,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-20T11:11:39.642Z","updated_at":"2025-03-13T15:29:24.252Z","avatar_url":"https://github.com/39software.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# InvUILib\nInvUILib is a library for creating GUIs in Minecraft using the inventory system. It is designed to be simple to use and easy to understand.\n\n## Installation\nPlugins using InvUILib should include it as a dependency in their `plugin.yml` file. This can be done by adding the following lines to the `plugin.yml` file:\n\n```yaml\ndepend: [\"InvUiLib\"]\n```\n\nInvUILib should also be installed on the server when a plugin using it is installed. This can be done by placing the `InvUiLib.jar` file in the `plugins` folder of the server.\nThe latest version of InvUILib can be downloaded from the [releases page](https://github.com/diademiemi/invuilib/releases).\n\n## Usage\nInvUILib provides a simple API for creating GUIs in Minecraft. The main class in the library is `Menu`, which represents a GUI menu. A `Menu` can contain multiple `MenuButton`s, which represent items in the menu.\n\nA helper interface `Dialog` is provided which safely opens a menu for the player, first closing any existing menu they have open.\n\n### Adding dependencies\nTo use InvUILib in your plugin, you should add the following dependency to your `build.gradle` or `pom.xml` file:\n\n## Gradle\n\n```gradle\ndependencies {\n    compileOnly \"me.diademiemi:invuilib:0.1\"\n}\n```\n\n## Maven\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eme.diademiemi\u003c/groupId\u003e\n    \u003cartifactId\u003einvuilib\u003c/artifactId\u003e\n    \u003cversion\u003e0.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### Creating a Menu\nTo create a new `Menu`, you should implement the `Dialog` interface and override the `create` method. This method should return a new instance of the `Menu` class, with the desired title and size of the menu.\n\nThe returned `Menu` can be created with a `MenuBuilder` object, which allows you to add buttons to the menu.\n\nExample:\n```java\nimport me.diademiemi.invuilib.menu.*;\nimport org.bukkit.Material;\nimport org.bukkit.entity.Player;\n\npublic class DgExample implements Dialog {\n\n    @Override\n    public Menu create(Player p, Object... args) {\n\n        MenuBuilder builder = new MenuBuilder(\"Example menu\", MenuSize.THREE_ROWS, p);\n\n        builder.addButtonByColumnRow(new MenuButton(Material.LIME_CONCRETE, 1, \"Button\") {\n            @Override\n            public void onLeftClick(Player p) {\n                p.sendMessage(\"You clicked the button!\");\n            }\n\n        }, 3, 1, true);\n\n        builder.addButtonByColumnRow(new MenuButton(Material.BARRIER, 1, \"Close\") {\n            @Override\n            public void onLeftClick(Player p) {\n                close(p);\n            }\n        }, 3, 2, true);\n\n        builder.setOnOpen(() -\u003e {\n            p.sendMessage(\"Test menu opened!\");\n        });\n\n        builder.setOnClose(() -\u003e {\n            p.sendMessage(\"Test menu closed!\");\n        });\n\n        builder.setOnForceClose(() -\u003e {\n            p.sendMessage(\"Test menu force closed!\");\n        });\n\n        return builder.build();\n    }\n}\n```\n\nIn this example, a new `Menu` is created with the title \"Example menu\" and size `MenuSize.THREE_ROWS`. Two buttons are added to the menu, one with the text \"Button\" and one with the text \"Close\". The `onLeftClick` method of the buttons is overridden to send a message to the player when the button is clicked.\n`addButtonByColumnRow` is used to add the buttons to the menu at specific coordinates. When the third argument is `true`, the first and last columns are omitted for Bedrock compatibility (Pocket edition uses 7 columns on inventories).\nIn future versions of InvUILib, I will provide more tools to build menus which can be optimised for Java and Bedrock without this kind of workaround.\n\nThis dialog can now be showed to a player by calling `new DgExample().open(p)`, where `p` is the player to show the menu to. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F39software%2Finvuilib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F39software%2Finvuilib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F39software%2Finvuilib/lists"}