Importare la Classe

Link to importare-la-classe

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;

Interfacce Implementate

Link to interfacce-implementate

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

Name: areNpcsEnabled

Return Type: boolean

ZenScript
Copy
// Server.areNpcsEnabled() as boolean

myServer.areNpcsEnabled();

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);
ParametroTipoOptionalDefault Value
Parametro
command
Tipo
string
Optional
no
Default Value
Parametro
silent
Tipo
boolean
Optional
Default Value
no

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);
ParametroTipoOptionalDefault Value
Parametro
command
Tipo
string
Optional
no
Default Value
Parametro
player
Tipo
Player
Optional
no
Default Value
Parametro
silent
Tipo
boolean
Optional
Default Value
no

Link to getAbsoluteMaxWorldSize

Name: getAbsoluteMaxWorldSize

Return Type: int

ZenScript
Copy
// Server.getAbsoluteMaxWorldSize() as int

myServer.getAbsoluteMaxWorldSize();

Name: getAllLevels

Return Type: stdlib.Iterable<ServerLevel>

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

myServer.getAllLevels();

Link to getAverageTickTime

Name: getAverageTickTime

Return Type: float

ZenScript
Copy
// Server.getAverageTickTime() as float

myServer.getAverageTickTime();

Link to getDefaultGameType

Name: getDefaultGameType

Return Type: GameType

ZenScript
Copy
// Server.getDefaultGameType() as GameType

myServer.getDefaultGameType();

Link to getForcedGameType

Name: getForcedGameType

Return Type: GameType?

ZenScript
Copy
// Server.getForcedGameType() as GameType?

myServer.getForcedGameType();

Name: getLevel

Return Type: ServerLevel?

ZenScript
Copy
Server.getLevel(location as ResourceLocation) as ServerLevel?
ParametroTipo
Parametro
posizione
Tipo
ResourceLocation

Name: getMaxPlayers

Return Type: int

ZenScript
Copy
// Server.getMaxPlayers() as int

myServer.getMaxPlayers();

Name: getModdedStatus

Return Type: string?

ZenScript
Copy
// Server.getModdedStatus() as string?

myServer.getModdedStatus();

Name: getMotd

Return Type: string

ZenScript
Copy
// Server.getMotd() as string

myServer.getMotd();

Link to getOperatorUserPermissionLevel

Name: getOperatorUserPermissionLevel

Return Type: int

ZenScript
Copy
// Server.getOperatorUserPermissionLevel() as int

myServer.getOperatorUserPermissionLevel();

Link to getOverworldData

Name: getOverworldData

Gets the custom data of the overworld.

The overworld is always loaded, so this can be used to store and access data no matter what level a player may be in.

Returns: The overworld's custom data.
Return Type: CraftTweakerSavedData

ZenScript
Copy
// Server.getOverworldData() as CraftTweakerSavedData

myServer.getOverworldData();

Name: getPlayerCount

Return Type: int

ZenScript
Copy
// Server.getPlayerCount() as int

myServer.getPlayerCount();

Name: getPlayerNames

Return Type: string[]

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

myServer.getPlayerNames();

Link to getServerModName

Name: getServerModName

Return Type: string

ZenScript
Copy
// Server.getServerModName() as string

myServer.getServerModName();

Link to getServerVersion

Name: getServerVersion

Return Type: string

ZenScript
Copy
// Server.getServerVersion() as string

myServer.getServerVersion();

Link to getSpawnProtectionRadius

Name: getSpawnProtectionRadius

Return Type: int

ZenScript
Copy
// Server.getSpawnProtectionRadius() as int

myServer.getSpawnProtectionRadius();

Name: getSpawnRadius

Return Type: int

ZenScript
Copy
Server.getSpawnRadius(level as ServerLevel?) as int
ParametroTipo
Parametro
level
Tipo
ServerLevel?

Name: getTickCount

Return Type: int

ZenScript
Copy
// Server.getTickCount() as int

myServer.getTickCount();

Link to isCommandBlockEnabled

Name: isCommandBlockEnabled

Return Type: boolean

ZenScript
Copy
// Server.isCommandBlockEnabled() as boolean

myServer.isCommandBlockEnabled();

Link to isDedicatedServer

Name: isDedicatedServer

Return Type: boolean

ZenScript
Copy
// Server.isDedicatedServer() as boolean

myServer.isDedicatedServer();

Link to isEnforceWhitelist

Name: isEnforceWhitelist

Return Type: boolean

ZenScript
Copy
// Server.isEnforceWhitelist() as boolean

myServer.isEnforceWhitelist();

Name: isFlightAllowed

Return Type: boolean

ZenScript
Copy
// Server.isFlightAllowed() as boolean

myServer.isFlightAllowed();

Name: isHardcore

Return Type: boolean

ZenScript
Copy
// Server.isHardcore() as boolean

myServer.isHardcore();

Name: isNetherEnabled

Return Type: boolean

ZenScript
Copy
// Server.isNetherEnabled() as boolean

myServer.isNetherEnabled();

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();

Name: isRunning

Return Type: boolean

ZenScript
Copy
// Server.isRunning() as boolean

myServer.isRunning();

Name: isShutdown

Return Type: boolean

ZenScript
Copy
// Server.isShutdown() as boolean

myServer.isShutdown();

Name: isSingleplayer

Return Type: boolean

ZenScript
Copy
// Server.isSingleplayer() as boolean

myServer.isSingleplayer();

Link to isSpawningAnimals

Name: isSpawningAnimals

Return Type: boolean

ZenScript
Copy
// Server.isSpawningAnimals() as boolean

myServer.isSpawningAnimals();

Link to isSpawningMonsters

Name: isSpawningMonsters

Return Type: boolean

ZenScript
Copy
// Server.isSpawningMonsters() as boolean

myServer.isSpawningMonsters();

Name: isStopped

Return Type: boolean

ZenScript
Copy
// Server.isStopped() as boolean

myServer.isStopped();

Link to isUnderSpawnProtection

Name: isUnderSpawnProtection

Return Type: boolean

ZenScript
Copy
Server.isUnderSpawnProtection(level as ServerLevel, pos as BlockPos, player as Player) as boolean
ParametroTipo
Parametro
level
Tipo
ServerLevel
Parametro
pos
Tipo
BlockPos
Parametro
player
Tipo
Player

Name: levelKeys

Return Type: stdlib.List<ResourceLocation>

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

myServer.levelKeys();

Name: overworld

Return Type: ServerLevel

ZenScript
Copy
// Server.overworld() as ServerLevel

myServer.overworld();

Link to setDefaultGameType

Name: setDefaultGameType

ZenScript
Copy
Server.setDefaultGameType(gameType as GameType)
ParametroTipo
Parametro
gameType
Tipo
GameType

Name: setDifficulty

ZenScript
Copy
Server.setDifficulty(difficulty as Difficulty, force as boolean)
ParametroTipo
Parametro
difficulty
Tipo
Difficulty
Parametro
force
Tipo
boolean

Link to setDifficultyLocked

Name: setDifficultyLocked

ZenScript
Copy
Server.setDifficultyLocked(locked as boolean)
ParametroTipo
Parametro
locked
Tipo
boolean

Link to setEnforceWhitelist

Name: setEnforceWhitelist

ZenScript
Copy
Server.setEnforceWhitelist(enforceWhitelist as boolean)
ParametroTipo
Parametro
enforceWhitelist
Tipo
boolean

Link to setFlightAllowed

Name: setFlightAllowed

ZenScript
Copy
Server.setFlightAllowed(flightAllowed as boolean)
ParametroTipo
Parametro
flightAllowed
Tipo
boolean

Name: setMotd

ZenScript
Copy
Server.setMotd(motd as string)
ParametroTipo
Parametro
motd
Tipo
string

Name: setPvpAllowed

ZenScript
Copy
Server.setPvpAllowed(pvpAllowed as boolean)
ParametroTipo
Parametro
pvpAllowed
Tipo
boolean
NomeTipoHa GetterHa SetterDescrizione
Nome
absoluteMaxWorldSize
Tipo
int
Ha Getter
Ha Setter
no
Descrizione
Nome
allLevels
Tipo
stdlib.Iterable<ServerLevel>
Ha Getter
Ha Setter
no
Descrizione
Nome
areNpcsEnabled
Tipo
boolean
Ha Getter
Ha Setter
no
Descrizione
Nome
averageTickTime
Tipo
float
Ha Getter
Ha Setter
no
Descrizione
Nome
defaultGameTime
Tipo
GameType
Ha Getter
Ha Setter
no
Descrizione
Nome
forcedGameType
Tipo
GameType?
Ha Getter
Ha Setter
no
Descrizione
Nome
isCommandBlockEnabled
Tipo
boolean
Ha Getter
Ha Setter
no
Descrizione
Nome
isDedicatedServer
Tipo
boolean
Ha Getter
Ha Setter
no
Descrizione
Nome
isEnforceWhitelist
Tipo
boolean
Ha Getter
Ha Setter
no
Descrizione
Nome
isFlightAllowed
Tipo
boolean
Ha Getter
Ha Setter
no
Descrizione
Nome
isHardcore
Tipo
boolean
Ha Getter
Ha Setter
no
Descrizione
Nome
isNetherEnabled
Tipo
boolean
Ha Getter
Ha Setter
no
Descrizione
Nome
isPvpAllowed
Tipo
boolean
Ha Getter
Ha Setter
no
Descrizione
Nome
isReady
Tipo
boolean
Ha Getter
Ha Setter
no
Descrizione
Nome
isRunning
Tipo
boolean
Ha Getter
Ha Setter
no
Descrizione
Nome
isShutdown
Tipo
boolean
Ha Getter
Ha Setter
no
Descrizione
Nome
isSingleplayer
Tipo
boolean
Ha Getter
Ha Setter
no
Descrizione
Nome
isSpawningAnimals
Tipo
boolean
Ha Getter
Ha Setter
no
Descrizione
Nome
isSpawningMonsters
Tipo
boolean
Ha Getter
Ha Setter
no
Descrizione
Nome
isStopped
Tipo
boolean
Ha Getter
Ha Setter
no
Descrizione
Nome
levelKeys
Tipo
stdlib.List<ResourceLocation>
Ha Getter
Ha Setter
no
Descrizione
Nome
maxPlayer
Tipo
int
Ha Getter
Ha Setter
no
Descrizione
Nome
moddeStatus
Tipo
string?
Ha Getter
Ha Setter
no
Descrizione
Nome
motd
Tipo
string
Ha Getter
Ha Setter
no
Descrizione
Nome
operatorUserPermissionLevel
Tipo
int
Ha Getter
Ha Setter
no
Descrizione
Nome
overworld
Tipo
ServerLevel
Ha Getter
Ha Setter
no
Descrizione
Nome
overworldData
Tipo
CraftTweakerSavedData
Ha Getter
Ha Setter
no
Descrizione
Gets the custom data of the overworld.

The overworld is always loaded, so this can be used to store and access data no matter what level a player may be in.
Nome
playerCount
Tipo
int
Ha Getter
Ha Setter
no
Descrizione
Nome
playerNames
Tipo
string[]
Ha Getter
Ha Setter
no
Descrizione
Nome
serverModName
Tipo
string
Ha Getter
Ha Setter
no
Descrizione
Nome
serverVersion
Tipo
string
Ha Getter
Ha Setter
no
Descrizione
Nome
spawnProtectionRadius
Tipo
int
Ha Getter
Ha Setter
no
Descrizione
Nome
tickCount
Tipo
int
Ha Getter
Ha Setter
no
Descrizione