{"id":19188837,"url":"https://github.com/ladysnake/locki","last_synced_at":"2025-05-08T02:47:29.551Z","repository":{"id":41805408,"uuid":"367957500","full_name":"Ladysnake/Locki","owner":"Ladysnake","description":"A library for controlling access to the player's inventory","archived":false,"fork":false,"pushed_at":"2024-06-16T14:35:20.000Z","size":1884,"stargazers_count":5,"open_issues_count":4,"forks_count":2,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-04-20T06:35:01.532Z","etag":null,"topics":["fabricmc","hacktoberfest","minecraft-mod"],"latest_commit_sha":null,"homepage":"","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/Ladysnake.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.md","contributing":null,"funding":null,"license":"COPYING","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-05-16T18:30:22.000Z","updated_at":"2025-01-31T14:30:44.000Z","dependencies_parsed_at":"2022-09-12T23:42:05.129Z","dependency_job_id":"aa676077-ffd5-4040-87a6-764b9047da18","html_url":"https://github.com/Ladysnake/Locki","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ladysnake%2FLocki","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ladysnake%2FLocki/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ladysnake%2FLocki/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ladysnake%2FLocki/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ladysnake","download_url":"https://codeload.github.com/Ladysnake/Locki/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252989941,"owners_count":21836665,"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":["fabricmc","hacktoberfest","minecraft-mod"],"created_at":"2024-11-09T11:26:12.037Z","updated_at":"2025-05-08T02:47:29.534Z","avatar_url":"https://github.com/Ladysnake.png","language":"Java","readme":"# Locki\n\n![Example](res/demo.png)\n\nA [Quilt](https://quiltmc.org) library handling player inventory locking. Can also be used as a standalone mod, through the `/locki` command.\n\nThis mod must be installed on both server and client to work properly.\n\n## Overview\n\nLocki represents slots using *inventory nodes*. Inventory nodes are structured as a tree, allowing commands\nor mods to quickly lock or unlock entire sections while retaining controls over finer units.\nInventory nodes are represented as a dot-separated path, from least specific ancestor to most specific child node.\nFor example `inventory` describes the entirety of the player's inventory, while `inventory.armor.chest`\ndescribes the chestplate slot of the inventory.\n\nWhen an inventory node gets locked, descendant nodes can still be unlocked, allowing you to exclude specific slots\nfrom a broad access ban. For example, locking `inventory` then unlocking `inventory.armor.chest` will prevent the player\nfrom touching any item in their inventory except their chestplate.\n\n### Commands\nLocki adds the `/locki` command, allowing server operators and mapmakers to interact with the API through\ncommands.\n- `/locki lock \u003cnode\u003e [\u003ctargets\u003e] [\u003clock\u003e]` : locks the inventories of one or more players\n    - `\u003cnode\u003e` : a full path describing a known *inventory node*.\n    - `[\u003ctargets\u003e]` (optional) : If specified, must be either a player's username or a target selector. If unspecified, defaults to the player using the command. When used in a command block, player is not optional.\n    - `[\u003clock\u003e]` (optional) : If specified, must be a valid identifier referencing a registered lock. If unspecified, defaults to the generic \"command\" lock.\n- `/locki unlock \u003cnode\u003e [\u003ctargets\u003e] [\u003clock\u003e]` : unlocks the inventories of one or more players\n    - `[\u003ctargets\u003e]` (optional) : If specified, must be either a player's username or a target selector. If unspecified, defaults to the player using the command. When used in a command block, player is not optional.\n    - `[\u003clock\u003e]` (optional) : If specified, must be a valid identifier that was previously used as a lock to affect the players' inventories. If left unspecified, defaults to the generic \"command\" lock.\n\n#### Permissions\nIf you have LuckPerms installed, the above commands can be used by players with the `locki.command.lock` permission.\nIf you only grant `locki.command.lock.self`, players will only be able to use the commands on themselves.\n\n## Interfacing with Locki through Fabric Permissions API\n\n```java\nif (Permissions.check(player, \"locki.access.inventory.armor.head\", true)) {\n    // nothing is locking the head slot\n}\n```\nFor a list of default inventory nodes, see [DefaultInventoryNodes.java](src/main/java/org/ladysnake/locki/DefaultInventoryNodes.java).\nSimply prepend the desired node's full path with `locki.access.` before checking.\n\n## Adding Locki to your project\n\nYou can add the library by inserting the following in your `build.gradle` :\n\n```gradle\nrepositories {\n\tmaven { \n        name = \"Ladysnake Mods\"\n        url = \"https://maven.ladysnake.org/releases\"\n        content {\n            includeGroup 'io.github.ladysnake'\n            includeGroup 'org.ladysnake'\n            includeGroupByRegex '(dev|io\\\\.github)\\\\.onyxstudios.*'\n        }\n    }\n    maven {\n        name = \"Nexus Repository Manager\"\n        url = 'https://oss.sonatype.org/content/repositories/snapshots'\n    }\n}\n\ndependencies {\n    modImplementation \"org.ladysnake:locki:${locki_version}\"\n    include \"org.ladysnake:locki:${locki_version}\"\n    // locki dependencies\n    include \"me.lucko:fabric-permissions-api:${fpa_version}\"\n    include \"org.ladysnake.cardinal-components-api:cardinal-components-base:${cca_version}\"\n    include \"org.ladysnake.cardinal-components-api:cardinal-components-entity:${cca_version}\"\n}\n```\n\nYou can then add the library version to your `gradle.properties`file:\n\n```properties\n# Locki\nlocki_version = 0.x.y\n# Fabric Permissions API\nfpa_version = 0.1-SNAPSHOT\n# Cardinal Components\ncca_version = 2.x.y\n```\n\nYou can find the current version of Locki in the [releases](https://github.com/Ladysnake/Locki/releases) tab of the repository on Github,\nand the latest CCA version in the [appropriate repository](https://github.com/OnyxStudios/Cardinal-Components-API/releases).\n\n## Using Locki's API\n\n### Queries\n\n```java\npublic static boolean isMainHandLocked(PlayerEntity player) {\n    return InventoryKeeper.get(player).isLocked(DefaultInventoryNodes.MAIN_HAND);\n}\n```\n\n### Modifications\n\n```java\npublic static final InventoryLock MY_LOCK = Locki.registerLock(\"mymod\", \"awesome_feature\");\n\npublic static void toggleInventoryExceptHands(PlayerEntity player) {\n    if (MY_LOCK.isLocking(player, DefaultInventoryNodes.INVENTORY)) {\n        MY_LOCK.unlockInventory(player);    // equivalent to unlock(player, DefaultInventoryNodes.INVENTORY)\n    } else {\n        MY_LOCK.lockInventory(player);      // equivalent to lock(player, DefaultInventoryNodes.INVENTORY)\n        MY_LOCK.unlock(player, DefaultInventoryNodes.HANDS);\n    }\n}\n```\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fladysnake%2Flocki","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fladysnake%2Flocki","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fladysnake%2Flocki/lists"}