feat: add setMaxPlayers api

This commit is contained in:
zimuya4153
2025-08-17 17:08:43 +08:00
Unverified
parent 2b18aeb245
commit 446cc68f32
3 changed files with 25 additions and 1 deletions
+11
View File
@@ -280,6 +280,8 @@ const GMLIB_API = {
getEnchantTypeNameFromId: ll.imports("GMLIB_API", "getEnchantTypeNameFromId"),
/** 获取最大玩家数 @type {function():number} */
getMaxPlayers: ll.imports("GMLib_ServerAPI", "getMaxPlayers"),
/** 获取最大玩家数 @type {function(number,boolean):void} */
setMaxPlayers: ll.imports("GMLib_ServerAPI", "setMaxPlayers"),
/** 丢出玩家背包内物品 @type {function(Player,Item,boolean):boolean} */
dropPlayerItem: ll.imports("GMLIB_API", "dropPlayerItem"),
/** 获取玩家的RuntimeId @type {function(Player):number} */
@@ -1113,6 +1115,15 @@ class Minecraft {
return GMLIB_API.getMaxPlayers();
}
/**
* 设置最大玩家数量
* @param {number} count 最大玩家数量
* @param {boolean} [ignoreVanillaLimit=false] 是否忽略原版限制
*/
static setMaxPlayers(count, ignoreVanillaLimit = false) {
return GMLIB_API.setMaxPlayers(count, ignoreVanillaLimit);
}
/**
* 玩家是否拥有NBT
* @param {string} uuid 玩家的uuid