Skip to content
This repository was archived by the owner on Jul 19, 2026. It is now read-only.

Commit 7fdc994

Browse files
committed
docs(api): player.getName().name
1 parent 382035e commit 7fdc994

6 files changed

Lines changed: 15 additions & 15 deletions

File tree

docs/es-ES/essentials/events.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ import { Player, PlayerEvent } from "@infernus/core";
179179
PlayerEvent.onConnect(({ player, next }) => {
180180
const players = Player.getInstances(); // Obtener un arreglo de todas las instancias de jugador
181181
players.forEach((p) => {
182-
p.sendClientMessage("#fff", `jugador ${player.getName()} conectado`);
182+
p.sendClientMessage("#fff", `jugador ${player.getName().name} conectado`);
183183
});
184184

185185
const player = Player.getInstance(0); // Obtener la instancia de un jugador cuyo id es 0
@@ -206,22 +206,22 @@ import { Player, PlayerEvent } from "@infernus/core";
206206

207207
// Definir un comando de primer nivel
208208
PlayerEvent.onCommandText("ayuda", ({ player, next }) => {
209-
console.log(`jugador ${player.getName()}, hola`);
209+
console.log(`jugador ${player.getName().name}, hola`);
210210
return next();
211211
});
212212

213213
// Definir un comando de segundo nivel
214214
PlayerEvent.onCommandText("ayuda teletransporte", ({ player, next }) => {
215215
console.log(
216-
`jugador ${player.getName()} desea obtener información de ayuda relacionada con la teletransportación`,
216+
`jugador ${player.getName().name} desea obtener información de ayuda relacionada con la teletransportación`,
217217
);
218218
return next();
219219
});
220220

221221
// Definir un comando que puede ser activado por /msg o /message
222222
PlayerEvent.onCommandText(["msg", "mensaje"], ({ player, subcommand, next }) => {
223223
console.log(
224-
`el jugador ${player.getName()} introdujo este comando, y también puede haber introducido un subcomando ${subcommand.toString()}`,
224+
`el jugador ${player.getName().name} introdujo este comando, y también puede haber introducido un subcomando ${subcommand.toString()}`,
225225
);
226226

227227
// Equivale a que el jugador introduzca /message global o /msg global

docs/es-ES/essentials/features.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Esto significa que debes usar la librería `JavaScript`, y que ya no necesitas n
1313

1414
## Obtener cadena de texto
1515

16-
Para la mayoría de las búsquedas de cadenas, ya no es necesario definir un arreglo de longitud fija como hacen los desarrolladores nativos. Las funciones más utilizadas se han tratado internamente en `Infernus`. El principio es que se define un array de cadenas con una longitud máxima, y entonces el array se itera automáticamente hasta el punto donde el primer byte es `0` para interceptar la cadena, como `GetPlayerName`, que es `player.getName()`.
16+
Para la mayoría de las búsquedas de cadenas, ya no es necesario definir un arreglo de longitud fija como hacen los desarrolladores nativos. Las funciones más utilizadas se han tratado internamente en `Infernus`. El principio es que se define un array de cadenas con una longitud máxima, y entonces el array se itera automáticamente hasta el punto donde el primer byte es `0` para interceptar la cadena, como `GetPlayerName`, que es `player.getName().name`.
1717

1818
El método de intercepción proviene de las [funciones prácticas](./i18n.md#practical-functions) en internacionalización. Si te encuentras con algunos escenarios similares, no tienes que repetir la rueda.
1919

docs/essentials/events.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ import { Player, PlayerEvent } from "@infernus/core";
179179
PlayerEvent.onConnect(({ player, next }) => {
180180
const players = Player.getInstances(); // Get an array of all player instances
181181
players.forEach((p) => {
182-
p.sendClientMessage("#fff", `player ${player.getName()} connected`);
182+
p.sendClientMessage("#fff", `player ${player.getName().name} connected`);
183183
});
184184

185185
const player = Player.getInstance(0); // Get the instance of a player whose id is 0
@@ -206,20 +206,20 @@ import { Player, PlayerEvent } from "@infernus/core";
206206

207207
// Define a first-level command
208208
PlayerEvent.onCommandText("help", ({ player, next }) => {
209-
console.log(`player ${player.getName()}, hello`);
209+
console.log(`player ${player.getName().name}, hello`);
210210
return next();
211211
});
212212

213213
// Define a second-level command
214214
PlayerEvent.onCommandText("help teleport", ({ player, next }) => {
215-
console.log(`player ${player.getName()} want to get help information related to teleport`);
215+
console.log(`player ${player.getName().name} want to get help information related to teleport`);
216216
return next();
217217
});
218218

219219
// Define a command that can be triggered by /msg or /message
220220
PlayerEvent.onCommandText(["msg", "message"], ({ player, subcommand, next }) => {
221221
console.log(
222-
`player ${player.getName()} entered this command, and may also have entered a subcommand ${subcommand.toString()}`,
222+
`player ${player.getName().name} entered this command, and may also have entered a subcommand ${subcommand.toString()}`,
223223
);
224224

225225
// It is equivalent to the player entering / message global or / msg global

docs/essentials/features.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This means that you should use the `JavaScript` library, and you no longer need
1313

1414
## Get string
1515

16-
For most string fetches, you no longer need to define a fixed-length array as native developers do. The commonly used functions have been dealt with internally in `Infernus`. The principle is that an array of strings with maximum length is defined, and then the array is automatically iterated to the point where the first byte is `0` to intercept the string, such as `GetPlayerName`, that is `player.getName()`.
16+
For most string fetches, you no longer need to define a fixed-length array as native developers do. The commonly used functions have been dealt with internally in `Infernus`. The principle is that an array of strings with maximum length is defined, and then the array is automatically iterated to the point where the first byte is `0` to intercept the string, such as `GetPlayerName`, that is `player.getName().name`.
1717

1818
The method of interception comes from the [practical functions](./i18n.md#practical-functions) in internationalization. If you encounter some similar scenarios, you do not have to repeat the wheel.
1919

docs/zh-Hans/essentials/events.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ import { Player, PlayerEvent } from "@infernus/core";
176176
PlayerEvent.onConnect(({ player, next }) => {
177177
const players = Player.getInstances(); // 获取所有玩家实例数组
178178
players.forEach((p) => {
179-
p.sendClientMessage("#fff", `玩家${player.getName()}连接了游戏`);
179+
p.sendClientMessage("#fff", `玩家${player.getName().name}连接了游戏`);
180180
});
181181

182182
const player = Player.getInstance(0); // 获取玩家id为0的玩家实例
@@ -203,20 +203,20 @@ import { Player, PlayerEvent } from "@infernus/core";
203203

204204
// 定义一个一级命令
205205
PlayerEvent.onCommandText("help", ({ player, next }) => {
206-
console.log(`玩家 ${player.getName()},您好`);
206+
console.log(`玩家 ${player.getName().name},您好`);
207207
return next();
208208
});
209209

210210
// 定义一个二级命令
211211
PlayerEvent.onCommandText("help teleport", ({ player, next }) => {
212-
console.log(`玩家 ${player.getName()}想得到传送相关的帮助信息`);
212+
console.log(`玩家 ${player.getName().name}想得到传送相关的帮助信息`);
213213
return next();
214214
});
215215

216216
// 定义一个命令,可以由msg或message触发
217217
PlayerEvent.onCommandText(["msg", "message"], ({ player, subcommand, next }) => {
218218
console.log(
219-
`玩家 ${player.getName()},输入了此命令,并且可能还输入了子命令 ${subcommand.toString()}`,
219+
`玩家 ${player.getName().name},输入了此命令,并且可能还输入了子命令 ${subcommand.toString()}`,
220220
);
221221

222222
// 相当于玩家输入了/message global或/msg global

docs/zh-Hans/essentials/features.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
## 字符串获取
1515

16-
对于大部分字符串获取,您不再需要像原生开发那样定义一个固定长度的数组。 `Infernus` 内部已经对常用的函数进行了处理,原理是定义了一个最大长度的字符串数组,然后自动迭代数组到第一个字节为 `0` 的点截取为字符串,比如 `GetPlayerName`,即 `player.getName()`
16+
对于大部分字符串获取,您不再需要像原生开发那样定义一个固定长度的数组。 `Infernus` 内部已经对常用的函数进行了处理,原理是定义了一个最大长度的字符串数组,然后自动迭代数组到第一个字节为 `0` 的点截取为字符串,比如 `GetPlayerName`,即 `player.getName().name`
1717

1818
截取的方法来自国际化中的[实用函数](./i18n.md#实用函数),如果您遇到一些场景类似的您不必再重复造轮子。
1919

0 commit comments

Comments
 (0)