{"id":25640685,"url":"https://github.com/socketbyte/opengui","last_synced_at":"2025-10-17T19:42:30.690Z","repository":{"id":27228466,"uuid":"112962724","full_name":"SocketByte/OpenGUI","owner":"SocketByte","description":"Simple GUI management solution.","archived":false,"fork":false,"pushed_at":"2019-04-22T14:51:58.000Z","size":82,"stargazers_count":11,"open_issues_count":3,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-28T14:39:17.648Z","etag":null,"topics":["java","minecraft-api"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SocketByte.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-03T20:51:04.000Z","updated_at":"2023-11-11T22:45:30.000Z","dependencies_parsed_at":"2022-07-27T09:22:28.992Z","dependency_job_id":null,"html_url":"https://github.com/SocketByte/OpenGUI","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SocketByte%2FOpenGUI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SocketByte%2FOpenGUI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SocketByte%2FOpenGUI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SocketByte%2FOpenGUI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SocketByte","download_url":"https://codeload.github.com/SocketByte/OpenGUI/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248997087,"owners_count":21195797,"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":["java","minecraft-api"],"created_at":"2025-02-23T04:46:22.186Z","updated_at":"2025-10-17T19:42:25.625Z","avatar_url":"https://github.com/SocketByte.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenGUI ![version](https://img.shields.io/badge/version-1.2-blue.svg) [![Build Status](https://travis-ci.org/SocketByte/OpenGUI.svg?branch=master)](https://travis-ci.org/SocketByte/OpenGUI)\nSimple GUI management solution.\n\n## Installation (Maven)\nJust use my public repository and set the scope to compile. \n\nThere's no any jar file to install on the server. You just compile it with your plugin.\n```xml\n   \u003crepositories\u003e\n        \u003crepository\u003e\n            \u003cid\u003eopengui\u003c/id\u003e\n            \u003curl\u003ehttps://repo.socketbyte.pl/repository/nexus-releases/\u003c/url\u003e\n        \u003c/repository\u003e\n   \u003c/repositories\u003e\n```\n```xml\n    \u003cdependencies\u003e\n        \u003cdependency\u003e\n            \u003cgroupId\u003epl.socketbyte\u003c/groupId\u003e\n            \u003cartifactId\u003eOpenGUI\u003c/artifactId\u003e\n            \u003cversion\u003e1.2\u003c/version\u003e\n            \u003cscope\u003ecompile\u003c/scope\u003e\n        \u003c/dependency\u003e\n    \u003c/dependencies\u003e\n```\n## Installation (Non-maven)\nDownload and copy the source-code into your `src` folder.\n\nKeep in mind that you need following dependencies to get it to work.\n- Bukkit or Spigot engine installed on your server. https://yivesmirror.com/downloads/spigot\n- JDK/JRE 8 or higher. http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html\n## Compatibility\nThis API should be compatible with all Bukkit or Spigot\nversions since `1.0`. \nI would recommend running it on a version higher than `1.7.2` though.\n\nIt was tested on Minecraft version `1.12.2`.\n## Usage\nIt is fairly simple. *OpenGUI* has two possible usages. Object-based or standard.\n\nStandard, and the simplest usage example:\n```java\npublic class YourPluginClass extends JavaPlugin {\n    \n    public static void showGUI(Player player) {\n        // Register the listeners.\n        OpenGUI.INSTANCE.register(instance);\n        \n        // Create the GUI inventory using our special wrapper.\n        GUI gui = new GUI(\"\u0026cSimple Title\", Rows.FIVE);\n        // Create GUIExtender class and provide the GUI information.\n        SimpleGUI simpleGUI = new SimpleGUI(gui);\n        \n        // Some additional GUI settings like entering/dragging items.\n        simpleGUI.getGuiSettings().setCanEnterItems(true);\n        simpleGUI.getGuiSettings().setCanDrag(true);\n        \n        // Set specific enterable/draggable items\n        simpleGUI.getGuiSettings().addEnterableItem(Material.STONE);\n        simpleGUI.getGuiSettings().addEnterableItem(Material.GOLDEN_APPLE, 1);\n        \n        // Set event to occur when user tries to enter non-enterable item\n        simpleGUI.getGuiSettings().setNotEnterableItemResponse(\n                inventoryClickEvent -\u003e \n                    inventoryClickEvent.getWhoClicked().sendMessage(\n                            \"You can not enter that item!\"));\n        \n        // Set event to occur when user enters an item successfully\n        simpleGUI.getGuiSettings().setEnteredItemResponse(\n                inventoryClickEvent -\u003e\n                    inventoryClickEvent.getWhoClicked().sendMessage(\n                            \"Entered an item!\"));\n        \n        // #1 Set an item to a specified slot and assign an ItemBuilder\n        simpleGUI.setItem(0, new ItemBuilder(Material.DIRT, 1).setName(\"\u0026aTest!\"));\n        \n        // #2 Add an item with assigned ItemBuilder\n        simpleGUI.addItem(new ItemBuilder(Material.DIAMOND));\n        \n        // #3 Add an item with assigned ItemBuilder and ElementResponse event. (onClick)\n        simpleGUI.addItem(new ItemBuilder(Material.GOLD_AXE), event -\u003e\n                System.out.println(\"On click event!\"));\n        \n        // #4 Set items all together using ItemPack class.\n        simpleGUI.setItem(\n                new ItemPack(1, new ItemBuilder(Material.WOOD)),\n                new ItemPack(2, new ItemBuilder(Material.STONE)),\n                new ItemPack(3, new ItemBuilder(Material.DIAMOND_ORE)),\n                new ItemPack(4, new ItemBuilder(Material.EMERALD)));\n        \n        // Add an element response to slot 0.\n        simpleGUI.addElementResponse(0, event -\u003e\n                System.out.println(\"On click event at slot 0!\"));\n        \n        // Add an element response to slot 1 and assign \"pullable\" value.\n        // It means that you can pull out that item from the GUI and take it with you.\n        simpleGUI.addElementResponse(1, true, event -\u003e\n                System.out.println(\"On click event at slot 1!\"));\n        \n        // Add WindowResponse event.\n        simpleGUI.addWindowResponse(new WindowResponse() {\n                @Override\n                public void onOpen(InventoryOpenEvent event) {\n                    System.out.println(\"Opened!\");\n                }\n        \n                @Override\n                public void onClose(InventoryCloseEvent event) {\n                    System.out.println(\"Closed!\");\n                }\n        });\n        \n        // Remove an item from slot 0.\n        simpleGUI.removeItem(0);\n        \n        // Open inventory.\n        // WARNING: This is important that you use our method.\n        // You can use player.openInventory(inventory)\n        // only when not using overrided items. (More on that in object-based usage)\n        simpleGUI.openInventory(player);\n    }\n    \n}\n```\n\nObject-based usage. (A little more complicated, this is for advanced users who are familiar with basics of object-oriented programming!)\n### Custom GUI creation\n```java\npublic class TestGUI extends GUIExtender {\n\n    // Simple custom GUI, here you can add your items and prepare it for show.\n    // Functionality of this object will be extended in the future.\n    public TestGUI() {\n        super(new GUI(\"\u0026cSuper Title\", Rows.THREE));\n\n        getGuiSettings().setCanDrag(true);\n        getGuiSettings().setCanEnterItems(true);\n        // Add possible to enter material\n        getGuiSettings().addEnterableItem(Material.STONE);\n\n        // Here we can set our GUIExtenderItem class extension as a normal item.\n        setItem(0, new TestItem());\n        \n        // Every functionality from standard usage is of course here.\n        // You can add/set items, add element response or other listeners.\n        // You can even override all the methods, but I don't see any useful outcomes of this.\n    }\n    \n    @Override\n    public void onOpen(InventoryOpenEvent e) {\n        System.out.println(\"Opened!\");\n    }\n    \n    @Override\n    public void onClose(InventoryCloseEvent e) {\n        System.out.println(\"Closed!\");\n    }\n}\n\n\n```\n### Custom Item (Element) creation\n```java\npublic class TestItem extends GUIExtenderItem {\n\n    public TestItem() {\n        // We can set here the default ItemBuilder,\n        // but there's no need for it as we're overriding the getItemBuilder method\n        super();\n\n        setPullable(false);\n    }\n\n    // You can change resulting item just before the player opens the inventory.\n    // The assignment of the item is made in GUIExtender.openInventory(player) method.\n    @Override\n    public ItemBuilder getItemBuilder(Player player) {\n        if (player.getName().equals(\"pl.socketbyte.opengui.Test\"))\n            return new ItemBuilder(Material.DIAMOND)\n                    .setName(\"\u0026bDiamond\")\n                    .setLore(\"Very nice\", \"Diamond\");\n        return new ItemBuilder(Material.GRASS)\n                .setName(\"\u00262Grass\")\n                .setLore(\"Gross\", \"Grass\");\n    }\n\n    // ElementResponse implementation.\n    @Override\n    public void onClick(InventoryClickEvent event) {\n        System.out.println(\"Click!\");\n    }\n}\n\n```\nNow you can show your amazing objects to the player using\n```\nTestGUI testGUI = new TestGUI();\ntestGUI.openInventory(player);\n```\n## Serialization\nOpenGUI in `1.2` offers Serializable classes that allow to easily configure your GUI from config.yml file.\n\nIf you want to use it from config, you need to use different objects.\n\n`SerializableSimpleGUI` instead of `SimpleGUI`\n\n`SerializableGUI` instead of `GUI`\n\n`SerializableItemBuilder` instead of `ItemBuilder`\n\nCongratulations! You can save now your `SerializableSimpleGUI`\nusing\n```java\nconfiguration.set(\"gui\", yourSimpleGUI)\n```\n\nOf course you can read GUI from config like this:\n```java\nSerializableSimpleGUI gui = (SerializableSimpleGUI) configuration.get(\"gui\")\n```\n\nResult:\n```yml\ngui:\n  canDrag: true\n  canEnterItems: true\n  enterableItems:\n  - GOLD_PICKAXE\n  gui:\n    title: '\u00262\u0026lDrop'\n    actions:\n      # action ID on slot 0 etc.\n      0: on_click_action_0\n      1: on_click_action_1\n      2: on_click_action_2\n      3: on_click_action_3\n      4: on_click_action_4\n      5: on_click_action_5\n    inventory:\n    - slot: 0\n      item:\n        material: DIAMOND\n        amount: 1\n        durability: 0\n        name: null\n        lore: null\n    - slot: 1\n      item:\n        material: GOLDEN_APPLE\n        amount: 1\n        durability: 1\n        name: null\n        lore: null\n    - slot: 2\n      item:\n        material: COAL\n        amount: 48\n        durability: 0\n        name: null\n        lore: null\n    - slot: 3\n      item:\n        material: CHORUS_FLOWER\n        amount: 1\n        durability: 0\n        name: null\n        lore:\n        - Hi!\n        - Boi!\n    - slot: 4\n      item:\n        material: JACK_O_LANTERN\n        amount: 1\n        durability: 0\n        name: '\u00266Hello!'\n        lore: null\n    - slot: 5\n      item:\n        material: LAPIS_BLOCK\n        amount: 1\n        durability: 0\n        name: null\n        lore: null\n```\n\nLike you can see, OpenGUI offers additional `action id` parameters.\nYou can find them in `SerializableSimpleGUI` and use them like this:\n```java\nsimpleGUI.hasAction(int slot)\nsimpleGUI.getActionFor(int slot) // returns String\n```\nYou can use them to append different `ElementResponse` actions for each item.\nIt allows to create dynamic GUIs right from your configuration file.\n\nEnchantments are currently not supported. To be added in `1.2b`\n\n## JUnit\nProject supports JUnit 4.\nTest code is generated automatically using [EvoSuite 1.0.5](http://www.evosuite.org).\n\n## At the end...\nThis project is not well written, or amazing in any case. It's usage is heavily inspired by [AmpMenus](https://github.com/Amperial/AmpMenus)\nbut it's a bit more rich in functionalities and still supported.\n\nIf you have any questions or issues feel free to use github issues forum.\nIf you want to contribute on the project you of course can.\n\n## License and Terms of Use\n**No license** basically. You can do everything with the code, but you can't distribute or sell it.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsocketbyte%2Fopengui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsocketbyte%2Fopengui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsocketbyte%2Fopengui/lists"}