{"id":16374992,"url":"https://github.com/moderocky/skriptlab","last_synced_at":"2026-03-31T16:30:18.134Z","repository":{"id":103957386,"uuid":"376526187","full_name":"Moderocky/SkriptLab","owner":"Moderocky","description":"A simple and lightweight tool to auto-generate Skript syntax.","archived":false,"fork":false,"pushed_at":"2023-10-25T10:46:53.000Z","size":165,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-01T04:15:12.761Z","etag":null,"topics":["bytecode","library","registration","skript","syntax"],"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/Moderocky.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-13T11:37:13.000Z","updated_at":"2023-10-05T13:28:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"5fa07149-692b-4cec-8595-157e59a17196","html_url":"https://github.com/Moderocky/SkriptLab","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/Moderocky%2FSkriptLab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Moderocky%2FSkriptLab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Moderocky%2FSkriptLab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Moderocky%2FSkriptLab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Moderocky","download_url":"https://codeload.github.com/Moderocky/SkriptLab/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239954694,"owners_count":19724286,"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":["bytecode","library","registration","skript","syntax"],"created_at":"2024-10-11T03:19:02.332Z","updated_at":"2026-03-31T16:30:17.995Z","avatar_url":"https://github.com/Moderocky.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"SkriptLab\n=====\n\nAn automatic syntax-creation library for Skript addons.\n\n### Introduction\n\nThe original version of this resource was an experiment in my Mask library to be able to auto-generate Skript syntax at\nruntime using only annotations.\n\nSkript's syntax classes require a large amount of boilerplate that, for the majority of cases, ends up being\ncookie-cutter work, which is slow, tedious and largely unnecessary for creating simple wrappers.\nThis will deter many plugins from adding their own native Skript support, leading to the creation of addons dedicated\nentirely to providing syntax for one or two plugins, or a group of similar plugins. (See regions addon, permissions\naddon, holograms addon, etc.)\n\nIn an ideal world, it would be up to the plugin creator to add their own Skript support, but it is very understandable\nwhy they would not want to.\n\nSkriptLab aims to solve this through the following goals:\n\n- To provide a simple and minimalist way to add Skript syntax\n- To generate syntax that is comparable in speed and quality to hand-written syntax classes\n- To provide a lightweight dependency\n- To avoid excess garbage and memory pollution\n\nEvery Skript syntax requires its own class. This makes anonymous runtime generation problematic, since the programmer\nmight not know what classes are required.\n\nTo overcome this problem, SkriptLab compiles individual syntax classes to suit the program's needs while it is running.\nThese are assigned to a child classloader, and can be disposed of or replaced as needed.\n\n### Maven Information\n\n```xml\n\n\u003crepository\u003e\n    \u003cid\u003ekenzie\u003c/id\u003e\n    \u003curl\u003ehttps://repo.kenzie.mx/releases\u003c/url\u003e\n\u003c/repository\u003e\n``` \n\n```xml\n\n\u003cdependency\u003e\n    \u003cgroupId\u003emx.kenzie\u003c/groupId\u003e\n    \u003cartifactId\u003eskriptlab\u003c/artifactId\u003e\n    \u003cversion\u003e2.0.0\u003c/version\u003e\n    \u003cscope\u003ecompile\u003c/scope\u003e\n\u003c/dependency\u003e\n```\n\n## Usage\n\n### Syntax Generation\n\nSyntax is created through a `SyntaxGenerator`. This is a reusable controller object that holds on to all the generated\nsyntax information.\nThis also holds the class loader in which syntax elements are bootstrapped, so once the syntax generator object is\ndiscarded the syntax classes can also be garbage collected (providing they are unregistered and no longer in use).\n\nThe generator has two uses:\n\nTo make full syntax classes out of patterns and simple functional interfaces.\n\n```java \nfinal Syntax syntax = generator.createCondition((event, inputs) -\u003e {\n    final String text = inputs.get(0);\n    return text.isBlank();\n}, \"%text% is blank\");\n// syntax.register();\n```\n\nTo generate syntax classes from annotations on members.\n\n```java \n\n@Type\npublic class Elephant { // %elephant%\n    \n    @Expression(\"[a] new elephant\")\n    public static Elephant create() { // set {_var} to a new elephant\n        return new Elephant();\n    }\n    \n    @PropertyCondition\n    public boolean isOkay() { // if {_var} is okay:\n        return true;\n    }\n    \n    @PropertyExpression\n    public double trunkLength() { // {_var}'s trunk length\n        return 5;\n    }\n    \n    @PropertyExpression(mode = AccessMode.SET)\n    public void trunkLength(Number length) { // set {_var}'s trunk length to 10\n        // ...\n    }\n    \n    @PropertyExpression(mode = AccessMode.ADD, value = \"trunk length\")\n    public void trunkLength(Number length) { // add 2 to {_var}'s trunk length\n        // ...\n    }\n\n}\n```\n\n### Annotations\n\nSkriptLab is accessed through a series of five basic annotations.\n\n| Name               | Target                | Usage                                                                                                                                                     |\n|--------------------|-----------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Effect             | Method                | A runnable Skript effect. Inputs are passed to the method parameters. If used on a dynamic method, the first input is assumed to be the object.           |\n| Condition          | Method (boolean)      | A condition. Inputs are passed to the method parameters. If used on a dynamic method, the first input is assumed to be the object.                        |\n| PropertyCondition  | Method (boolean)      | A shortcut for creating simple conditions of the type `X is alive`                                                                                        |\n| Expression         | Method (any non-null) | An expression that returns a value. Inputs are passed to the method parameters. If used on a dynamic method, the first input is assumed to be the object. |\n| PropertyExpression | Methods               | An expression of the type `the X of Y` or `Y's X` where X is the property name and Y is the object. Multiple methods can be used for each access mode.    |\n| Type               | Class                 | Registers the given object class as a Skript Type, allowing it to be used in syntax.                                                                      |\n\nThese annotations are designed to be unobtrusive and easy to add into a plugin's existing code without requiring any\nchanges or extra classes to be created.\n\nSkriptLab will attempt to generate sensible and legible syntax automatically based on the method/class name, but\nthis can be manually overridden (such as when inputs are required) with the annotation value.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoderocky%2Fskriptlab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoderocky%2Fskriptlab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoderocky%2Fskriptlab/lists"}