@vespura/vmenu-plugin 0.0.0-stage → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +678 -0
- package/README.md +45 -3
- package/dist/client.js +1923 -0
- package/dist/server.js +267 -0
- package/dist/types/client/diff.d.ts +4 -0
- package/dist/types/client/gate.d.ts +24 -0
- package/dist/types/client/host.d.ts +18 -0
- package/dist/types/client/index.d.ts +14 -0
- package/dist/types/client/item.d.ts +71 -0
- package/dist/types/client/items.d.ts +96 -0
- package/dist/types/client/key.d.ts +38 -0
- package/dist/types/client/menu.d.ts +142 -0
- package/dist/types/client/playerActions.d.ts +68 -0
- package/dist/types/client/plugin.d.ts +119 -0
- package/dist/types/client/preferences.d.ts +2 -0
- package/dist/types/client/settings.d.ts +49 -0
- package/dist/types/client/themes.d.ts +36 -0
- package/dist/types/client/translations.d.ts +10 -0
- package/dist/types/fivem.d.ts +14 -0
- package/dist/types/format.d.ts +2 -0
- package/dist/types/iife.d.ts +2 -0
- package/dist/types/protocol.d.ts +270 -0
- package/dist/types/server/declaration.d.ts +31 -0
- package/dist/types/server/index.d.ts +5 -0
- package/dist/types/server/server.d.ts +30 -0
- package/dist/types/signal.d.ts +12 -0
- package/dist/types/text.d.ts +20 -0
- package/dist/types/version.d.ts +2 -0
- package/dist/vmenu.js +2111 -0
- package/package.json +43 -6
package/README.md
CHANGED
|
@@ -1,3 +1,45 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# @vespura/vmenu-plugin
|
|
2
|
+
|
|
3
|
+
The TypeScript and JavaScript plugin API for vMenu Enhanced, the version of vMenu that runs on FiveM Enhanced (GTA V Enhanced).
|
|
4
|
+
|
|
5
|
+
A plugin is a normal FiveM resource of your own. With this package, your resource can add menus to vMenu, under a Plugins entry on its main menu. You describe the menu in code and the package talks to vMenu over events for you. vMenu never needs to know about your resource ahead of time.
|
|
6
|
+
|
|
7
|
+
Everything the C# plugin API can do is here too. That covers buttons, checkboxes, lists, sliders, dynamic lists, submenus, confirm rows, separators, keys, player actions, translations, permission and setting gates, notifications, text prompts and themes.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { Gate, NotifyStyle, Text, VMenuPlugin } from '@vespura/vmenu-plugin/client';
|
|
11
|
+
|
|
12
|
+
const plugin = VMenuPlugin.create('My Plugin');
|
|
13
|
+
|
|
14
|
+
plugin.translations.add('en', { greet: 'Say hello' });
|
|
15
|
+
|
|
16
|
+
const enabled = plugin.settings.bool('Enabled', true, 'Turns my plugin on or off.');
|
|
17
|
+
|
|
18
|
+
const greet = plugin.rootMenu.addButton(Text.key('greet'), {
|
|
19
|
+
gate: Gate.permission('Greet').and(Gate.setting(enabled)),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
greet.onSelected(() => plugin.notify(NotifyStyle.Success, 'Hello!'));
|
|
23
|
+
|
|
24
|
+
await plugin.connect();
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Your server script declares the permissions and settings through `@vespura/vmenu-plugin/server`:
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import { ServerPluginDeclaration, VMenuServer } from '@vespura/vmenu-plugin/server';
|
|
31
|
+
|
|
32
|
+
await VMenuServer.register(
|
|
33
|
+
new ServerPluginDeclaration('My Plugin')
|
|
34
|
+
.addPermission('Greet', 'Lets someone use the greet button.')
|
|
35
|
+
.addBoolSetting('Enabled', true, 'Turns my plugin on or off.'),
|
|
36
|
+
);
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The package ships ES modules, so bundle your client and server scripts with a bundler such as esbuild before FiveM loads them. Writing plain JavaScript without a bundler? The vMenu Enhanced release zip also has a single `vmenu.js` file in its `plugin-api` folder, to copy into your resource, with the exact same API on a global `vMenu` object.
|
|
40
|
+
|
|
41
|
+
The package version always matches the vMenu Enhanced release it belongs to. A full example resource lives in the [vMenu.ExamplePlugin](https://github.com/TomGrobbe/vMenu.ExamplePlugin) repository, and the documentation is at [docs.vespura.com](https://docs.vespura.com/vmenu/enhanced/plugins/typescript/).
|
|
42
|
+
|
|
43
|
+
## License
|
|
44
|
+
|
|
45
|
+
This package is licensed under the **GNU General Public License v3.0 or later**, `GPL-3.0-or-later`, the same license vMenu Enhanced itself uses. A plugin built on it is a work based on vMenu, so the license comes along with your plugin. Running it on your own server asks nothing of you. The moment you hand your plugin to somebody else, you owe them the complete source under this same license. The [C# package's readme](https://www.nuget.org/packages/vMenu.Enhanced.ClientAPI) explains this in more detail. This is a plain language summary, not legal advice.
|