Importing the class

Link to 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.game.Server;

Implemented Interfaces

Link to implemented-interfaces

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

Link to g-

Name: areNpcsEnabled

Return Type: boolean

ZenScript
Copy
// Server.areNpcsEnabled() as boolean

myServer.areNpcsEnabled();

Link to g--1

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
// Server.executeCommand(command as string, silent as boolean) as int

myServer.executeCommand("time set day", true);
ParameterTypeDescriptionOptionalDefaultValue
Parameter
command
Type
string
Description
No Description Provided
Optional
false
DefaultValue
Parameter
silent
Type
boolean
Description
No Description Provided
Optional
true
DefaultValue
false

Link to g--2

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
// Server.executeCommand(command as string, player as Player, silent as boolean) as int

myServer.executeCommand("time set day", player, true);
ParameterTypeDescriptionOptionalDefaultValue
Parameter
command
Type
string
Description
No Description Provided
Optional
false
DefaultValue
Parameter
player
Type
Player
Description
No Description Provided
Optional
false
DefaultValue
Parameter
silent
Type
boolean
Description
No Description Provided
Optional
true
DefaultValue
false

Link to g--3

Name: getAbsoluteMaxWorldSize

Return Type: int

ZenScript
Copy
// Server.getAbsoluteMaxWorldSize() as int

myServer.getAbsoluteMaxWorldSize();

Link to g--4

Name: getAllLevels

Return Type: stdlib.Iterable<ServerLevel>

ZenScript
Copy
// Server.getAllLevels() as stdlib.Iterable<ServerLevel>

myServer.getAllLevels();

Link to g--5

Name: getAverageTickTime

Return Type: float

ZenScript
Copy
// Server.getAverageTickTime() as float

myServer.getAverageTickTime();

Link to g--6

Name: getDefaultGameType

Return Type: GameType

ZenScript
Copy
// Server.getDefaultGameType() as GameType

myServer.getDefaultGameType();

Link to g--7

Name: getForcedGameType

Return Type: GameType

ZenScript
Copy
// Server.getForcedGameType() as GameType

myServer.getForcedGameType();

Link to g--8

Name: getLevel

Return Type: ServerLevel

ZenScript
Copy
Server.getLevel(location as ResourceLocation) as ServerLevel
ParameterTypeDescription
Parameter
location
Type
ResourceLocation
Description
No Description Provided

Link to g--9

Name: getMaxPlayers

Return Type: int

ZenScript
Copy
// Server.getMaxPlayers() as int

myServer.getMaxPlayers();

Link to g--10

Name: getModdedStatus

Return Type: invalid

ZenScript
Copy
// Server.getModdedStatus() as invalid

myServer.getModdedStatus();

Name: getMotd

Return Type: string

ZenScript
Copy
// Server.getMotd() as string

myServer.getMotd();

Link to g--12

Name: getOperatorUserPermissionLevel

Return Type: int

ZenScript
Copy
// Server.getOperatorUserPermissionLevel() as int

myServer.getOperatorUserPermissionLevel();

Link to g--13

Name: getPlayerCount

Return Type: int

ZenScript
Copy
// Server.getPlayerCount() as int

myServer.getPlayerCount();

Link to g--14

Name: getPlayerNames

Return Type: string[]

ZenScript
Copy
// Server.getPlayerNames() as string[]

myServer.getPlayerNames();

Link to g--15

Name: getServerModName

Return Type: string

ZenScript
Copy
// Server.getServerModName() as string

myServer.getServerModName();

Link to g--16

Name: getServerVersion

Return Type: string

ZenScript
Copy
// Server.getServerVersion() as string

myServer.getServerVersion();

Link to g--17

Name: getSpawnProtectionRadius

Return Type: int

ZenScript
Copy
// Server.getSpawnProtectionRadius() as int

myServer.getSpawnProtectionRadius();

Link to g--18

Name: getSpawnRadius

Return Type: int

ZenScript
Copy
Server.getSpawnRadius(level as ServerLevel) as int
ParameterTypeDescription
Parameter
level
Type
ServerLevel
Description
No Description Provided

Link to g--19

Name: getTickCount

Return Type: int

ZenScript
Copy
// Server.getTickCount() as int

myServer.getTickCount();

Link to g--20

Name: isCommandBlockEnabled

Return Type: boolean

ZenScript
Copy
// Server.isCommandBlockEnabled() as boolean

myServer.isCommandBlockEnabled();

Link to g--21

Name: isDedicatedServer

Return Type: boolean

ZenScript
Copy
// Server.isDedicatedServer() as boolean

myServer.isDedicatedServer();

Link to g--22

Name: isEnforceWhitelist

Return Type: boolean

ZenScript
Copy
// Server.isEnforceWhitelist() as boolean

myServer.isEnforceWhitelist();

Link to g--23

Name: isFlightAllowed

Return Type: boolean

ZenScript
Copy
// Server.isFlightAllowed() as boolean

myServer.isFlightAllowed();

Link to g--24

Name: isHardcore

Return Type: boolean

ZenScript
Copy
// Server.isHardcore() as boolean

myServer.isHardcore();

Link to g--25

Name: isNetherEnabled

Return Type: boolean

ZenScript
Copy
// Server.isNetherEnabled() as boolean

myServer.isNetherEnabled();

Link to g--26

Name: isPvpAllowed

Return Type: boolean

ZenScript
Copy
// Server.isPvpAllowed() as boolean

myServer.isPvpAllowed();

Name: isReady

Return Type: boolean

ZenScript
Copy
// Server.isReady() as boolean

myServer.isReady();

Link to g--28

Name: isRunning

Return Type: boolean

ZenScript
Copy
// Server.isRunning() as boolean

myServer.isRunning();

Link to g--29

Name: isShutdown

Return Type: boolean

ZenScript
Copy
// Server.isShutdown() as boolean

myServer.isShutdown();

Link to g--30

Name: isSingleplayer

Return Type: boolean

ZenScript
Copy
// Server.isSingleplayer() as boolean

myServer.isSingleplayer();

Link to g--31

Name: isSpawningAnimals

Return Type: boolean

ZenScript
Copy
// Server.isSpawningAnimals() as boolean

myServer.isSpawningAnimals();

Link to g--32

Name: isSpawningMonsters

Return Type: boolean

ZenScript
Copy
// Server.isSpawningMonsters() as boolean

myServer.isSpawningMonsters();

Link to g--33

Name: isStopped

Return Type: boolean

ZenScript
Copy
// Server.isStopped() as boolean

myServer.isStopped();

Link to g--34

Name: isUnderSpawnProtection

Return Type: boolean

ZenScript
Copy
Server.isUnderSpawnProtection(level as ServerLevel, pos as BlockPos, player as Player) as boolean
ParameterTypeDescription
Parameter
level
Type
ServerLevel
Description
No Description Provided
Parameter
pos
Type
BlockPos
Description
No Description Provided
Parameter
player
Type
Player
Description
No Description Provided

Link to g--35

Name: levelKeys

Return Type: stdlib.List<ResourceLocation>

ZenScript
Copy
// Server.levelKeys() as stdlib.List<ResourceLocation>

myServer.levelKeys();

Link to g--36

Name: overworld

Return Type: ServerLevel

ZenScript
Copy
// Server.overworld() as ServerLevel

myServer.overworld();

Link to g--37

Name: setDefaultGameType

Return Type: void

ZenScript
Copy
Server.setDefaultGameType(gameType as GameType) as void
ParameterTypeDescription
Parameter
gameType
Type
GameType
Description
No Description Provided

Link to g--38

Name: setDifficulty

Return Type: void

ZenScript
Copy
Server.setDifficulty(difficulty as Difficulty, force as boolean) as void
ParameterTypeDescription
Parameter
difficulty
Type
Difficulty
Description
No Description Provided
Parameter
force
Type
boolean
Description
No Description Provided

Link to g--39

Name: setDifficultyLocked

Return Type: void

ZenScript
Copy
Server.setDifficultyLocked(locked as boolean) as void
ParameterTypeDescription
Parameter
locked
Type
boolean
Description
No Description Provided

Link to g--40

Name: setEnforceWhitelist

Return Type: void

ZenScript
Copy
Server.setEnforceWhitelist(enforceWhitelist as boolean) as void
ParameterTypeDescription
Parameter
enforceWhitelist
Type
boolean
Description
No Description Provided

Link to g--41

Name: setFlightAllowed

Return Type: void

ZenScript
Copy
Server.setFlightAllowed(flightAllowed as boolean) as void
ParameterTypeDescription
Parameter
flightAllowed
Type
boolean
Description
No Description Provided

Name: setMotd

Return Type: void

ZenScript
Copy
Server.setMotd(motd as string) as void
ParameterTypeDescription
Parameter
motd
Type
string
Description
No Description Provided

Link to g--43

Name: setPvpAllowed

Return Type: void

ZenScript
Copy
Server.setPvpAllowed(pvpAllowed as boolean) as void
ParameterTypeDescription
Parameter
pvpAllowed
Type
boolean
Description
No Description Provided
NameTypeHas GetterHas SetterDescription
Name
absoluteMaxWorldSize
Type
int
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
allLevels
Type
stdlib.Iterable<ServerLevel>
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
areNpcsEnabled
Type
boolean
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
averageTickTime
Type
float
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
defaultGameTime
Type
GameType
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
forcedGameType
Type
GameType
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
isCommandBlockEnabled
Type
boolean
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
isDedicatedServer
Type
boolean
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
isEnforceWhitelist
Type
boolean
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
isFlightAllowed
Type
boolean
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
isHardcore
Type
boolean
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
isNetherEnabled
Type
boolean
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
isPvpAllowed
Type
boolean
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
isReady
Type
boolean
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
isRunning
Type
boolean
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
isShutdown
Type
boolean
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
isSingleplayer
Type
boolean
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
isSpawningAnimals
Type
boolean
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
isSpawningMonsters
Type
boolean
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
isStopped
Type
boolean
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
levelKeys
Type
stdlib.List<ResourceLocation>
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
maxPlayer
Type
int
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
moddeStatus
Type
invalid
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
motd
Type
string
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
operatorUserPermissionLevel
Type
int
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
overworld
Type
ServerLevel
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
playerCount
Type
int
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
playerNames
Type
string[]
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
serverModName
Type
string
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
serverVersion
Type
string
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
spawnProtectionRadius
Type
int
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
tickCount
Type
int
Has Getter
true
Has Setter
false
Description
No Description Provided