fix: fix the papi batch export error

This commit is contained in:
zimuya4153
2025-06-22 21:03:37 +08:00
Unverified
parent bac05d765e
commit 7fc855ffc9
2 changed files with 8 additions and 58 deletions
+2 -27
View File
@@ -47,31 +47,6 @@ const getPluginName = () => {
return "Unknown";
};
Function.prototype.getName =
/**
* 获取函数名字
* @returns {string}
*/
function () {
return this.name || this.toString().match(/function\s*([^(]*)\(/)?.[1] || getStringHashCode(this.toString()).toString(16);
};
/**
* 获取字符串哈希值
* @param {string} str 字符串
* @returns {number}
*/
function getStringHashCode(str) {
let hash = 0, chr;
if (str.length === 0) return hash;
for (let i = 0; i < str.length; i++) {
chr = str.charCodeAt(i);
hash = ((hash << 5) - hash) + chr;
hash |= 0;
}
return hash;
}
module.exports = {
translate(value, actor = undefined, language = "") {
return actor instanceof LLSE_Entity
@@ -83,8 +58,8 @@ module.exports = {
ll.exports((...args) => {
if(!args[0].uniqueId) args[0] = undefined;
return callback(...args) ?? "<std::nullopt>";
}, pluginName, callback.getName());
ll.importss("PlaceholderAPI", "registerPlaceholder")(placeholder, callback.getName(), pluginName);
}, pluginName, `Placeholder_${placeholder}`);
ll.importss("PlaceholderAPI", "registerPlaceholder")(placeholder, `Placeholder_${placeholder}`, pluginName);
},
unregisterPlaceholder(placeholder) {
return ll.importss("PlaceholderAPI", "unregisterPlaceholder")(placeholder);