Server
Link to server
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 Copyimport 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
- CommandSource
- AutoCloseable
Metodi
Link to metodi
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);
Parametro | Tipo | Descrizione | Optional | DefaultValue |
---|---|---|---|---|
Parametro command | Tipo string | Descrizione No Description Provided | Optional no | DefaultValue |
Parametro silent | Tipo boolean | Descrizione No Description Provided | Optional sì | DefaultValue 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);
Parametro | Tipo | Descrizione | Optional | DefaultValue |
---|---|---|---|---|
Parametro command | Tipo string | Descrizione No Description Provided | Optional no | DefaultValue |
Parametro player | Tipo Player | Descrizione No Description Provided | Optional no | DefaultValue |
Parametro silent | Tipo boolean | Descrizione No Description Provided | Optional sì | DefaultValue no |
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
Parametro | Tipo | Descrizione |
---|---|---|
Parametro posizione | Tipo ResourceLocation | Descrizione No Description Provided |
Name: getMaxPlayers
Return Type: int
ZenScript Copy// Server.getMaxPlayers() as int
myServer.getMaxPlayers();
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();
Name: getOperatorUserPermissionLevel
Return Type: int
ZenScript Copy// Server.getOperatorUserPermissionLevel() as int
myServer.getOperatorUserPermissionLevel();
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();
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
Parametro | Tipo | Descrizione |
---|---|---|
Parametro level | Tipo ServerLevel | Descrizione No Description Provided |
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
Parametro | Tipo | Descrizione |
---|---|---|
Parametro level | Tipo ServerLevel | Descrizione No Description Provided |
Parametro pos | Tipo BlockPos | Descrizione No Description Provided |
Parametro player | Tipo Player | Descrizione No Description Provided |
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
Return Type: void
ZenScript CopyServer.setDefaultGameType(gameType as GameType) as void
Parametro | Tipo | Descrizione |
---|---|---|
Parametro gameType | Tipo GameType | Descrizione No Description Provided |
Name: setDifficulty
Return Type: void
ZenScript CopyServer.setDifficulty(difficulty as Difficulty, force as boolean) as void
Parametro | Tipo | Descrizione |
---|---|---|
Parametro difficulty | Tipo Difficulty | Descrizione No Description Provided |
Parametro force | Tipo boolean | Descrizione No Description Provided |
Name: setDifficultyLocked
Return Type: void
ZenScript CopyServer.setDifficultyLocked(locked as boolean) as void
Parametro | Tipo | Descrizione |
---|---|---|
Parametro locked | Tipo boolean | Descrizione No Description Provided |
Name: setEnforceWhitelist
Return Type: void
ZenScript CopyServer.setEnforceWhitelist(enforceWhitelist as boolean) as void
Parametro | Tipo | Descrizione |
---|---|---|
Parametro enforceWhitelist | Tipo boolean | Descrizione No Description Provided |
Name: setFlightAllowed
Return Type: void
ZenScript CopyServer.setFlightAllowed(flightAllowed as boolean) as void
Parametro | Tipo | Descrizione |
---|---|---|
Parametro flightAllowed | Tipo boolean | Descrizione No Description Provided |
Name: setMotd
Return Type: void
ZenScript CopyServer.setMotd(motd as string) as void
Parametro | Tipo | Descrizione |
---|---|---|
Parametro motd | Tipo string | Descrizione No Description Provided |
Name: setPvpAllowed
Return Type: void
ZenScript CopyServer.setPvpAllowed(pvpAllowed as boolean) as void
Parametro | Tipo | Descrizione |
---|---|---|
Parametro pvpAllowed | Tipo boolean | Descrizione No Description Provided |
Proprietà
Link to proprietà
Nome | Tipo | Ha Getter | Ha Setter | Descrizione |
---|---|---|---|---|
Nome absoluteMaxWorldSize | Tipo int | Ha Getter sì | Ha Setter no | Descrizione No Description Provided |
Nome allLevels | Tipo stdlib.Iterable<ServerLevel> | Ha Getter sì | Ha Setter no | Descrizione No Description Provided |
Nome areNpcsEnabled | Tipo boolean | Ha Getter sì | Ha Setter no | Descrizione No Description Provided |
Nome averageTickTime | Tipo float | Ha Getter sì | Ha Setter no | Descrizione No Description Provided |
Nome defaultGameTime | Tipo GameType | Ha Getter sì | Ha Setter no | Descrizione No Description Provided |
Nome forcedGameType | Tipo GameType | Ha Getter sì | Ha Setter no | Descrizione No Description Provided |
Nome isCommandBlockEnabled | Tipo boolean | Ha Getter sì | Ha Setter no | Descrizione No Description Provided |
Nome isDedicatedServer | Tipo boolean | Ha Getter sì | Ha Setter no | Descrizione No Description Provided |
Nome isEnforceWhitelist | Tipo boolean | Ha Getter sì | Ha Setter no | Descrizione No Description Provided |
Nome isFlightAllowed | Tipo boolean | Ha Getter sì | Ha Setter no | Descrizione No Description Provided |
Nome isHardcore | Tipo boolean | Ha Getter sì | Ha Setter no | Descrizione No Description Provided |
Nome isNetherEnabled | Tipo boolean | Ha Getter sì | Ha Setter no | Descrizione No Description Provided |
Nome isPvpAllowed | Tipo boolean | Ha Getter sì | Ha Setter no | Descrizione No Description Provided |
Nome isReady | Tipo boolean | Ha Getter sì | Ha Setter no | Descrizione No Description Provided |
Nome isRunning | Tipo boolean | Ha Getter sì | Ha Setter no | Descrizione No Description Provided |
Nome isShutdown | Tipo boolean | Ha Getter sì | Ha Setter no | Descrizione No Description Provided |
Nome isSingleplayer | Tipo boolean | Ha Getter sì | Ha Setter no | Descrizione No Description Provided |
Nome isSpawningAnimals | Tipo boolean | Ha Getter sì | Ha Setter no | Descrizione No Description Provided |
Nome isSpawningMonsters | Tipo boolean | Ha Getter sì | Ha Setter no | Descrizione No Description Provided |
Nome isStopped | Tipo boolean | Ha Getter sì | Ha Setter no | Descrizione No Description Provided |
Nome levelKeys | Tipo stdlib.List<ResourceLocation> | Ha Getter sì | Ha Setter no | Descrizione No Description Provided |
Nome maxPlayer | Tipo int | Ha Getter sì | Ha Setter no | Descrizione No Description Provided |
Nome moddeStatus | Tipo invalid | Ha Getter sì | Ha Setter no | Descrizione No Description Provided |
Nome motd | Tipo string | Ha Getter sì | Ha Setter no | Descrizione No Description Provided |
Nome operatorUserPermissionLevel | Tipo int | Ha Getter sì | Ha Setter no | Descrizione No Description Provided |
Nome overworld | Tipo ServerLevel | Ha Getter sì | Ha Setter no | Descrizione No Description Provided |
Nome playerCount | Tipo int | Ha Getter sì | Ha Setter no | Descrizione No Description Provided |
Nome playerNames | Tipo string[] | Ha Getter sì | Ha Setter no | Descrizione No Description Provided |
Nome serverModName | Tipo string | Ha Getter sì | Ha Setter no | Descrizione No Description Provided |
Nome serverVersion | Tipo string | Ha Getter sì | Ha Setter no | Descrizione No Description Provided |
Nome spawnProtectionRadius | Tipo int | Ha Getter sì | Ha Setter no | Descrizione No Description Provided |
Nome tickCount | Tipo int | Ha Getter sì | Ha Setter no | Descrizione No Description Provided |