Импорт класса

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
Copy
import 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

Name: executeCommand

Runs a command.

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) as int

world.asServerWorld().server.executeCommand("time set day");
ПараметрТипОписание
Параметр
command
Тип
string
Описание
No Description Provided

Name: executeCommand

let a player send a command

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) as int

world.asServerWorld().server.executeCommand("time set day", player);
ПараметрТипОписание
Параметр
command
Тип
string
Описание
No Description Provided
Параметр
player
Тип
MCPlayerEntity
Описание
No Description Provided

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