{"id":19557811,"url":"https://github.com/jbangdev/jbang-minecraft","last_synced_at":"2025-04-26T23:31:32.062Z","repository":{"id":49257891,"uuid":"322966229","full_name":"jbangdev/jbang-minecraft","owner":"jbangdev","description":null,"archived":false,"fork":false,"pushed_at":"2023-12-23T11:45:07.000Z","size":11,"stargazers_count":5,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-19T11:42:09.339Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/jbangdev.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-12-20T00:45:37.000Z","updated_at":"2024-10-19T14:58:25.000Z","dependencies_parsed_at":"2023-12-28T22:35:55.287Z","dependency_job_id":null,"html_url":"https://github.com/jbangdev/jbang-minecraft","commit_stats":{"total_commits":8,"total_committers":4,"mean_commits":2.0,"dds":0.625,"last_synced_commit":"befa69092fd196b911f45a034bda301668760906"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbangdev%2Fjbang-minecraft","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbangdev%2Fjbang-minecraft/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbangdev%2Fjbang-minecraft/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbangdev%2Fjbang-minecraft/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jbangdev","download_url":"https://codeload.github.com/jbangdev/jbang-minecraft/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250440542,"owners_count":21431017,"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":"2024-11-11T04:44:05.259Z","updated_at":"2025-04-26T23:31:31.773Z","avatar_url":"https://github.com/jbangdev.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"## JBang with Minecraft\n\u003c!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --\u003e\n[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-)\n\u003c!-- ALL-CONTRIBUTORS-BADGE:END --\u003e\n\nThis is a work in progress in trying to see how to make\nMinecraft launching and development easier with jbang.\n\nCurrently using [sponge](https://www.spongepowered.org) as it seemed\nto be the Minecraft server with the best documentation and least\namount of \"hacks\".\n\nRequirements: Nothing. This will download jbang and java when needed. \n\n### Run Minecraft\n\nIf you do not have jbang installed you can run the following:\n\n```shell\ncurl -sL https://sh.jbang.dev | bash -s -- app setup \u0026\u0026 jbang sponge@jbangdev/jbang-minecraft\n```\n\nif on Windows it is:\n\n```shell\niex \"\u0026 { $(iwr https://ps.jbang.dev) } app setup\"\njbang sponge@jbangdev/jbang-minecraft\n```\n\nWhen you have [jbang](https://jbang.dev) installed you can just run:\n\n```shell\njbang sponge@jbangdev/jbang-minecraft\n```\n\nor if you want to run the spongevanilla jar directly - this has the advantage of a simpler classpath; but disadvantage \nis that you need to have to specify a very long url and it will not setup `eula.txt`:\n\n```\njbang --java 8 https://repo.spongepowered.org/maven/org/spongepowered/spongevanilla/1.12.2-7.3.0/spongevanilla-1.12.2-7.3.0.jar\n```\n\nTo run with debugging just add `--debug`, as in `jbang --debug ...` and connect a debugger on port 4004.\n### Write a Minecraft plugin\n\nNote: You do not need to run Minecraft with jbang to develop a plugin with jbang. It is completely independent.\n\nGiven a Sponge Minecraft install do the following:\n\n```\ncd mods\njbang init ExamplePlugin.java\njbang edit --open=code ExamplePlugin.java\n```\n\nThen paste the following into the newly created file, overwriting its contents:\n\n```java\n//REPOS sponge=https://repo.spongepowered.org/maven\n//DEPS org.spongepowered:spongeapi:7.2.0\n//JAVA 8\n\nimport java.util.Optional;\nimport org.spongepowered.api.entity.living.player.Player;\nimport org.spongepowered.api.event.EventListener;\nimport org.spongepowered.api.event.action.CollideEvent;\nimport org.spongepowered.api.text.Text;\n\nimport org.spongepowered.api.plugin.Plugin;\n\nimport org.spongepowered.api.plugin.Plugin;\nimport org.spongepowered.api.event.Listener;\nimport org.spongepowered.api.event.game.state.GameStartedServerEvent;\n\n// Imports for logger\nimport com.google.inject.Inject;\nimport org.slf4j.Logger;\n\n@Plugin(id = \"exampleplugin\", name = \"Example Plugin\", version = \"1.0\", description = \"Example\")\npublic class ExamplePlugin {\n\n    @Inject\n    private Logger logger;\n\n    @Listener\n    public void onServerStart(GameStartedServerEvent event) {\n        logger.info(\"Successfully running ExamplePlugin!!!\");\n    }\n\n    int counter = 0;\n\n    @Listener\n    public void handle(CollideEvent event) {\n        logger.info(\"colliding: \" + counter++);\n    \n        Optional\u003cPlayer\u003e playerOptional = event.getCause().\u003cPlayer\u003efirst(Player.class);\n        playerOptional.ifPresent(player -\u003e {\n            player.sendMessage(Text.builder(\"boing\").build());\n        });\n    }\n}\n```\n\nIt is a very dumb/simple plugin that will just print out to console on every collide event.\n\nNow, to get it build and made visible to sponge simple export the jar:\n\n```\njbang export ExamplePlugin.java\n```\n\nYou should now have `mods\\ExamplePlugin.jar`.\n\nNow restart your Minecraft Server and you should see it start and keep counting up.\n\nFor every change you will do the same, export the jar and then restart the server.\n\n\n\n\n\n\n\n## Contributors ✨\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"http://code.msgilligan.com\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/61612?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eSean Gilligan\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/jbangdev/jbang-minecraft/commits?author=msgilligan\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbangdev%2Fjbang-minecraft","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjbangdev%2Fjbang-minecraft","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbangdev%2Fjbang-minecraft/lists"}