{"id":21031311,"url":"https://github.com/eldoriarpg/schematic-sanitizer","last_synced_at":"2025-05-15T11:33:29.302Z","repository":{"id":174396545,"uuid":"637394903","full_name":"eldoriarpg/schematic-sanitizer","owner":"eldoriarpg","description":"Api and plugin to remove blocks, entities and nbt tags from a schematic. https://hangar.papermc.io/Eldoria/SchematicSanitizer","archived":false,"fork":false,"pushed_at":"2024-11-18T22:49:21.000Z","size":3422,"stargazers_count":4,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-18T23:44:18.762Z","etag":null,"topics":["fastasyncworldedit","paper-plugin","papermc"],"latest_commit_sha":null,"homepage":"https://eldoriarpg.github.io/schematic-sanitizer/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eldoriarpg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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},"funding":{"github":"RainbowDashLabs","patreon":"eldoriaplugins","open_collective":null,"ko_fi":"eldoriaplugins","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":["https://paypal.me/hadde"]}},"created_at":"2023-05-07T12:33:27.000Z","updated_at":"2024-08-16T14:34:38.000Z","dependencies_parsed_at":"2023-12-22T19:31:32.940Z","dependency_job_id":"f5aadd76-7dda-46f2-aa72-cb9d081bbc35","html_url":"https://github.com/eldoriarpg/schematic-sanitizer","commit_stats":null,"previous_names":["eldoriarpg/schematic-sanitizer"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoriarpg%2Fschematic-sanitizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoriarpg%2Fschematic-sanitizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoriarpg%2Fschematic-sanitizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoriarpg%2Fschematic-sanitizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eldoriarpg","download_url":"https://codeload.github.com/eldoriarpg/schematic-sanitizer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225349134,"owners_count":17460315,"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":["fastasyncworldedit","paper-plugin","papermc"],"created_at":"2024-11-19T12:27:11.773Z","updated_at":"2024-11-19T12:27:12.543Z","avatar_url":"https://github.com/eldoriarpg.png","language":"Java","funding_links":["https://github.com/sponsors/RainbowDashLabs","https://patreon.com/eldoriaplugins","https://ko-fi.com/eldoriaplugins","https://paypal.me/hadde"],"categories":[],"sub_categories":[],"readme":"[![Publish](https://img.shields.io/github/actions/workflow/status/eldoriarpg/schematic-sanitizer/publish_to_nexus.yml?style=for-the-badge\u0026label=Publish)][publish]\n[![Build](https://img.shields.io/github/actions/workflow/status/eldoriarpg/schematic-sanitizer/verify.yml?style=for-the-badge\u0026label=Build)][verify]\n\n[![Releases](https://img.shields.io/nexus/maven-releases/de.eldoria.schematic-sanitizer/api?label=Release\u0026logo=Release\u0026server=https%3A%2F%2Feldonexus.de\u0026style=for-the-badge)][release]\n[![Development](https://img.shields.io/nexus/maven-dev/de.eldoria.schematic-sanitizer/api?label=DEV\u0026logo=Release\u0026server=https%3A%2F%2Feldonexus.de\u0026style=for-the-badge)][development]\n[![Snapshots](https://img.shields.io/nexus/s/de.eldoria.schematic-sanitizer/api?color=orange\u0026label=Snapshot\u0026server=https%3A%2F%2Feldonexus.de\u0026style=for-the-badge)][snapshot]\n\n\n# Schematic Sanitizer\n\nThe schematic sanitizer can check and filter schematics.\nThis can be done by an extensive config which allows to blacklist entities, blocks and even specific nbt tags and values contained in those tags.\n\nThe sanitizer can give you a report of found issues on the schematic or even fix them right away and output a new file.\n\nThis plugin can be used as a standalone plugin or as an api.\n\nDownload from [hangar](https://hangar.papermc.io/Eldoria/SchematicSanitizer)\n\n[![Cooperation-Label: Recommended and supported by RedstoneWorld](https://redstoneworld.de/bilder/kooperation/Cooperation-Label.png)](https://redstoneworld.de)\n\n## Usage as a plugin\n\nUse `/schematicsanitizer` to get into the plugin.\n\n### Checking a schematic\n\nUse `/schematicsanitizer check \u003cschematic name\u003e` to get a report of a specific schematic.\n\nThe report will contain a list of removed entities and block and also list their removal cause.\n\n![img.png](assets/report.png)\n\n### Fixing a schematic\n\nInstead of just checking you can use `/schematicsanitizer fix \u003cschematic name\u003e [new name]`, which will perform the check and write the cleaned schematic into a file.\n\nIf you leave the new name empty a new file suffixed with `_new` will be created.\n\nIf you add the -o flag at the end you will override the original file.\n\nThe schematic sanitizer will do the following:\n\n- Remove blocks which are blacklisted\n- Remove entities that are blacklisted\n- Remove blocks which contain blacklisted nbt data\n- Remove entities that contain blacklisted nbt data\n- Remove every creature once the limit is reached\n- Remove every non creature once the limit is reached\n\nWhat it won't do:\n\n- Change the size of the schematic in any way\n- Remove any blocks once the limit is exceeded\n\n### Batch processing\n\nInstead of just fixing a single schematic you can fix a whole directory with `/schematicsanitizer fixbatch \u003cdirectory\u003e`.\n\nThis will fix all schematics directly inside this directory. Schematics will be saved to an adjacent directory suffixed with `_new`.\nAdding the `-o` flag will override the original files.\n\nYou will receive a short report of every single schematic telling you the problems if there were some.\n\n### Permissions\n\n| Permission                   | Action                            |\n|------------------------------|-----------------------------------|\n| schematicsanitizer.fix.use   | Access to the fix subcommand      |\n| schematicsanitizer.fix.batch | Access to the fixbatch subcommand |\n| schematicsanitizer.check.use | Access to the check subcommand    |\n| schematicsanitizer.admin     | Access to the debug subcommand    |\n\nThe report subcommand can be used by anyone who has permissions for fix or check.\n\n## Usage as an api\n\n### [Javadocs](https://eldoriarpg.github.io/schematic-sanitizer/)\n\n**Gradle**\n``` kotlin\nrepositories {\n    maven(\"https://eldonexus.de/repository/maven-public\")\n}\n\ndependencies {\n    compileOnly(\"de.eldoria.schematic-sanitizer\", \"api\", \"version\")\n}\n```\n\n**Maven**\n``` xml\n\u003crepository\u003e\n    \u003cid\u003eEldoNexus\u003c/id\u003e\n    \u003curl\u003ehttps://eldonexus.de/repository/maven-public/\u003c/url\u003e\n\u003c/repository\u003e\n\n\u003cdependency\u003e\n    \u003cgroupId\u003ede.eldoria.schematic-sanitizer\u003c/groupId\u003e\n    \u003cartifactId\u003eapi\u003c/artifactId\u003e\n    \u003cversion\u003eversion\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nGet the path of your schematic\n```java\nPath schematic = getDataFolder().toPath().resolve(\"myschematic.schem\");\n```\n\nCreate your settings\n\n```java\nSettings settings = Settings.builder()\n        .filter(filter -\u003e filter\n                .blockFilter(blocks -\u003e blocks.withMaterialBlacklist(Material.COMMAND_BLOCK)\n                .entityFilter(entities -\u003e entities\n                        .removeCreature(true)\n                        .withEntityBlacklist(EntityTypes.COMMAND_BLOCK_MINECART)\n                .withTextBlacklist(\"clickEvent\",\"run_command\")\n                .withNbtBlacklist(\"Item\",\"Items\"))\n        .limit(limit -\u003e limit\n                .size(600)\n                .contentLimit(c -\u003e c.blocks(50000).creatures(50).nonCreatures(600)))\n        .build();\n```\n\u003cdetails\u003e\n\u003csummary\u003eFull Settings example\u003c/summary\u003e\n\n```java\nSettings settings = Settings.builder()\n        .filter(filter -\u003e filter\n                .blockFilter(blocks -\u003e blocks\n                        .withMaterialBlacklist(\n                                Material.COMMAND_BLOCK,\n                                Material.REPEATING_COMMAND_BLOCK,\n                                Material.CHAIN_COMMAND_BLOCK,\n                                Material.STRUCTURE_BLOCK)\n                )\n                .entityFilter(entities -\u003e entities\n                        .removeCreature(true)\n                        .removeNonCreatures(false)\n                        .withEntityBlacklist(\n                                EntityTypes.COMMAND_BLOCK_MINECART,\n                                EntityTypes.FALLING_BLOCK,\n                                EntityTypes.POTION)\n                )\n                .withTextBlacklist(\n                        \"clickEvent\",\n                        \"run_command\"\n                )\n                .withNbtBlacklist(\n                        \"LootTable\",\n                        \"ArmorItem\",\n                        \"ArmorItems\",\n                        \"HandItem\",\n                        \"HandItems\",\n                        \"FireworksItem\",\n                        \"Item\",\n                        \"Items\",\n                        \"DecorItem\",\n                        \"Inventory\",\n                        \"buy\",\n                        \"buyB\",\n                        \"sell\",\n                        \"SaddleItem\"\n                )\n        )\n        .limit(limit -\u003e limit\n                .size(600)\n                .contentLimit(content -\u003e content\n                        .blocks(50000)\n                        .creatures(50)\n                        .nonCreatures(600)\n                )\n        )\n        .build();\n```\n\u003c/details\u003e\n\nCreate a Sanitizer instance\n\n```java\nSanitizer sanitizer = Sanitizer.create(schematic, settings);\n```\n\nPerform a check and evaluate the report\n\n```java\nSanitizerReport check = sanitizer.check();\n\ngetLogger().info(\"Removed %d blocks\".formatted(check.blocks().size()));\n\nfor (RemovedBlock entity : check.blocks().entities()) {\n    getLogger().info(\"Removed block %s at %s caused by %s\".formatted(entity.type(), entity.location(), entity.removalCause()));\n}\n\ngetLogger().info(\"Removed %d entities\".formatted(check.entities().size()));\n\nfor (RemovedEntity entity : check.entities().entities()) {\n    getLogger().info(\"Removed entity %s at %s caused by %s\".formatted(entity.type(), entity.location(), entity.removalCause()));\n}\n```\n\nAlternatively you can perform a fix of the schematic\n\n```java\nSanitizerReport fix = sanitizer.fix(Path.of(\"path\", \"to\", \"new\", \"file.schem\"));\n```\n\nInstead of providing a path you can also just provide a new name and the new schematic will be created next to the old one.\nIf you provide no name the original schematic will be overridden. \n\n[publish]: https://github.com/eldoriarpg/schematic-sanitizer/actions/workflows/publish_to_nexus.yml\n[verify]: https://github.com/eldoriarpg/schematic-sanitizer/actions/workflows/verify.yml\n[release]: https://eldonexus.de/#browse/browse:maven-releases:de%2Feldoria%2Fschematic-sanitizer\n[development]: https://eldonexus.de/#browse/browse:maven-dev:de%2Feldoria%2Fschematic-sanitizer\n[snapshot]: https://eldonexus.de/#browse/browse:maven-snapshots:de%2Feldoria%2Fschematic-sanitizer\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feldoriarpg%2Fschematic-sanitizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feldoriarpg%2Fschematic-sanitizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feldoriarpg%2Fschematic-sanitizer/lists"}