fix:fix typo
This commit is contained in:
+4
-4
@@ -116,7 +116,7 @@ module.exports = {
|
|||||||
*/
|
*/
|
||||||
emplaceListener: function (eventName, callback, priority = this.EventPriority.Normal, pluginName = getPluginName()) {
|
emplaceListener: function (eventName, callback, priority = this.EventPriority.Normal, pluginName = getPluginName()) {
|
||||||
if (typeof callback !== "function") throw new Error("callback must be a function!");
|
if (typeof callback !== "function") throw new Error("callback must be a function!");
|
||||||
const /** @type {number} */ eventId = ll.importss("GMLIB_Event_API", "emplaceListener")(pluginName, eventName, priority);
|
const /** @type {number} */ eventId = ll.imports("GMLIB_Event_API", "emplaceListener")(pluginName, eventName, priority);
|
||||||
if (eventId === -1) throw new Error(`Event ${eventName} creation failed!`);
|
if (eventId === -1) throw new Error(`Event ${eventName} creation failed!`);
|
||||||
ll.exports((...data) => {
|
ll.exports((...data) => {
|
||||||
let /** @type {boolean} */ result = typeof (data.slice(-1)[0]) === "boolean" ? data.pop() : false;
|
let /** @type {boolean} */ result = typeof (data.slice(-1)[0]) === "boolean" ? data.pop() : false;
|
||||||
@@ -146,7 +146,7 @@ module.exports = {
|
|||||||
* @param {boolean}
|
* @param {boolean}
|
||||||
*/
|
*/
|
||||||
removeListener: function (eventId) {
|
removeListener: function (eventId) {
|
||||||
const result = ll.importss("GMLIB_Event_API", "removeListener")(eventId);
|
const result = ll.imports("GMLIB_Event_API", "removeListener")(eventId);
|
||||||
if (result) {
|
if (result) {
|
||||||
for (let [eventName, eventIds] of Object.entries(this.mEventData)) {
|
for (let [eventName, eventIds] of Object.entries(this.mEventData)) {
|
||||||
this.mEventData[eventName] = eventIds.filter(id => id !== eventId);
|
this.mEventData[eventName] = eventIds.filter(id => id !== eventId);
|
||||||
@@ -162,7 +162,7 @@ module.exports = {
|
|||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
hasListener: function (eventId) {
|
hasListener: function (eventId) {
|
||||||
return ll.importss("GMLIB_Event_API", "hasListener")(eventId);
|
return ll.imports("GMLIB_Event_API", "hasListener")(eventId);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -171,7 +171,7 @@ module.exports = {
|
|||||||
* @returns {number?}
|
* @returns {number?}
|
||||||
*/
|
*/
|
||||||
getListenerPriority: function (eventId) {
|
getListenerPriority: function (eventId) {
|
||||||
const priority = ll.importss("GMLIB_Event_API", "getListenerPriority")(eventId);
|
const priority = ll.imports("GMLIB_Event_API", "getListenerPriority")(eventId);
|
||||||
return priority === -1 ? undefined : priority;
|
return priority === -1 ? undefined : priority;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ const getPluginName = () => {
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
translate(value, actor = undefined, language = "") {
|
translate(value, actor = undefined, language = "") {
|
||||||
return actor instanceof LLSE_Entity
|
return actor instanceof LLSE_Entity
|
||||||
? ll.importss("PlaceholderAPI", "translateFromActor")(value, actor, language)
|
? ll.imports("PlaceholderAPI", "translateFromActor")(value, actor, language)
|
||||||
: ll.importss("PlaceholderAPI", "translate")(value, language);
|
: ll.imports("PlaceholderAPI", "translate")(value, language);
|
||||||
},
|
},
|
||||||
registerPlaceholder(placeholder, callback) {
|
registerPlaceholder(placeholder, callback) {
|
||||||
const pluginName = getPluginName();
|
const pluginName = getPluginName();
|
||||||
@@ -59,19 +59,19 @@ module.exports = {
|
|||||||
if(!args[0].uniqueId) args[0] = undefined;
|
if(!args[0].uniqueId) args[0] = undefined;
|
||||||
return callback(...args) ?? "<std::nullopt>";
|
return callback(...args) ?? "<std::nullopt>";
|
||||||
}, pluginName, `Placeholder_${placeholder}`);
|
}, pluginName, `Placeholder_${placeholder}`);
|
||||||
ll.importss("PlaceholderAPI", "registerPlaceholder")(placeholder, `Placeholder_${placeholder}`, pluginName);
|
ll.imports("PlaceholderAPI", "registerPlaceholder")(placeholder, `Placeholder_${placeholder}`, pluginName);
|
||||||
},
|
},
|
||||||
unregisterPlaceholder(placeholder) {
|
unregisterPlaceholder(placeholder) {
|
||||||
return ll.importss("PlaceholderAPI", "unregisterPlaceholder")(placeholder);
|
return ll.imports("PlaceholderAPI", "unregisterPlaceholder")(placeholder);
|
||||||
},
|
},
|
||||||
unregisterPlaceholderFromModName(placeholder) {
|
unregisterPlaceholderFromModName(placeholder) {
|
||||||
return ll.importss("PlaceholderAPI", "unregisterPlaceholderFromModName")(placeholder);
|
return ll.imports("PlaceholderAPI", "unregisterPlaceholderFromModName")(placeholder);
|
||||||
},
|
},
|
||||||
getValue(placeholder, actor = undefined, params = {}, language = "") {
|
getValue(placeholder, actor = undefined, params = {}, language = "") {
|
||||||
if (actor instanceof LLSE_Player) actor = ll.imports("GMLib_ServerAPI", "PlayerToEntity")(actor);
|
if (actor instanceof LLSE_Player) actor = ll.imports("GMLib_ServerAPI", "PlayerToEntity")(actor);
|
||||||
const result = actor instanceof LLSE_Entity
|
const result = actor instanceof LLSE_Entity
|
||||||
? ll.importss("PlaceholderAPI", "getValueFromActor")(placeholder, actor, params, language)
|
? ll.imports("PlaceholderAPI", "getValueFromActor")(placeholder, actor, params, language)
|
||||||
: ll.importss("PlaceholderAPI", "getValue")(placeholder, params, language);
|
: ll.imports("PlaceholderAPI", "getValue")(placeholder, params, language);
|
||||||
return result !== "<std::nullopt>" ? result : undefined;
|
return result !== "<std::nullopt>" ? result : undefined;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user