MCServer

Importing the class

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

MCServer implements the following interfaces. That means all methods defined in these interfaces are also available in MCServer

  • AutoCloseable

Methods

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
ParameterTypeDescription
commandstringNo Description Provided
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
ParameterTypeDescription
commandstringNo Description Provided
playerMCPlayerEntityNo Description Provided
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

myMCServer.getWorld(<resource:minecraft:the_end>);
ParameterTypeDescription
ubicaciónUbicación MCResourceNo Description Provided

Properties

NombreTypeHas GetterHas SetterDescription
worldsCollection<MCServerWorld>truefalseNo Description Provided