1新增 2修复
- 新增getEntityOwnerUniqueId接口 - 修复注册PAPI变量无法使用匿名函数 - 修复注册相同PAPI名字无法重载
This commit is contained in:
@@ -19,14 +19,25 @@ const PlaceholderAPI = {
|
||||
getAllPAPI: ll.import("BEPlaceholderAPI", "getAllPAPI")
|
||||
}
|
||||
|
||||
Function.prototype.getName =
|
||||
/**
|
||||
* 获取函数名字
|
||||
* @returns {string}
|
||||
*/
|
||||
function () {
|
||||
return this.name || this.toString().match(/function\s*([^(]*)\(/)[1] || Math.ceil(Math.random() * 1000000).toString(16);
|
||||
}
|
||||
Function.prototype.getName =
|
||||
/**
|
||||
* 获取函数名字
|
||||
* @returns {string}
|
||||
*/
|
||||
function () {
|
||||
return this.name || this.toString().match(/function\s*([^(]*)\(/)?.[1] || this.toString().hashCode().toString(16);
|
||||
}
|
||||
|
||||
String.prototype.hashCode = function () {
|
||||
var hash = 0, i, chr;
|
||||
if (this.length === 0) return hash;
|
||||
for (i = 0; i < this.length; i++) {
|
||||
chr = this.charCodeAt(i);
|
||||
hash = ((hash << 5) - hash) + chr;
|
||||
hash |= 0;
|
||||
}
|
||||
return hash;
|
||||
};
|
||||
|
||||
/** PAPI变量类 */
|
||||
class PAPI {
|
||||
@@ -79,7 +90,7 @@ class PAPI {
|
||||
static getValue(key) {
|
||||
return PlaceholderAPI.getValueAPI(key);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取一个玩家变量的值
|
||||
* @param {string} key PAPI变量名
|
||||
|
||||
Reference in New Issue
Block a user