{"id":19516286,"url":"https://github.com/riking/templateworlds","last_synced_at":"2025-07-14T09:41:49.422Z","repository":{"id":142311475,"uuid":"11211812","full_name":"riking/TemplateWorlds","owner":"riking","description":"Library plugin to have Bukkit worlds that can be restored to an unchanging template.","archived":false,"fork":false,"pushed_at":"2014-06-24T20:15:33.000Z","size":335,"stargazers_count":0,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-14T04:03:10.961Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/riking.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":"2013-07-06T02:17:11.000Z","updated_at":"2014-06-24T20:15:33.000Z","dependencies_parsed_at":"2023-03-13T10:10:20.322Z","dependency_job_id":null,"html_url":"https://github.com/riking/TemplateWorlds","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/riking/TemplateWorlds","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riking%2FTemplateWorlds","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riking%2FTemplateWorlds/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riking%2FTemplateWorlds/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riking%2FTemplateWorlds/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/riking","download_url":"https://codeload.github.com/riking/TemplateWorlds/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riking%2FTemplateWorlds/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265271948,"owners_count":23738362,"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-10T23:45:30.028Z","updated_at":"2025-07-14T09:41:49.001Z","avatar_url":"https://github.com/riking.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"TemplateWorlds\n==============\n\nLibrary plugin to have Bukkit worlds that can be restored to an unchanging template.\n\nThis project uses [semantic versioning](http://semver.org/spec/v2.0.0.html) for its `api` package. The `impl` package is not versioned.\nThis project is licensed under the BSD 2-Clause License. [License text available here.](http://opensource.org/licenses/BSD-2-Clause)\n\n### Usage guide\nOnly the classes in the `api` package should be used by other plugins.\n\nFor development with Maven, put this in your pom.xml `dependencies` section:\n```xml\n    \u003cdependency\u003e\n      \u003cgroupId\u003ecom.github.riking.lib.templateworlds\u003c/groupId\u003e\n    \t\u003cartifactId\u003etemplateworlds\u003c/artifactId\u003e\n    \t\u003cversion\u003e[2.1.0, 3.0.0)\u003c/version\u003e\n    \t\u003cscope\u003eprovided\u003c/scope\u003e\n    \u003c/dependency\u003e\n```\nThis lets you develop with updates for any API upgrades until a breakage, which would be version 3.0.0.\n*(If you are able to provide Maven repository hosting, please contact me and I will put the info here!)*\n\n\n#### Simple usage\nHere, we create a 'lobby' world which is a clone of 'lobby-template'. Note that the template world is not stored, while the created lobby world is. \n```java\nApiMain templateApi = getServer().getServicesManager().getRegistration(ApiMain.class).getProvider();\nWorld templateLobby = getServer().createWorld(new WorldCreator(\"lobby-template\"));\nthis.lobby = twApi.createWorld(\"lobby\", templateLobby);\n```\nLet's say that while the players are waiting for the game to start, the lobby world gets a bit trashed. To revert it back, you want to first remove all players from that world - maybe the game starts, so there's nobody there anymore.\nUse the resetArea() method over the whole area that the lobby is in:\n```java\ntwApi.resetArea(this.lobby, new Location(-100, 0, -100, null), new Location(100, 0, 100, null));\n```\n\n#### Multiple templates\nIf you want to have multiple maps that you cycle through for your game, you will need to call `changeTemplate(World, World)` followed by a `resetArea`.\nchangeTemplate will modify the internal reference used by the generator, which will be referred to during resetArea.\n\nHere's an example map cycle procedure. Q is some arbitrary part of your plugin that holds the variables shown.\n```java\npublic class Q {\n    // ...\n    ApiMain twApi;\n    World gameWorld; // Playing world. This is 'templated'\n    World currentMap;\n    List\u003cString\u003e maps;\n    // ...\n    public String nextMap() {\n        int ind = random.nextInt(maps.size());\n        return maps.get(ind);\n    }\n    // ...\n}\n\npublic class ChangeMapPart1 implements Runnable {\n    private Q q;\n    public ChangeMapPart1(Q q) {\n        this.q = q;\n    }\n\n    public void run() {\n        // Get everyone out\n        // !! Beware of BUKKIT-1331 - if you trigger on death, this must be run through scheduler\n        for (Player p : q.gameWorld.getPlayers()) {\n            p.teleport(q.lobbyEntry);\n        }\n\n        // Unload the old map (optional)\n        Bukkit.unloadWorld(q.currentMap, false);\n\n        // Choose the next map. Load it with a VoidGenerator to avoid save inflation. \n        String nextMap = q.nextMap();\n        // broadcast something in chat\n        // [G] Loading map ctf_towers...\n        q.currentMap = new WorldCreator(nextMap).generator(q.twApi.getVoidGenerator());\n\n        // Change the template being used by the game world\n        q.twApi.changeTemplate(q.gameWorld, q.currentMap);\n\n        // Change the GameWorld to the new map (this is an approx. 1000x1000 area - (-512, +512))\n        q.twApi.resetAreaGradually(q.gameWorld, -32, -32, 32, 32, new ChangeMapPart2(q));\n    }\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Friking%2Ftemplateworlds","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Friking%2Ftemplateworlds","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Friking%2Ftemplateworlds/lists"}