Server
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.
Implemented Interfaces
Server implements the following interfaces. That means all methods defined in these interfaces are also available in Server
- CommandSource
- AutoCloseable
Methods
Return Type: boolean
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
Parameter | Type | Optional | Default Value |
---|---|---|---|
Parameter command | Type string | Optional false | Default Value |
Parameter silent | Type boolean | Optional true | Default Value false |
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
Parameter | Type | Optional | Default Value |
---|---|---|---|
Parameter command | Type string | Optional false | Default Value |
Parameter player | Type Player | Optional false | Default Value |
Parameter silent | Type boolean | Optional true | Default Value false |
Return Type: int
Return Type: stdlib.Iterable<ServerLevel>
Return Type: float
Return Type: GameType
Return Type: GameType?
Return Type: ServerLevel?
Parameter | Type |
---|---|
Parameter location | Type ResourceLocation |
Return Type: int
Return Type: string?
Return Type: string
Return Type: int
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
Return Type: int
Return Type: string[]
Return Type: string
Return Type: string
Return Type: int
Return Type: int
Parameter | Type |
---|---|
Parameter level | Type ServerLevel? |
Return Type: int
Return Type: boolean
Return Type: boolean
Return Type: boolean
Return Type: boolean
Return Type: boolean
Return Type: boolean
Return Type: boolean
Return Type: boolean
Return Type: boolean
Return Type: boolean
Return Type: boolean
Return Type: boolean
Return Type: boolean
Return Type: boolean
Return Type: boolean
Parameter | Type |
---|---|
Parameter level | Type ServerLevel |
Parameter pos | Type BlockPos |
Parameter player | Type Player |
Return Type: stdlib.List<ResourceLocation>
Return Type: ServerLevel
Parameter | Type |
---|---|
Parameter gameType | Type GameType |
Parameter | Type |
---|---|
Parameter difficulty | Type Difficulty |
Parameter force | Type boolean |
Parameter | Type |
---|---|
Parameter locked | Type boolean |
Parameter | Type |
---|---|
Parameter enforceWhitelist | Type boolean |
Parameter | Type |
---|---|
Parameter flightAllowed | Type boolean |
Parameter | Type |
---|---|
Parameter motd | Type string |
Parameter | Type |
---|---|
Parameter pvpAllowed | Type boolean |
Properties
Name | Type | Has Getter | Has Setter | Description |
---|---|---|---|---|
Name absoluteMaxWorldSize | Type int | Has Getter true | Has Setter false | Description |
Name allLevels | Type stdlib.Iterable<ServerLevel> | Has Getter true | Has Setter false | Description |
Name areNpcsEnabled | Type boolean | Has Getter true | Has Setter false | Description |
Name averageTickTime | Type float | Has Getter true | Has Setter false | Description |
Name defaultGameTime | Type GameType | Has Getter true | Has Setter false | Description |
Name forcedGameType | Type GameType? | Has Getter true | Has Setter false | Description |
Name isCommandBlockEnabled | Type boolean | Has Getter true | Has Setter false | Description |
Name isDedicatedServer | Type boolean | Has Getter true | Has Setter false | Description |
Name isEnforceWhitelist | Type boolean | Has Getter true | Has Setter false | Description |
Name isFlightAllowed | Type boolean | Has Getter true | Has Setter false | Description |
Name isHardcore | Type boolean | Has Getter true | Has Setter false | Description |
Name isNetherEnabled | Type boolean | Has Getter true | Has Setter false | Description |
Name isPvpAllowed | Type boolean | Has Getter true | Has Setter false | Description |
Name isReady | Type boolean | Has Getter true | Has Setter false | Description |
Name isRunning | Type boolean | Has Getter true | Has Setter false | Description |
Name isShutdown | Type boolean | Has Getter true | Has Setter false | Description |
Name isSingleplayer | Type boolean | Has Getter true | Has Setter false | Description |
Name isSpawningAnimals | Type boolean | Has Getter true | Has Setter false | Description |
Name isSpawningMonsters | Type boolean | Has Getter true | Has Setter false | Description |
Name isStopped | Type boolean | Has Getter true | Has Setter false | Description |
Name levelKeys | Type stdlib.List<ResourceLocation> | Has Getter true | Has Setter false | Description |
Name maxPlayer | Type int | Has Getter true | Has Setter false | Description |
Name moddeStatus | Type string? | Has Getter true | Has Setter false | Description |
Name motd | Type string | Has Getter true | Has Setter false | Description |
Name operatorUserPermissionLevel | Type int | Has Getter true | Has Setter false | Description |
Name overworld | Type ServerLevel | Has Getter true | Has Setter false | Description |
Name overworldData | Type CraftTweakerSavedData | Has Getter true | Has Setter false | Description 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 | Description |
Name playerNames | Type string[] | Has Getter true | Has Setter false | Description |
Name serverModName | Type string | Has Getter true | Has Setter false | Description |
Name serverVersion | Type string | Has Getter true | Has Setter false | Description |
Name spawnProtectionRadius | Type int | Has Getter true | Has Setter false | Description |
Name tickCount | Type int | Has Getter true | Has Setter false | Description |