{"id":16960983,"url":"https://github.com/cubbossa/disposables","last_synced_at":"2026-04-27T18:33:30.800Z","repository":{"id":235317790,"uuid":"779172515","full_name":"CubBossa/Disposables","owner":"CubBossa","description":"A Minecraft library to easily link resources and their lifespans","archived":false,"fork":false,"pushed_at":"2024-05-07T06:32:44.000Z","size":67,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-26T11:12:05.128Z","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":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CubBossa.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-29T07:50:12.000Z","updated_at":"2024-05-07T06:32:48.000Z","dependencies_parsed_at":"2024-04-30T10:00:09.045Z","dependency_job_id":null,"html_url":"https://github.com/CubBossa/Disposables","commit_stats":null,"previous_names":["cubbossa/disposables"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CubBossa%2FDisposables","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CubBossa%2FDisposables/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CubBossa%2FDisposables/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CubBossa%2FDisposables/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CubBossa","download_url":"https://codeload.github.com/CubBossa/Disposables/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244825024,"owners_count":20516586,"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-10-13T22:50:43.357Z","updated_at":"2026-04-27T18:33:25.774Z","avatar_url":"https://github.com/CubBossa.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Disposables\n\nThe library allows you to link the lifespan of different objects.\nObjects may only exist while another parent object exists, which results in a tree structure of logical dependency.\nWith this library, you may link the object to its parent and execute code as soon as the parent\ngets disposed.\n\nThe graphic below illustrates lifetime dependencies and how a crashing plugin\nwill no longer claim resources beyond its lifetime if combined with this library.\n\n![lifetimes](docs/lifetime_overview.svg)\n\n```Java\npublic class MyPlugin extends JavaPlugin {\n  BukkitDisposer disposer;\n  public void onEnable() {\n    disposer = BukkitDisposer.disposer(this);\n    \n    World minigameWorld = createMyPluginWorldForMinigame();\n    // disable world when plugin shuts down\n    disposer.register(MyPlugin.this, minigameWorld);\n    \n    Player player = ...;\n    ChestMenu menu = createMyLobbyGUI(player);\n    \n    // close menu when plugin crashes\n    disposer.register(MyPlugin.this, menu);\n    \n    // run menu close code when player quits (like save settings)\n    disposer.register(player, menu);\n    \n    // unregister inventory listeners when not needed\n    disposer.register(menu, mySpecificInventoryListener);\n    disposer.register(player, mySpecificInventoryListener);\n  }\n  \n  class ChestMenu implements Disposable {\n    @Override\n    public void dispose() {\n      // save player settings from lobby menu here\n    }\n  }\n}\n```\n\n## Maven\n\n```xml\n\u003crepositories\u003e\n  \u003crepository\u003e\n    \u003cid\u003eCubBossa\u003c/id\u003e\n    \u003curl\u003ehttps://nexus.leonardbausenwein.de/repository/maven-public/\u003c/url\u003e\n  \u003c/repository\u003e\n\u003c/repositories\u003e\n\n\u003cdependencies\u003e\n  \u003cdependency\u003e\n    \u003cgroupId\u003ede.cubbossa\u003c/groupId\u003e\n    \u003cartifactId\u003edisposables-api\u003c/artifactId\u003e\n    \u003cversion\u003e1.2\u003c/version\u003e\n  \u003c/dependency\u003e\n  \u003cdependency\u003e\n    \u003cgroupId\u003ede.cubbossa\u003c/groupId\u003e\n    \u003cartifactId\u003edisposables-bukkit\u003c/artifactId\u003e\n    \u003cversion\u003e1.2\u003c/version\u003e\n  \u003c/dependency\u003e\n\u003c/dependencies\u003e\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcubbossa%2Fdisposables","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcubbossa%2Fdisposables","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcubbossa%2Fdisposables/lists"}