@quenty/cmdrservice 3.8.0 → 3.9.0
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/CHANGELOG.md +19 -0
- package/package.json +9 -9
- package/src/Client/CmdrServiceClient.lua +19 -2
- package/src/Server/CmdrService.lua +22 -9
- package/src/Server/CmdrTemplateProviderServer/CmdrExecutionTemplate.lua +3 -3
- package/test/scripts/Client/ClientMain.client.lua +3 -3
- package/test/scripts/Server/ServerMain.server.lua +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [3.9.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/cmdrservice@3.8.1...@quenty/cmdrservice@3.9.0) (2022-01-17)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* Cmdrservice can yield while requiring cmdrclient, prevent this from yielding all services ([2330373](https://github.com/Quenty/NevermoreEngine/commit/23303730a2993c544d361eff2752b3d71a75abdb))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [3.8.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/cmdrservice@3.8.0...@quenty/cmdrservice@3.8.1) (2022-01-16)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @quenty/cmdrservice
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
# [3.8.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/cmdrservice@3.7.0...@quenty/cmdrservice@3.8.0) (2022-01-07)
|
|
7
26
|
|
|
8
27
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/cmdrservice",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.0",
|
|
4
4
|
"description": "Bridge between cmdr and Nevermore services using servicebag",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
"Quenty"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@quenty/loader": "^3.
|
|
29
|
-
"@quenty/maid": "^2.0
|
|
30
|
-
"@quenty/permissionprovider": "^4.
|
|
31
|
-
"@quenty/promise": "^3.
|
|
32
|
-
"@quenty/remoting": "^3.
|
|
33
|
-
"@quenty/servicebag": "^3.
|
|
28
|
+
"@quenty/loader": "^3.4.0",
|
|
29
|
+
"@quenty/maid": "^2.1.0",
|
|
30
|
+
"@quenty/permissionprovider": "^4.7.0",
|
|
31
|
+
"@quenty/promise": "^3.6.0",
|
|
32
|
+
"@quenty/remoting": "^3.6.0",
|
|
33
|
+
"@quenty/servicebag": "^3.5.0",
|
|
34
34
|
"@quenty/string": "^2.2.1",
|
|
35
|
-
"@quenty/templateprovider": "^3.
|
|
35
|
+
"@quenty/templateprovider": "^3.8.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@quentystudios/cmdr": "^1.8.4-quenty.1"
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "c094ba8f4e128cdff08919d89de226d3d65247ce"
|
|
44
44
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
--[=[
|
|
2
|
-
Loads cmdr on the client
|
|
2
|
+
Loads cmdr on the client. See [CmdrService] for the server equivalent.
|
|
3
|
+
|
|
4
|
+
@client
|
|
3
5
|
@class CmdrServiceClient
|
|
4
6
|
]=]
|
|
5
7
|
|
|
@@ -13,9 +15,14 @@ local PromiseUtils = require("PromiseUtils")
|
|
|
13
15
|
local PermissionServiceClient = require("PermissionServiceClient")
|
|
14
16
|
local Maid = require("Maid")
|
|
15
17
|
local String = require("String")
|
|
18
|
+
local Promise = require("Promise")
|
|
16
19
|
|
|
17
20
|
local CmdrServiceClient = {}
|
|
18
21
|
|
|
22
|
+
--[=[
|
|
23
|
+
Starts the cmdr service on the client. Should be done via [ServiceBag].
|
|
24
|
+
@param serviceBag ServiceBag
|
|
25
|
+
]=]
|
|
19
26
|
function CmdrServiceClient:Init(serviceBag)
|
|
20
27
|
assert(not self._serviceBag, "Already initialized")
|
|
21
28
|
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
@@ -24,6 +31,9 @@ function CmdrServiceClient:Init(serviceBag)
|
|
|
24
31
|
self._permissionService = serviceBag:GetService(PermissionServiceClient)
|
|
25
32
|
end
|
|
26
33
|
|
|
34
|
+
--[=[
|
|
35
|
+
Starts the service. Should be done via [ServiceBag].
|
|
36
|
+
]=]
|
|
27
37
|
function CmdrServiceClient:Start()
|
|
28
38
|
assert(self._serviceBag, "Not initialized")
|
|
29
39
|
|
|
@@ -58,6 +68,10 @@ function CmdrServiceClient:_setBindings(cmdr)
|
|
|
58
68
|
cmdr.Dispatcher:Run("bind", Enum.KeyCode.G.Name, "blink")
|
|
59
69
|
end
|
|
60
70
|
|
|
71
|
+
--[=[
|
|
72
|
+
Retrieves the cmdr for the client.
|
|
73
|
+
@return Promise<CmdrClient>
|
|
74
|
+
]=]
|
|
61
75
|
function CmdrServiceClient:PromiseCmdr()
|
|
62
76
|
assert(self._serviceBag, "Not initialized")
|
|
63
77
|
|
|
@@ -67,7 +81,10 @@ function CmdrServiceClient:PromiseCmdr()
|
|
|
67
81
|
|
|
68
82
|
self._cmdrPromise = promiseChild(ReplicatedStorage, "CmdrClient")
|
|
69
83
|
:Then(function(cmdClient)
|
|
70
|
-
return
|
|
84
|
+
return Promise.spawn(function(resolve, _reject)
|
|
85
|
+
-- Requiring cmdr can yield
|
|
86
|
+
return resolve(require(cmdClient))
|
|
87
|
+
end)
|
|
71
88
|
end)
|
|
72
89
|
|
|
73
90
|
return self._cmdrPromise
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Bridge to https://eryn.io/Cmdr/
|
|
3
3
|
|
|
4
4
|
Uses [PermissionService] to provide permissions.
|
|
5
|
+
@server
|
|
5
6
|
@class CmdrService
|
|
6
7
|
]=]
|
|
7
8
|
|
|
@@ -116,23 +117,35 @@ function CmdrService:RegisterCommand(commandData, execute)
|
|
|
116
117
|
self._cmdr.Registry:RegisterCommand(commandScript, commandServerScript)
|
|
117
118
|
end
|
|
118
119
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
--[=[
|
|
121
|
+
Private function used by the execution template to retrieve the execution function.
|
|
122
|
+
@param cmdrCommandId string
|
|
123
|
+
@param ... any
|
|
124
|
+
@private
|
|
125
|
+
]=]
|
|
126
|
+
function CmdrService:__executeCommand(cmdrCommandId, ...)
|
|
127
|
+
assert(type(cmdrCommandId) == "string", "Bad cmdrCommandId")
|
|
128
|
+
assert(self._cmdr, "CmdrService is not initialized yet")
|
|
122
129
|
|
|
123
|
-
local execute = self._executeData[
|
|
130
|
+
local execute = self._executeData[cmdrCommandId]
|
|
124
131
|
if not execute then
|
|
125
|
-
error(("[CmdrService] - No command definition for
|
|
132
|
+
error(("[CmdrService] - No command definition for cmdrCommandId %q"):format(tostring(cmdrCommandId)))
|
|
126
133
|
end
|
|
127
134
|
|
|
128
135
|
return execute(...)
|
|
129
136
|
end
|
|
130
137
|
|
|
131
|
-
--
|
|
132
|
-
|
|
133
|
-
|
|
138
|
+
--[=[
|
|
139
|
+
Global usage but only intended for internal use
|
|
140
|
+
|
|
141
|
+
@param cmdrServiceId string
|
|
142
|
+
@return CmdrService
|
|
143
|
+
@private
|
|
144
|
+
]=]
|
|
145
|
+
function CmdrService:__getServiceFromId(cmdrServiceId)
|
|
146
|
+
assert(type(cmdrServiceId) == "string", "Bad cmdrServiceId")
|
|
134
147
|
|
|
135
|
-
return GLOBAL_REGISTRY[
|
|
148
|
+
return GLOBAL_REGISTRY[cmdrServiceId]
|
|
136
149
|
end
|
|
137
150
|
|
|
138
151
|
return CmdrService
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
--[=[
|
|
2
|
-
Generic command definition template
|
|
2
|
+
Generic command definition template which we can use to
|
|
3
3
|
@class CmdrCommandDefinitionTemplate
|
|
4
4
|
]=]
|
|
5
5
|
|
|
@@ -15,8 +15,8 @@ end
|
|
|
15
15
|
local cmdrServiceId = waitForValue(script:WaitForChild("CmdrServiceId"))
|
|
16
16
|
local cmdrCommandId = waitForValue(script:WaitForChild("CmdrCommandId"))
|
|
17
17
|
local commandServiceDefinition = require(waitForValue(script:WaitForChild("CmdrServiceTarget")))
|
|
18
|
-
local cmdrService = commandServiceDefinition:
|
|
18
|
+
local cmdrService = commandServiceDefinition:__getServiceFromId(cmdrServiceId)
|
|
19
19
|
|
|
20
20
|
return function(...)
|
|
21
|
-
return cmdrService:
|
|
21
|
+
return cmdrService:__executeCommand(cmdrCommandId, ...)
|
|
22
22
|
end
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
--
|
|
2
|
-
|
|
1
|
+
--[[
|
|
2
|
+
@class ServerMain
|
|
3
|
+
]]
|
|
3
4
|
|
|
4
5
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
|
5
6
|
local ServerScriptService = game:GetService("ServerScriptService")
|
|
@@ -24,8 +25,8 @@ serviceBag:GetService(require(serverFolder.CmdrService)):RegisterCommand({
|
|
|
24
25
|
Group = "Admin";
|
|
25
26
|
Args = {
|
|
26
27
|
{
|
|
28
|
+
Name = "Players";
|
|
27
29
|
Type = "players";
|
|
28
|
-
Name = "players";
|
|
29
30
|
Description = "Victims";
|
|
30
31
|
},
|
|
31
32
|
};
|