Home Commands Examples Getting Started With Scripts Global Keywords
BracketDumpers BracketHandlers BracketValidators ResourceLocationBracketHandler

Server

Importing the class

If you need to reference this type directly, like when casting an Array, or as a parameter, you will need to import it. Simply add the import at the top of the file.

script.zs
import crafttweaker.api.game.Server;

Extends

Server extends ReentrantBlockableEventLoop<TickTask>.

Implements

Server implements the following interfaces:

CommandSource

Undocumented Interfaces

ServerInfo,ProfilerMeasured,ProcessorHandle<Runnable>,Executor

Members

Getter
script.zs
// MinecraftServer.absoluteMaxWorldSize as int
myMinecraftServer.absoluteMaxWorldSize

Return Type: int

absoluteMaxWorldSize() as int
script.zs
// MinecraftServer.absoluteMaxWorldSize() as int;
myMinecraftServer.absoluteMaxWorldSize();

Return Type: int

Getter
script.zs
// MinecraftServer.acceptsFailure as bool
myMinecraftServer.acceptsFailure

Return Type: bool

acceptsFailure() as bool
script.zs
// MinecraftServer.acceptsFailure() as bool;
myMinecraftServer.acceptsFailure();

Return Type: bool

Getter
script.zs
// MinecraftServer.acceptsSuccess as bool
myMinecraftServer.acceptsSuccess

Return Type: bool

acceptsSuccess() as bool
script.zs
// MinecraftServer.acceptsSuccess() as bool;
myMinecraftServer.acceptsSuccess();

Return Type: bool

Getter
script.zs
// MinecraftServer.allLevels as Iterable<ServerLevel>
myMinecraftServer.allLevels

Return Type: Iterable<ServerLevel>

allLevels() as Iterable<ServerLevel>
script.zs
// MinecraftServer.allLevels() as Iterable<ServerLevel>;
myMinecraftServer.allLevels();

Return Type: Iterable<ServerLevel>

Getter
script.zs
// MinecraftServer.alwaysAccepts as bool
myMinecraftServer.alwaysAccepts

Return Type: bool

alwaysAccepts() as bool
script.zs
// MinecraftServer.alwaysAccepts() as bool;
myMinecraftServer.alwaysAccepts();

Return Type: bool

Getter
script.zs
// MinecraftServer.areNpcsEnabled as bool
myMinecraftServer.areNpcsEnabled

Return Type: bool

areNpcsEnabled() as bool
script.zs
// MinecraftServer.areNpcsEnabled() as bool;
myMinecraftServer.areNpcsEnabled();

Return Type: bool

Getter
script.zs
// MinecraftServer.averageTickTime as float
myMinecraftServer.averageTickTime

Return Type: float

averageTickTime() as float
script.zs
// MinecraftServer.averageTickTime() as float;
myMinecraftServer.averageTickTime();

Return Type: float

Getter
script.zs
// MinecraftServer.defaultGameTime as GameType
myMinecraftServer.defaultGameTime

Return Type: GameType

defaultGameTime() as GameType
script.zs
// MinecraftServer.defaultGameTime() as GameType;
myMinecraftServer.defaultGameTime();

Return Type: GameType

executeCommand(command as string, silent as bool = false) as int
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

script.zs
// MinecraftServer.executeCommand(command as string, silent as bool = false) as int;
myMinecraftServer.executeCommand("time set day", true);

Parameters:

command Type: string
silent (optional) Type: bool

Default Value: false

Return Type: int

executeCommand(command as string, player as Player, silent as bool = false) as int
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

script.zs
// MinecraftServer.executeCommand(command as string, player as Player, silent as bool = false) as int;
myMinecraftServer.executeCommand("time set day", player, true);

Parameters:

command Type: string
player Type: Player
silent (optional) Type: bool

Default Value: false

Return Type: int

Getter
script.zs
// MinecraftServer.forcedGameType as GameType
myMinecraftServer.forcedGameType

Return Type: GameType

forcedGameType() as GameType
script.zs
// MinecraftServer.forcedGameType() as GameType;
myMinecraftServer.forcedGameType();

Return Type: GameType

getLevel(location as ResourceLocation) as ServerLevel
script.zs
// MinecraftServer.getLevel(location as ResourceLocation) as ServerLevel;
myMinecraftServer.getLevel(myResourceLocation);

Parameters:

Return Type: ServerLevel

getSpawnRadius(level as ServerLevel) as int
script.zs
// MinecraftServer.getSpawnRadius(level as ServerLevel) as int;
myMinecraftServer.getSpawnRadius(myServerLevel);

Parameters:

level Type: ServerLevel

Return Type: int

Getter
script.zs
// MinecraftServer.isCommandBlockEnabled as bool
myMinecraftServer.isCommandBlockEnabled

Return Type: bool

isCommandBlockEnabled() as bool
script.zs
// MinecraftServer.isCommandBlockEnabled() as bool;
myMinecraftServer.isCommandBlockEnabled();

Return Type: bool

Getter
script.zs
// MinecraftServer.isDedicatedServer as bool
myMinecraftServer.isDedicatedServer

Return Type: bool

isDedicatedServer() as bool
script.zs
// MinecraftServer.isDedicatedServer() as bool;
myMinecraftServer.isDedicatedServer();

Return Type: bool

Getter
script.zs
// MinecraftServer.isEnforceWhitelist as bool
myMinecraftServer.isEnforceWhitelist

Return Type: bool

isEnforceWhitelist() as bool
script.zs
// MinecraftServer.isEnforceWhitelist() as bool;
myMinecraftServer.isEnforceWhitelist();

Return Type: bool

Getter
script.zs
// MinecraftServer.isFlightAllowed as bool
myMinecraftServer.isFlightAllowed

Return Type: bool

isFlightAllowed() as bool
script.zs
// MinecraftServer.isFlightAllowed() as bool;
myMinecraftServer.isFlightAllowed();

Return Type: bool

Getter
script.zs
// MinecraftServer.isHardcore as bool
myMinecraftServer.isHardcore

Return Type: bool

isHardcore() as bool
script.zs
// MinecraftServer.isHardcore() as bool;
myMinecraftServer.isHardcore();

Return Type: bool

Getter
script.zs
// MinecraftServer.isNetherEnabled as bool
myMinecraftServer.isNetherEnabled

Return Type: bool

isNetherEnabled() as bool
script.zs
// MinecraftServer.isNetherEnabled() as bool;
myMinecraftServer.isNetherEnabled();

Return Type: bool

Getter
script.zs
// MinecraftServer.isPvpAllowed as bool
myMinecraftServer.isPvpAllowed

Return Type: bool

isPvpAllowed() as bool
script.zs
// MinecraftServer.isPvpAllowed() as bool;
myMinecraftServer.isPvpAllowed();

Return Type: bool

Getter
script.zs
// MinecraftServer.isReady as bool
myMinecraftServer.isReady

Return Type: bool

isReady() as bool
script.zs
// MinecraftServer.isReady() as bool;
myMinecraftServer.isReady();

Return Type: bool

Getter
script.zs
// MinecraftServer.isRunning as bool
myMinecraftServer.isRunning

Return Type: bool

isRunning() as bool
script.zs
// MinecraftServer.isRunning() as bool;
myMinecraftServer.isRunning();

Return Type: bool

Getter
script.zs
// MinecraftServer.isShutdown as bool
myMinecraftServer.isShutdown

Return Type: bool

isShutdown() as bool
script.zs
// MinecraftServer.isShutdown() as bool;
myMinecraftServer.isShutdown();

Return Type: bool

Getter
script.zs
// MinecraftServer.isSingleplayer as bool
myMinecraftServer.isSingleplayer

Return Type: bool

isSingleplayer() as bool
script.zs
// MinecraftServer.isSingleplayer() as bool;
myMinecraftServer.isSingleplayer();

Return Type: bool

Getter
script.zs
// MinecraftServer.isSpawningAnimals as bool
myMinecraftServer.isSpawningAnimals

Return Type: bool

isSpawningAnimals() as bool
script.zs
// MinecraftServer.isSpawningAnimals() as bool;
myMinecraftServer.isSpawningAnimals();

Return Type: bool

Getter
script.zs
// MinecraftServer.isSpawningMonsters as bool
myMinecraftServer.isSpawningMonsters

Return Type: bool

isSpawningMonsters() as bool
script.zs
// MinecraftServer.isSpawningMonsters() as bool;
myMinecraftServer.isSpawningMonsters();

Return Type: bool

Getter
script.zs
// MinecraftServer.isStopped as bool
myMinecraftServer.isStopped

Return Type: bool

isStopped() as bool
script.zs
// MinecraftServer.isStopped() as bool;
myMinecraftServer.isStopped();

Return Type: bool

isUnderSpawnProtection(level as ServerLevel, pos as BlockPos, player as Player) as bool
script.zs
// MinecraftServer.isUnderSpawnProtection(level as ServerLevel, pos as BlockPos, player as Player) as bool;
myMinecraftServer.isUnderSpawnProtection(myServerLevel, myBlockPos, myPlayer);

Parameters:

level Type: ServerLevel
pos Type: BlockPos
player Type: Player

Return Type: bool

Getter
script.zs
// MinecraftServer.levelKeys as List<ResourceLocation>
myMinecraftServer.levelKeys

Return Type: List<ResourceLocation>

levelKeys() as List<ResourceLocation>
script.zs
// MinecraftServer.levelKeys() as List<ResourceLocation>;
myMinecraftServer.levelKeys();

Return Type: List<ResourceLocation>

Getter
script.zs
// MinecraftServer.maxPlayer as int
myMinecraftServer.maxPlayer

Return Type: int

maxPlayer() as int
script.zs
// MinecraftServer.maxPlayer() as int;
myMinecraftServer.maxPlayer();

Return Type: int

Getter
script.zs
// MinecraftServer.moddeStatus as string
myMinecraftServer.moddeStatus

Return Type: string

moddeStatus() as string
script.zs
// MinecraftServer.moddeStatus() as string;
myMinecraftServer.moddeStatus();

Return Type: string

Getter
script.zs
// MinecraftServer.motd as string
myMinecraftServer.motd

Return Type: string

motd() as string
script.zs
// MinecraftServer.motd() as string;
myMinecraftServer.motd();

Return Type: string

Getter
script.zs
// MinecraftServer.operatorUserPermissionLevel as int
myMinecraftServer.operatorUserPermissionLevel

Return Type: int

operatorUserPermissionLevel() as int
script.zs
// MinecraftServer.operatorUserPermissionLevel() as int;
myMinecraftServer.operatorUserPermissionLevel();

Return Type: int

Getter
script.zs
// MinecraftServer.overworld as ServerLevel
myMinecraftServer.overworld

Return Type: ServerLevel

overworld() as ServerLevel
script.zs
// MinecraftServer.overworld() as ServerLevel;
myMinecraftServer.overworld();

Return Type: ServerLevel

Getter
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.

script.zs
// MinecraftServer.overworldData as CraftTweakerSavedData
myMinecraftServer.overworldData

Return Type: CraftTweakerSavedData

overworldData() as CraftTweakerSavedData
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.

script.zs
// MinecraftServer.overworldData() as CraftTweakerSavedData;
myMinecraftServer.overworldData();

Return Type: CraftTweakerSavedData

Getter
script.zs
// MinecraftServer.playerCount as int
myMinecraftServer.playerCount

Return Type: int

playerCount() as int
script.zs
// MinecraftServer.playerCount() as int;
myMinecraftServer.playerCount();

Return Type: int

Getter
script.zs
// MinecraftServer.playerList as PlayerList
myMinecraftServer.playerList

Return Type: PlayerList

playerList() as PlayerList
script.zs
// MinecraftServer.playerList() as PlayerList;
myMinecraftServer.playerList();

Return Type: PlayerList

Getter
script.zs
// MinecraftServer.playerNames as string[]
myMinecraftServer.playerNames

Return Type: string[]

playerNames() as string[]
script.zs
// MinecraftServer.playerNames() as string[];
myMinecraftServer.playerNames();

Return Type: string[]

sendMessage(component as Component)
script.zs
// MinecraftServer.sendMessage(component as Component);
myMinecraftServer.sendMessage(myComponent);

Parameters:

component Type: Component
Getter
script.zs
// MinecraftServer.serverModName as string
myMinecraftServer.serverModName

Return Type: string

serverModName() as string
script.zs
// MinecraftServer.serverModName() as string;
myMinecraftServer.serverModName();

Return Type: string

Getter
script.zs
// MinecraftServer.serverVersion as string
myMinecraftServer.serverVersion

Return Type: string

serverVersion() as string
script.zs
// MinecraftServer.serverVersion() as string;
myMinecraftServer.serverVersion();

Return Type: string

setDefaultGameType(gameType as GameType)
script.zs
// MinecraftServer.setDefaultGameType(gameType as GameType);
myMinecraftServer.setDefaultGameType(myGameType);

Parameters:

gameType Type: GameType
setDifficulty(difficulty as Difficulty, force as bool)
script.zs
// MinecraftServer.setDifficulty(difficulty as Difficulty, force as bool);
myMinecraftServer.setDifficulty(myDifficulty, myBool);

Parameters:

difficulty Type: Difficulty
force Type: bool
setDifficultyLocked(locked as bool)
script.zs
// MinecraftServer.setDifficultyLocked(locked as bool);
myMinecraftServer.setDifficultyLocked(myBool);

Parameters:

locked Type: bool
setEnforceWhitelist(enforceWhitelist as bool)
script.zs
// MinecraftServer.setEnforceWhitelist(enforceWhitelist as bool);
myMinecraftServer.setEnforceWhitelist(myBool);

Parameters:

enforceWhitelist Type: bool
setFlightAllowed(flightAllowed as bool)
script.zs
// MinecraftServer.setFlightAllowed(flightAllowed as bool);
myMinecraftServer.setFlightAllowed(myBool);

Parameters:

flightAllowed Type: bool
setMotd(motd as string)
script.zs
// MinecraftServer.setMotd(motd as string);
myMinecraftServer.setMotd(myString);

Parameters:

motd Type: string
setPvpAllowed(pvpAllowed as bool)
script.zs
// MinecraftServer.setPvpAllowed(pvpAllowed as bool);
myMinecraftServer.setPvpAllowed(myBool);

Parameters:

pvpAllowed Type: bool
Getter
script.zs
// MinecraftServer.shouldInformAdmins as bool
myMinecraftServer.shouldInformAdmins

Return Type: bool

shouldInformAdmins() as bool
script.zs
// MinecraftServer.shouldInformAdmins() as bool;
myMinecraftServer.shouldInformAdmins();

Return Type: bool

Getter
script.zs
// MinecraftServer.spawnProtectionRadius as int
myMinecraftServer.spawnProtectionRadius

Return Type: int

spawnProtectionRadius() as int
script.zs
// MinecraftServer.spawnProtectionRadius() as int;
myMinecraftServer.spawnProtectionRadius();

Return Type: int

Getter
script.zs
// MinecraftServer.tickCount as int
myMinecraftServer.tickCount

Return Type: int

tickCount() as int
script.zs
// MinecraftServer.tickCount() as int;
myMinecraftServer.tickCount();

Return Type: int