Skip to content

GameManager API command

XiaoColorful edited this page Apr 18, 2026 · 5 revisions

English

游戏管理器

IGameManager

/battleroyale api gameManager [...]

游戏信息获取

IGameInfoGetter

游戏时间

/battleroyale api gameManager getGameTime

  • 返回值:当前游戏时间,单位 tick
是否在游戏中

/battleroyale api gameManager isInGame

  • 返回值:当前是否在游戏中
全局偏移

/battleroyale api gameManager getGlobalCenterOffset [resourceLocation] [storagePath]

全局偏移存入指定命令存储

  • resourceLocation:标识符
  • storagePath:NBT路径
  • 返回值:1
最大游戏时长

/battleroyale api gameManager getMaxGameTime

获胜队伍总数

/battleroyale api gameManager getWinnerTeamTotal

最少队伍数量

_/battleroyale api gameManager _

是否有队伍获胜

/battleroyale api gameManager hasWinner

  • 返回值:当前状态是否有队伍获胜
剩余自动重开游戏次数

/battleroyale api gameManager getRemainRestartTime

游戏功能

IGameFunc

发送观战消息

/battleroyale api gameManager sendGameSpectateMessage [player]

结算游戏

/battleroyale api gameManager finishGame [hasWinner]

强制结算并停止游戏:

  • hasWinner:是否按获胜条件添加获胜玩家及获胜队伍
  • 返回值:1
增加游戏时间并处理

/battleroyale api gameManager addGameTimeAndTick

强制增加 1 tick 游戏时间并处理

  • 返回值:1

游戏状态设置

IGameStatusSetter

添加死亡事件后结算检查

/battleroyale api gameManager addFinishCheckAfterDeathEvent

若当前正在游戏玩家死亡事件(IGameMangaer::onPlayerDeath)中,则在事件结束后添加游戏胜利条件检查:

  • 返回值:是否成功添加检查
设置是否有获胜队伍

/battleroyale api gameManager setHasWinner [hasWinner]

  • 返回值:是否成功设置
清空获胜游戏玩家

/battleroyale api gameManager clearWinnerGamePlayers

  • 返回值:是否成功清空
清空获胜游戏队伍

/battleroyale api gameManager clearWinnerGameTeams

  • 返回值:是否成功清空
添加获胜游戏玩家

/battleroyale api gameManager addWinnerGamePlayer byPlayer [player] [withMembers] [withTeam]

/battleroyale api gameManager addWinnerGamePlayer byId [id] [withMembers] [withTeam]

  • player:用实体选择器选中并获取游戏玩家
  • id:用游戏玩家ID选中游戏玩家
  • 若不存在对应的游戏玩家,返回值为 0
  • withMembers:是否将游戏玩家队伍成员一并加入获胜游戏玩家
  • withTeam:是否将游戏玩家所在游戏队伍加入获胜游戏队伍
  • 返回值:成功添加的游戏玩家数量
添加获胜游戏队伍

/battleroyale api gameManager addWinnerGameTeam byPlayer [player] [withMembers]

/battleroyale api gameManager addWinnerGameTeam byId [id] [withMembers]

  • player:用实体选择器选中并获取游戏玩家
  • id:用游戏队伍ID选中游戏队伍
  • 若不存在对应的游戏玩家或游戏队伍,返回值为0
  • withMembers:是否将游戏队伍成员一并加入获胜游戏玩家
  • 返回值:成功添加的游戏队伍数量和游戏玩家数量
设置剩余自动重开游戏次数

/battleroyale api gameManager setRemainRestartTime [time]

游戏配置获取

IGameConfigGetter

获取选中的游戏规则配置ID

/battleroyale api gameManager getGameruleConfigId

获取选中的出生配置ID

/battleroyale api gameManager getSpawnConfigId

获取选中的统计数据配置ID

/battleroyale api gameManager getStatsConfigId

获取选中的人机配置ID

/battleroyale api gameManager getBotConfigId

游戏安全传送

IGameSaveTeleporter

无摔传送

/battleroyale api gameManager safeTeleport [player] [xyz]

  • player:用实体选择器选中实体
  • 若不为生物,返回值为 0
  • xyz:传送坐标
  • 返回值:1
跨纬度无摔传送

/battleroyale api gameManager safeTeleport [player] [xyz] [rotation]

  • player:用实体选择器选中实体
  • 若不为生物,返回值为 0
  • xyz:传送坐标
  • rotation:传送朝向(水平朝向和垂直朝向)
  • 若无法获取游戏维度,返回值为 -1
  • 返回值:1

English

Game manager

IGameManager

/battleroyale api gameManager [...]

Game info getter

IGameInfoGetter

Game time

/battleroyale api gameManager getGameTime

  • return value: current game time in ticks
Is in game

/battleroyale api gameManager isInGame

  • return value: whether the game is currently in progress
Global offset

/battleroyale api gameManager getGlobalCenterOffset [resourceLocation] [storagePath]

Saves the Global offset to the specified command storage:

  • resourceLocation: identifier
  • storagePath: NBT path
  • return value: 1
Maximum game time

/battleroyale api gameManager getMaxGameTime

Winner team total

/battleroyale api gameManager getWinnerTeamTotal

Required team to start

_/battleroyale api gameManager _

Has winner

/battleroyale api gameManager hasWinner

  • return value: whether there is currently any winning team
Remaining automatic restart rounds

/battleroyale api gameManager getRemainRestartTime

Game functions

IGameFunc

Send spectate message

/battleroyale api gameManager sendGameSpectateMessage [player]

Finish game

/battleroyale api gameManager finishGame [hasWinner]

Forcefully finishes and stops the game:

  • hasWinner: whether to add winning players and teams based on winning conditions
  • return value: 1
Add game time and tick

/battleroyale api gameManager addGameTimeAndTick

Forcefully increases game time by 1 tick and processes it:

  • return value: 1

Game status setter

IGameStatusSetter

Add finish check after death event

/battleroyale api gameManager addFinishCheckAfterDeathEvent

If currently within a game player death event (IGameMangaer::onPlayerDeath), adds a victory condition check after the event ends:

  • return value: whether the check was successfully added
Set hasWinner

/battleroyale api gameManager setHasWinner [hasWinner]

  • return value: whether the status was successfully set
Clear winner game players

/battleroyale api gameManager clearWinnerGamePlayers

  • return value: whether the set was successfully cleared
Clear winner game teams

/battleroyale api gameManager clearWinnerGameTeams

  • return value: whether the set was successfully cleared
Add winner game player

/battleroyale api gameManager addWinnerGamePlayer byPlayer [player] [withMembers] [withTeam]

/battleroyale api gameManager addWinnerGamePlayer byId [id] [withMembers] [withTeam]

  • player: selects game player using an entity selector
  • id: selects game player using a game player ID
  • If the game player does not exist, the return value is 0.
  • withMembers: whether to add game player's all team members to the winner game players
  • withTeam: whether to add the player's game team to the winner game teams
  • return value: number of successfully added game players
Add winner game team

/battleroyale api gameManager addWinnerGameTeam byPlayer [player] [withMembers]

/battleroyale api gameManager addWinnerGameTeam byId [id] [withMembers]

  • player: selects game player using an entity selector
  • id: selects game team using a game team ID
  • If the game player or team does not exist, the return value is 0.
  • withMembers: whether to add all game team members to the winner game players
  • return value: number of successfully added game teams and players
Set remain restart time

/battleroyale api gameManager setRemainRestartTime [time]

Game config getter

IGameConfigGetter

Get Gamerule config ID

/battleroyale api gameManager getGameruleConfigId

Get Spawn config ID

/battleroyale api gameManager getSpawnConfigId

Get Stats config ID

/battleroyale api gameManager getStatsConfigId

Get Bot config ID

/battleroyale api gameManager getBotConfigId

IGameSaveTeleporter

IGameSaveTeleporter

No-fall teleport

/battleroyale api gameManager safeTeleport [player] [xyz]

  • player: selects entity using an entity selector
  • If the enitty is not a living entity, the return value is 0.
  • xyz: teleport coordinate
  • return value: 1
Cross-dimension no-fall teleport

/battleroyale api gameManager safeTeleport [player] [xyz] [rotation]

  • player: selects entity using an entity selector
  • If the enitty is not a living entity, the return value is 0.
  • xyz: teleport coordinate
  • rotation: teleport rotation (yaw and pitch)
  • If the game dimension cannot be retrieved, the return value is -1.
  • return value: 1

🌐 Language / 语言


Clone this wiki locally