Server
Link to server
Diese Klasse importieren
Link to diese-klasse-importieren
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 Copyimport 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
- CommandSource
- AutoCloseable
Methoden
Link to methoden
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);
Parameter | Type | Optional | Standardwert |
---|---|---|---|
Parameter command | Type string | Optional false | Standardwert |
Parameter silent | Type boolean | Optional true | Standardwert false |
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);
Parameter | Type | Optional | Standardwert |
---|---|---|---|
Parameter command | Type string | Optional false | Standardwert |
Parameter player | Type Player | Optional false | Standardwert |
Parameter silent | Type boolean | Optional true | Standardwert false |
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();
Name: getAverageTickTime
Return Type: float
ZenScript Copy// Server.getAverageTickTime() as float
myServer.getAverageTickTime();
Name: getDefaultGameType
Return Type: GameType
ZenScript Copy// Server.getDefaultGameType() as GameType
myServer.getDefaultGameType();
Name: getForcedGameType
Return Type: GameType?
ZenScript Copy// Server.getForcedGameType() as GameType?
myServer.getForcedGameType();
Name: getLevel
Return Type: ServerLevel?
ZenScript CopyServer.getLevel(location as ResourceLocation) as ServerLevel?
Parameter | Type |
---|---|
Parameter standort | Type 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();
Name: getOperatorUserPermissionLevel
Return Type: int
ZenScript Copy// Server.getOperatorUserPermissionLevel() as int
myServer.getOperatorUserPermissionLevel();
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: getPlayerList
Return Type: PlayerList
ZenScript Copy// Server.getPlayerList() as PlayerList
myServer.getPlayerList();
Name: getPlayerNames
Return Type: string[]
ZenScript Copy// Server.getPlayerNames() as string[]
myServer.getPlayerNames();
Name: getServerModName
Return Type: string
ZenScript Copy// Server.getServerModName() as string
myServer.getServerModName();
Name: getServerVersion
Return Type: string
ZenScript Copy// Server.getServerVersion() as string
myServer.getServerVersion();
Name: getSpawnProtectionRadius
Return Type: int
ZenScript Copy// Server.getSpawnProtectionRadius() as int
myServer.getSpawnProtectionRadius();
Name: getSpawnRadius
Return Type: int
ZenScript CopyServer.getSpawnRadius(level as ServerLevel?) as int
Parameter | Type |
---|---|
Parameter level | Type ServerLevel? |
Name: getTickCount
Return Type: int
ZenScript Copy// Server.getTickCount() as int
myServer.getTickCount();
Name: isCommandBlockEnabled
Return Type: boolean
ZenScript Copy// Server.isCommandBlockEnabled() as boolean
myServer.isCommandBlockEnabled();
Name: isDedicatedServer
Return Type: boolean
ZenScript Copy// Server.isDedicatedServer() as boolean
myServer.isDedicatedServer();
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();
Name: isSpawningAnimals
Return Type: boolean
ZenScript Copy// Server.isSpawningAnimals() as boolean
myServer.isSpawningAnimals();
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();
Name: isUnderSpawnProtection
Return Type: boolean
ZenScript CopyServer.isUnderSpawnProtection(level as ServerLevel, pos as BlockPos, player as Player) as boolean
Parameter | Type |
---|---|
Parameter level | Type ServerLevel |
Parameter pos | Type BlockPos |
Parameter player | Type 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();
Name: setDefaultGameType
ZenScript CopyServer.setDefaultGameType(gameType as GameType)
Parameter | Type |
---|---|
Parameter gameType | Type GameType |
Name: setDifficulty
ZenScript CopyServer.setDifficulty(difficulty as Difficulty, force as boolean)
Parameter | Type |
---|---|
Parameter difficulty | Type Difficulty |
Parameter force | Type boolean |
Name: setDifficultyLocked
ZenScript CopyServer.setDifficultyLocked(locked as boolean)
Parameter | Type |
---|---|
Parameter locked | Type boolean |
Name: setEnforceWhitelist
ZenScript CopyServer.setEnforceWhitelist(enforceWhitelist as boolean)
Parameter | Type |
---|---|
Parameter enforceWhitelist | Type boolean |
Name: setFlightAllowed
ZenScript CopyServer.setFlightAllowed(flightAllowed as boolean)
Parameter | Type |
---|---|
Parameter flightAllowed | Type boolean |
Name: setMotd
ZenScript CopyServer.setMotd(motd as string)
Parameter | Type |
---|---|
Parameter motd | Type string |
Name: setPvpAllowed
ZenScript CopyServer.setPvpAllowed(pvpAllowed as boolean)
Parameter | Type |
---|---|
Parameter pvpAllowed | Type boolean |
Properties
Link to properties
Name | Type | Has Getter | Has Setter | Beschreibung |
---|---|---|---|---|
Name absoluteMaxWorldSize | Type int | Has Getter true | Has Setter false | Beschreibung |
Name allLevels | Type stdlib.Iterable<ServerLevel> | Has Getter true | Has Setter false | Beschreibung |
Name areNpcsEnabled | Type boolean | Has Getter true | Has Setter false | Beschreibung |
Name averageTickTime | Type float | Has Getter true | Has Setter false | Beschreibung |
Name defaultGameTime | Type GameType | Has Getter true | Has Setter false | Beschreibung |
Name forcedGameType | Type GameType? | Has Getter true | Has Setter false | Beschreibung |
Name isCommandBlockEnabled | Type boolean | Has Getter true | Has Setter false | Beschreibung |
Name isDedicatedServer | Type boolean | Has Getter true | Has Setter false | Beschreibung |
Name isEnforceWhitelist | Type boolean | Has Getter true | Has Setter false | Beschreibung |
Name isFlightAllowed | Type boolean | Has Getter true | Has Setter false | Beschreibung |
Name isHardcore | Type boolean | Has Getter true | Has Setter false | Beschreibung |
Name isNetherEnabled | Type boolean | Has Getter true | Has Setter false | Beschreibung |
Name isPvpAllowed | Type boolean | Has Getter true | Has Setter false | Beschreibung |
Name isReady | Type boolean | Has Getter true | Has Setter false | Beschreibung |
Name isRunning | Type boolean | Has Getter true | Has Setter false | Beschreibung |
Name isShutdown | Type boolean | Has Getter true | Has Setter false | Beschreibung |
Name isSingleplayer | Type boolean | Has Getter true | Has Setter false | Beschreibung |
Name isSpawningAnimals | Type boolean | Has Getter true | Has Setter false | Beschreibung |
Name isSpawningMonsters | Type boolean | Has Getter true | Has Setter false | Beschreibung |
Name isStopped | Type boolean | Has Getter true | Has Setter false | Beschreibung |
Name levelKeys | Type stdlib.List<ResourceLocation> | Has Getter true | Has Setter false | Beschreibung |
Name maxPlayer | Type int | Has Getter true | Has Setter false | Beschreibung |
Name moddeStatus | Type string? | Has Getter true | Has Setter false | Beschreibung |
Name motd | Type string | Has Getter true | Has Setter false | Beschreibung |
Name operatorUserPermissionLevel | Type int | Has Getter true | Has Setter false | Beschreibung |
Name overworld | Type ServerLevel | Has Getter true | Has Setter false | Beschreibung |
Name overworldData | Type CraftTweakerSavedData | Has Getter true | Has Setter false | Beschreibung 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. |
Name playerCount | Type int | Has Getter true | Has Setter false | Beschreibung |
Name playerList | Type PlayerList | Has Getter true | Has Setter false | Beschreibung |
Name playerNames | Type string[] | Has Getter true | Has Setter false | Beschreibung |
Name serverModName | Type string | Has Getter true | Has Setter false | Beschreibung |
Name serverVersion | Type string | Has Getter true | Has Setter false | Beschreibung |
Name spawnProtectionRadius | Type int | Has Getter true | Has Setter false | Beschreibung |
Name tickCount | Type int | Has Getter true | Has Setter false | Beschreibung |