MCServer
Link to mcserver
Импорт класса
Link to импорт-класса
It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.
ZenScript Copyimport crafttweaker.api.server.MCServer;
Implemented Interfaces
Link to implemented-interfaces
MCServer implements the following interfaces. That means all methods defined in these interfaces are also available in MCServer
- AutoCloseable
Методы
Link to методы
Name: executeCommand
Runs a command, if silent is true, the output is hidden.
Returns The success value of the command, or 0 if an exception occurred.
Note: Some commands' success value is 0
Return Type: int
ZenScript Copy// MCServer.executeCommand(command as string, silent as boolean) as int
world.asServerWorld().server.executeCommand("time set day", true);
Параметр | Тип | Описание | Optional | DefaultValue |
---|---|---|---|---|
Параметр command | Тип string | Описание No Description Provided | Optional false | DefaultValue |
Параметр silent | Тип boolean | Описание No Description Provided | Optional true | DefaultValue false |
Name: executeCommand
let a player send a command, if silent is true, the output is hidden.
Returns The success value of the command, or 0 if an exception occurred.
Note: Some commands' success value is 0
Return Type: int
ZenScript Copy// MCServer.executeCommand(command as string, player as MCPlayerEntity, silent as boolean) as int
world.asServerWorld().server.executeCommand("time set day", player, true);
Параметр | Тип | Описание | Optional | DefaultValue |
---|---|---|---|---|
Параметр command | Тип string | Описание No Description Provided | Optional false | DefaultValue |
Параметр player | Тип MCPlayerEntity | Описание No Description Provided | Optional false | DefaultValue |
Параметр silent | Тип boolean | Описание No Description Provided | Optional true | DefaultValue false |
Name: getWorld
Get a server world instance based on resource location Throws an exception if the world location is unknown
Return Type: MCServerWorld
ZenScript Copy// MCServer.getWorld(location as MCResourceLocation) as MCServerWorld
world.asServerWorld().server.getWorld(<resource:minecraft:the_end>);
Параметр | Тип | Описание |
---|---|---|
Параметр местоположение | Тип Расположение MCResource-ресурсов | Описание No Description Provided |
Свойства
Link to свойства
Название | Тип | Имеет Getter | Имеет Setter | Описание |
---|---|---|---|---|
Название worlds | Тип Collection<MCServerWorld> | Имеет Getter true | Имеет Setter false | Описание No Description Provided |