{"id":19952576,"url":"https://github.com/dosmike/eventcommand","last_synced_at":"2026-05-13T17:32:13.661Z","repository":{"id":133519897,"uuid":"277517965","full_name":"DosMike/EventCommand","owner":"DosMike","description":"Map commands to game events using a simple config","archived":false,"fork":false,"pushed_at":"2021-05-06T08:15:32.000Z","size":752,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-12T06:26:25.634Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DosMike.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":"2020-07-06T10:59:45.000Z","updated_at":"2021-05-06T08:15:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"1dd4a007-3714-4ea7-83b4-48a72f256547","html_url":"https://github.com/DosMike/EventCommand","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DosMike%2FEventCommand","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DosMike%2FEventCommand/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DosMike%2FEventCommand/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DosMike%2FEventCommand/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DosMike","download_url":"https://codeload.github.com/DosMike/EventCommand/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241381645,"owners_count":19953751,"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-13T01:13:39.775Z","updated_at":"2026-05-13T17:32:13.634Z","avatar_url":"https://github.com/DosMike.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Event Command\nTriggers commands based on events.\n\n## Scripts\n\nPut all scripts into the `config/eventcommand` folder. Scripts have to end with the extension `.ec` (Save as any file \\*.\\* if your system is hiding file extensions).\n\nYou can have any amount of files in that folder.\n\nLines that start with `--` are ignored.\nIndentation throughout the file has to be consistently either tabs or spaces.\nThe whole script (with exception to event names and mappers) is case-insensitive, although it is recommended to use consistent case for readability.\n\nThere are 4 types of statements: Triggers, 'with'-chains, mathematics and filters/actions.\n'With'-chains are optional, as are mathematics. If you want to do any mathematics, they have to be after 'with'-chains.\n\n### Trigger\n\nListen to an event with `@ Event`. The event has to be the fully qualified name.\nFor example `org.spongepowered.api.event.network.ClientConnectionEvent$Join`\nYou can look up all sponge events on https://jd.spongepowered.org/7.2.0/index.html but note\nthat dots in class names (nested classes) have to be replaced with dollar signs \n(`ClientConnectionEvent.Join` -\u003e `ClientConnectionEvent$Join`).\n\n### 'with'-chains\n\nFollowing the listener declaration you can extract information from the event using 'with'-chains.\nThe syntax is `with NAME as MAPPERS` where NAME is any label (without spaces). MAPPERS is a chain of one or more elements from this list:\n * `\u0026classname` searches the cause stack for the first occurance of this type. Requires a fully qualified name, like event class names.\n * `#key` tries to get a `Key` value from the ValueContainer. Supports field names of [Keys](https://jd.spongepowered.org/7.3.0/org/spongepowered/api/data/key/Keys.html). For other `Key`s you have to use the `Key`'s id.\n * numbers to index into arrays, `List`s or `Iterable`s\n * method names to get values. Methods may not be static or void return.\n\nThe following variables are available by default but can be overwritten on event basis:\n * `GAME` contains `Sponge.getGame()`\n * `SERVER` contains `Sponge.getServer()`\n\n### Mathematics\n\nAll calculations are done as double. The syntax for it is `let NAME be MATH EXPRESSION`.\nIf you don't like to use the keyword `be` you can also use a simple `=` or `:=`.\nThe `MATH EXPRESSION` supports variables in the `${NAME}` format.\nMultiplication, division, addition, subtraction, powers(`^`), modulo(`%`) and grouping(`()`) are supported.\n\n### Filters\n\nIf you don't want an action to run every time, you can filter them as well. The syntax is:\n```\nfor CONDITION\n  actions/nested filters\notherwise\n  actions/nested filters\n```\nThe otherwise block is optional, but cannot be the only block.\nActions blocks are grouped by indentation, this means that every case (you can have more than one for block)\nhas to be written on the same indentation level, and all actions have to be placed deeper.\nEvery condition can specify an arbitrary amount of `CONDITIONS`, but the `otherwise` block has to go without.\n\n#### Conditions\n\nOn **Strings**: String Literals are enclosed in double-quotes(`\"`).\nSupported escape sequences are: `\\n`, `\\t`, `\\\\` and `\\\"` \n* `global every DURATION`   \n  `${PLAYER} every DURATION`   \n  This filter restricts execution on a time base. `DURATION` can be things like 10m, 1h, 30s or in the format mm:ss or hh:mm:ss.\n  Cooldowns per player require a variable that represents a Player object, player name or player uuid.\n* `${PLAYER} hasPermission \"PERMISSION\"`\n  For some actions you might want to check player permissions. This condition requires `PERMISSION` to be quoted.\n  The player variable again has to represent a Player object, player name or player uuid. \n* Comparisons   \n  You can compare two values, where at lease one has to be a variable. The comparing type has to be numeric or plain text.   \n  For numbers the comparators `\u003c`, `\u003e`, `\u003c=`, `\u003e=`, `==` (or `=`), `!=` (or `\u003c\u003e`) are available.   \n  For strings the comparators `\u003c`, `\u003e`, `\u003c=`, `\u003e=`, `===`, `!=` (or `\u003c\u003e`) make case-sensitive lexicographic comparisons.\n  Case-insensitive comparison can be done with `=` and `==`.\n  The special comparator `matches` compiles a right hand string literal into a regex and matches the left hand against it.\n* `not CONDITION`   \n  Any condition can be inverted once by prefixing it with the word `not`\n\n### Actions\n\nLastly you can specify actions your trigger should take.\nActions are command that are either executed as the player triggering the event, or as console if you prefix the\ncommand with an exclamation point (`!`) instead of a slash (`/`). Leading slashes for commands are optional.\nYou can insert the values from 'with'-chains with `${NAME}`.\nPlease also keep in mind that not every event has a player as cause, so you might use something like\n`!execute as ${PLAYER} run ...`.\n\nAfter running a action the following variables will be updated or removed automatically, based on the command:\n * `successCount` the commands' success count, if applicable. Usually \u003e 0 on success, 0 otherwise.\n * `queryResult` the commands' result count, if applicable.\n * `affectedBlocks` the number of affected blocks, if applicable.\n * `affectedEntities` the number of affected entities, if applicable.\n * `affectedItems` the number of affected items, if applicable.\n\n####Cancelling Events\n\nYou can also cancel cancellable events with the special action `cancel`.\n\n**This is not a command!** Do not prefix this action with `/` or `!`.\n\n## Plugin Support\n\nEvent Command also supports [LuckPerms](https://luckperms.net/) events.\nFor a list of LP Events, see the [LuckPerms SourceCode](https://github.com/lucko/LuckPerms/tree/master/api/src/main/java/net/luckperms/api/event)\n(make sure the classes extend LuckPermsEvent).\n\n## Examples\n\n```\n-- Sponge event\n@ org.spongepowered.api.event.entity.TameEntityEvent\n  -- player should be this most of the time:\n  with player as \u0026org.spongepowered.api.entity.living.player.Player getName\n  with entity as getTargetEntity getType getName\n  !tell ${player} You tamed this ${entity}\n\n@ org.spongepowered.api.event.network.ClientConnectionEvent$Join\n  with player as getTargetEntity getName\n  with world as getTargetEntity getLocation getExtent getName\n  for ${world} != \"overworld\"\n    -- teleport to spawn if no /spawn command is available\n    !execute in \"overworld\" run tp ${player} 0 60 0 \n\n-- Event for other Plugins\n@ de.dosmike.sponge.minesweeper.MinesweeperGameEvent$Victory\n  with player as getTargetEntity getName\n  for ${player} every 5m\n    !effect ${player} luck 30 1\n  otherwise\n    !tellraw ${player} {\"text\":\"Sorry, but you've already received the luck effect recently\",\"color\":\"red\"}\n\n@ de.dosmike.sponge.minesweeper.MinesweeperGameEvent$Defeat\n  with player as getTargetEntity getName\n  for ${player} every 5min\n    !effect ${player} unluck 30 1\n```\n\n### Need Help?\n#### [Join my Discord](https://discord.gg/E592Gdu)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdosmike%2Feventcommand","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdosmike%2Feventcommand","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdosmike%2Feventcommand/lists"}