Package net.minecraft.server
Class MinecraftServer
java.lang.Object
net.minecraft.util.concurrent.ThreadTaskExecutor<R>
net.minecraft.util.concurrent.RecursiveEventLoop<TickDelayedTask>
net.minecraft.server.MinecraftServer
- All Implemented Interfaces:
AutoCloseable
,Executor
,ICommandSource
,ISnooperInfo
,ITaskExecutor<TickDelayedTask>
- Direct Known Subclasses:
DedicatedServer
,IntegratedServer
public abstract class MinecraftServer
extends RecursiveEventLoop<TickDelayedTask>
implements ISnooperInfo, ICommandSource, AutoCloseable
-
Field Summary
Modifier and TypeFieldDescriptionprivate boolean
private float
private CommandStorage
private final NetworkSystem
private final TimeTracker
private final CustomServerBossInfoManager
private long
private boolean
static final WorldSettings
private boolean
private final Executor
private final com.mojang.datafixers.DataFixer
private boolean
private final FrameTimer
private final FunctionManager
private boolean
private boolean
private boolean
private KeyPair
private long
private long
private final Map<RegistryKey<World>,
ServerWorld> private String
private static final org.apache.logging.log4j.Logger
private int
private boolean
private String
protected long
private boolean
private final ResourcePackList
private Map<RegistryKey<World>,
long[]> protected final PlayerData
private int
private PlayerList
private int
private boolean
private final PlayerProfileCache
private IProfiler
private final com.mojang.authlib.GameProfileRepository
private final IChunkStatusListenerFactory
protected final Proxy
private boolean
private final Random
protected final DynamicRegistries.Impl
private String
private String
private DataPackRegistries
private boolean
private final ServerScoreboard
private String
private final Thread
private final com.mojang.authlib.minecraft.MinecraftSessionService
private String
private final Snooper
private final ServerStatusResponse
private boolean
protected final SaveFormat.LevelSave
private final TemplateManager
private int
final long[]
static final File
private ServerWorld[]
private int
private int
protected final IServerConfiguration
Fields inherited from interface net.minecraft.command.ICommandSource
NULL
-
Constructor Summary
ConstructorDescriptionMinecraftServer
(Thread p_i232576_1_, DynamicRegistries.Impl p_i232576_2_, SaveFormat.LevelSave p_i232576_3_, IServerConfiguration p_i232576_4_, ResourcePackList p_i232576_5_, Proxy p_i232576_6_, com.mojang.datafixers.DataFixer p_i232576_7_, DataPackRegistries p_i232576_8_, com.mojang.authlib.minecraft.MinecraftSessionService p_i232576_9_, com.mojang.authlib.GameProfileRepository p_i232576_10_, PlayerProfileCache p_i232576_11_, IChunkStatusListenerFactory p_i232576_12_) -
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
void
addTickable
(Runnable p_82010_1_) boolean
void
close()
static DatapackCodec
configurePackRepository
(ResourcePackList p_240772_0_, DatapackCodec p_240772_1_, boolean p_240772_2_) static void
convertFromRegionFormatIfNeeded
(SaveFormat.LevelSave p_240777_0_) protected void
createLevels
(IChunkStatusListener p_240787_1_) createTextFilterForPlayer
(ServerPlayerEntity p_244435_1_) protected void
protected void
doRunTask
(TickDelayedTask p_213166_1_) private void
dumpClasspath
(Path p_223706_1_) private void
dumpCrashCategory
(Path p_223709_1_) private void
dumpGameRules
(Path p_223708_1_) private void
dumpMiscStats
(Path p_223710_1_) private void
dumpThreads
(Path p_223712_1_) private void
endProfilerTick
(LongTickDetector p_240795_1_) fillReport
(CrashReport p_71230_1_) protected void
boolean
Deprecated.int
float
int
com.mojang.datafixers.DataFixer
boolean
abstract int
getLevel
(RegistryKey<World> p_71218_1_) int
int
getMotd()
long
abstract int
int
int
String[]
int
getPort()
boolean
int
getProfilePermissions
(com.mojang.authlib.GameProfile p_211833_1_) com.mojang.authlib.GameProfileRepository
abstract int
int
getScaledTrackingDistance
(int p_230512_1_) private static DatapackCodec
getSelectedPacks
(ResourcePackList p_240771_0_) com.mojang.authlib.minecraft.MinecraftSessionService
int
int
getSpawnRadius
(ServerWorld p_184108_1_) getTags()
int
long[]
getTickTime
(RegistryKey<World> dim) private ServerWorld[]
getWorldPath
(FolderName p_240776_1_) void
halt
(boolean p_71263_1_) boolean
hasGui()
boolean
private boolean
haveTime()
protected void
protected abstract boolean
void
abstract boolean
abstract boolean
boolean
isDemo()
boolean
abstract boolean
boolean
boolean
boolean
boolean
abstract boolean
boolean
boolean
isReady()
boolean
boolean
boolean
abstract boolean
isSingleplayerOwner
(com.mojang.authlib.GameProfile p_213199_1_) boolean
protected boolean
boolean
boolean
isUnderSpawnProtection
(ServerWorld p_175579_1_, BlockPos p_175579_2_, PlayerEntity p_175579_3_) void
kickUnlistedPlayers
(CommandSource p_205743_1_) protected void
void
Deprecated.protected void
onServerCrash
(CrashReport p_71228_1_) protected void
final ServerWorld
boolean
pollTask()
private boolean
void
populateSnooper
(Snooper p_70000_1_) private void
prepareLevels
(IChunkStatusListener p_213186_1_) abstract boolean
publishServer
(GameType p_195565_1_, boolean p_195565_2_, int p_195565_3_) private void
readScoreboard
(DimensionSavedDataManager p_213204_1_) reloadResources
(Collection<String> p_240780_1_) boolean
protected void
boolean
saveAllChunks
(boolean p_213211_1_, boolean p_213211_2_, boolean p_213211_3_) void
saveDebugReport
(Path p_223711_1_) boolean
private void
sendDifficultyUpdate
(ServerPlayerEntity p_213189_1_) void
sendMessage
(ITextComponent p_145747_1_, UUID p_145747_2_) void
setDefaultGameType
(GameType p_71235_1_) void
setDemo
(boolean p_71204_1_) void
setDifficulty
(Difficulty p_147139_1_, boolean p_147139_2_) void
setDifficultyLocked
(boolean p_213209_1_) void
setEnforceWhitelist
(boolean p_205741_1_) void
setFlightAllowed
(boolean p_71245_1_) void
setForceGameType
(boolean p_104055_1_) protected void
private static void
setInitialSpawn
(ServerWorld p_240786_0_, IServerWorldInfo p_240786_1_, boolean p_240786_2_, boolean p_240786_3_, boolean p_240786_4_) void
setLocalIp
(String p_71189_1_) void
setMaxBuildHeight
(int p_71191_1_) void
void
setPlayerIdleTimeout
(int p_143006_1_) void
setPlayerList
(PlayerList p_184105_1_) void
setPort
(int p_71208_1_) void
setPreventProxyConnections
(boolean p_190517_1_) void
setPvpAllowed
(boolean p_71188_1_) void
setResourcePack
(String p_180507_1_, String p_180507_2_) void
setSingleplayerName
(String p_71224_1_) private void
setupDebugLevel
(IServerConfiguration p_240778_1_) void
setUsesAuthentication
(boolean p_71229_1_) abstract boolean
protected boolean
shouldRun
(TickDelayedTask p_212874_1_) static <S extends MinecraftServer>
Sprivate void
startProfilerTick
(LongTickDetector p_240773_1_) void
protected void
protected void
tickChildren
(BooleanSupplier p_71190_1_) protected void
tickServer
(BooleanSupplier p_71217_1_) private void
private void
updateStatusIcon
(ServerStatusResponse p_184107_1_) boolean
protected void
protected TickDelayedTask
wrapRunnable
(Runnable p_212875_1_) Methods inherited from class net.minecraft.util.concurrent.RecursiveEventLoop
runningTask
Methods inherited from class net.minecraft.util.concurrent.ThreadTaskExecutor
dropAllTasks, execute, executeBlocking, getPendingTasksCount, isSameThread, managedBlock, name, runAllTasks, submit, submit, submitAsync, tell, waitForTasks
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minecraft.command.ICommandSource
shouldInformAdmins
Methods inherited from interface net.minecraft.util.concurrent.ITaskExecutor
ask, askEither
-
Field Details
-
LOGGER
private static final org.apache.logging.log4j.Logger LOGGER -
USERID_CACHE_FILE
-
DEMO_SETTINGS
-
storageSource
-
playerDataStorage
-
snooper
-
tickables
-
continousProfiler
-
profiler
-
connection
-
progressListenerFactory
-
status
-
random
-
fixerUpper
private final com.mojang.datafixers.DataFixer fixerUpper -
localIp
-
port
private int port -
registryHolder
-
levels
-
playerList
-
running
private volatile boolean running -
stopped
private boolean stopped -
tickCount
private int tickCount -
proxy
-
onlineMode
private boolean onlineMode -
preventProxyConnections
private boolean preventProxyConnections -
pvp
private boolean pvp -
allowFlight
private boolean allowFlight -
motd
-
maxBuildHeight
private int maxBuildHeight -
playerIdleTimeout
private int playerIdleTimeout -
tickTimes
public final long[] tickTimes -
keyPair
-
singleplayerName
-
isDemo
private boolean isDemo -
resourcePack
-
resourcePackHash
-
isReady
private volatile boolean isReady -
lastOverloadWarning
private long lastOverloadWarning -
delayProfilerStart
private boolean delayProfilerStart -
forceGameType
private boolean forceGameType -
sessionService
private final com.mojang.authlib.minecraft.MinecraftSessionService sessionService -
profileRepository
private final com.mojang.authlib.GameProfileRepository profileRepository -
profileCache
-
lastServerStatus
private long lastServerStatus -
serverThread
-
nextTickTime
protected long nextTickTime -
delayedTasksMaxNextTickTime
private long delayedTasksMaxNextTickTime -
mayHaveDelayedTasks
private boolean mayHaveDelayedTasks -
hasWorldScreenshot
private boolean hasWorldScreenshot -
packRepository
-
scoreboard
-
commandStorage
-
customBossEvents
-
functionManager
-
frameTimer
-
enforceWhitelist
private boolean enforceWhitelist -
averageTickTime
private float averageTickTime -
executor
-
serverId
-
resources
-
structureManager
-
worldData
-
perWorldTickTimes
-
worldArrayMarker
private int worldArrayMarker -
worldArrayLast
private int worldArrayLast -
worldArray
-
-
Constructor Details
-
MinecraftServer
public MinecraftServer(Thread p_i232576_1_, DynamicRegistries.Impl p_i232576_2_, SaveFormat.LevelSave p_i232576_3_, IServerConfiguration p_i232576_4_, ResourcePackList p_i232576_5_, Proxy p_i232576_6_, com.mojang.datafixers.DataFixer p_i232576_7_, DataPackRegistries p_i232576_8_, com.mojang.authlib.minecraft.MinecraftSessionService p_i232576_9_, com.mojang.authlib.GameProfileRepository p_i232576_10_, PlayerProfileCache p_i232576_11_, IChunkStatusListenerFactory p_i232576_12_)
-
-
Method Details
-
spin
-
readScoreboard
-
initServer
- Throws:
IOException
-
convertFromRegionFormatIfNeeded
-
loadLevel
protected void loadLevel() -
forceDifficulty
protected void forceDifficulty() -
createLevels
-
setInitialSpawn
private static void setInitialSpawn(ServerWorld p_240786_0_, IServerWorldInfo p_240786_1_, boolean p_240786_2_, boolean p_240786_3_, boolean p_240786_4_) -
setupDebugLevel
-
prepareLevels
-
detectBundledResources
protected void detectBundledResources() -
getDefaultGameType
-
isHardcore
public boolean isHardcore() -
getOperatorUserPermissionLevel
public abstract int getOperatorUserPermissionLevel() -
getFunctionCompilationLevel
public abstract int getFunctionCompilationLevel() -
shouldRconBroadcast
public abstract boolean shouldRconBroadcast() -
saveAllChunks
public boolean saveAllChunks(boolean p_213211_1_, boolean p_213211_2_, boolean p_213211_3_) -
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceITaskExecutor<TickDelayedTask>
-
stopServer
protected void stopServer() -
getLocalIp
-
setLocalIp
-
isRunning
public boolean isRunning() -
halt
public void halt(boolean p_71263_1_) -
runServer
protected void runServer() -
haveTime
private boolean haveTime() -
waitUntilNextTick
protected void waitUntilNextTick() -
wrapRunnable
- Specified by:
wrapRunnable
in classThreadTaskExecutor<TickDelayedTask>
-
shouldRun
- Specified by:
shouldRun
in classThreadTaskExecutor<TickDelayedTask>
-
pollTask
public boolean pollTask()- Overrides:
pollTask
in classThreadTaskExecutor<TickDelayedTask>
-
pollTaskInternal
private boolean pollTaskInternal() -
doRunTask
- Overrides:
doRunTask
in classRecursiveEventLoop<TickDelayedTask>
-
updateStatusIcon
-
hasWorldScreenshot
public boolean hasWorldScreenshot() -
getWorldScreenshotFile
-
getServerDirectory
-
onServerCrash
-
onServerExit
protected void onServerExit() -
tickServer
-
tickChildren
-
isNetherEnabled
public boolean isNetherEnabled() -
addTickable
-
setId
-
isShutdown
public boolean isShutdown() -
getFile
-
overworld
-
getLevel
-
levelKeys
-
getAllLevels
-
getServerVersion
-
getPlayerCount
public int getPlayerCount() -
getMaxPlayers
public int getMaxPlayers() -
getPlayerNames
-
getServerModName
-
fillReport
-
getModdedStatus
-
sendMessage
- Specified by:
sendMessage
in interfaceICommandSource
-
getKeyPair
-
getPort
public int getPort() -
setPort
public void setPort(int p_71208_1_) -
getSingleplayerName
-
setSingleplayerName
-
isSingleplayer
public boolean isSingleplayer() -
initializeKeyPair
protected void initializeKeyPair() -
setDifficulty
-
getScaledTrackingDistance
public int getScaledTrackingDistance(int p_230512_1_) -
updateMobSpawningFlags
private void updateMobSpawningFlags() -
setDifficultyLocked
public void setDifficultyLocked(boolean p_213209_1_) -
sendDifficultyUpdate
-
isSpawningMonsters
protected boolean isSpawningMonsters() -
isDemo
public boolean isDemo() -
setDemo
public void setDemo(boolean p_71204_1_) -
getResourcePack
-
getResourcePackHash
-
setResourcePack
-
populateSnooper
- Specified by:
populateSnooper
in interfaceISnooperInfo
-
isDedicatedServer
public abstract boolean isDedicatedServer() -
getRateLimitPacketsPerSecond
public abstract int getRateLimitPacketsPerSecond() -
usesAuthentication
public boolean usesAuthentication() -
setUsesAuthentication
public void setUsesAuthentication(boolean p_71229_1_) -
getPreventProxyConnections
public boolean getPreventProxyConnections() -
setPreventProxyConnections
public void setPreventProxyConnections(boolean p_190517_1_) -
isSpawningAnimals
public boolean isSpawningAnimals() -
areNpcsEnabled
public boolean areNpcsEnabled() -
isEpollEnabled
public abstract boolean isEpollEnabled() -
isPvpAllowed
public boolean isPvpAllowed() -
setPvpAllowed
public void setPvpAllowed(boolean p_71188_1_) -
isFlightAllowed
public boolean isFlightAllowed() -
setFlightAllowed
public void setFlightAllowed(boolean p_71245_1_) -
isCommandBlockEnabled
public abstract boolean isCommandBlockEnabled() -
getMotd
-
setMotd
-
getMaxBuildHeight
public int getMaxBuildHeight() -
setMaxBuildHeight
public void setMaxBuildHeight(int p_71191_1_) -
isStopped
public boolean isStopped() -
getPlayerList
-
setPlayerList
-
isPublished
public abstract boolean isPublished() -
setDefaultGameType
-
getConnection
-
isReady
public boolean isReady() -
hasGui
public boolean hasGui() -
publishServer
-
getTickCount
public int getTickCount() -
getSnooper
-
getSpawnProtectionRadius
public int getSpawnProtectionRadius() -
isUnderSpawnProtection
public boolean isUnderSpawnProtection(ServerWorld p_175579_1_, BlockPos p_175579_2_, PlayerEntity p_175579_3_) -
setForceGameType
public void setForceGameType(boolean p_104055_1_) -
getForceGameType
public boolean getForceGameType() -
repliesToStatus
public boolean repliesToStatus() -
getPlayerIdleTimeout
public int getPlayerIdleTimeout() -
setPlayerIdleTimeout
public void setPlayerIdleTimeout(int p_143006_1_) -
getSessionService
public com.mojang.authlib.minecraft.MinecraftSessionService getSessionService() -
getProfileRepository
public com.mojang.authlib.GameProfileRepository getProfileRepository() -
getProfileCache
-
getStatus
-
invalidateStatus
public void invalidateStatus() -
getAbsoluteMaxWorldSize
public int getAbsoluteMaxWorldSize() -
scheduleExecutables
public boolean scheduleExecutables()- Overrides:
scheduleExecutables
in classRecursiveEventLoop<TickDelayedTask>
-
getRunningThread
- Specified by:
getRunningThread
in classThreadTaskExecutor<TickDelayedTask>
-
getCompressionThreshold
public int getCompressionThreshold() -
getNextTickTime
public long getNextTickTime() -
getFixerUpper
public com.mojang.datafixers.DataFixer getFixerUpper() -
getSpawnRadius
-
getAdvancements
-
getFunctions
-
reloadResources
-
configurePackRepository
public static DatapackCodec configurePackRepository(ResourcePackList p_240772_0_, DatapackCodec p_240772_1_, boolean p_240772_2_) -
getSelectedPacks
-
kickUnlistedPlayers
-
getPackRepository
-
getCommands
-
createCommandSourceStack
-
acceptsSuccess
public boolean acceptsSuccess()- Specified by:
acceptsSuccess
in interfaceICommandSource
-
acceptsFailure
public boolean acceptsFailure()- Specified by:
acceptsFailure
in interfaceICommandSource
-
getRecipeManager
-
getTags
-
getScoreboard
-
getCommandStorage
-
getLootTables
-
getPredicateManager
-
getGameRules
-
getCustomBossEvents
-
isEnforceWhitelist
public boolean isEnforceWhitelist() -
setEnforceWhitelist
public void setEnforceWhitelist(boolean p_205741_1_) -
getAverageTickTime
public float getAverageTickTime() -
getProfilePermissions
public int getProfilePermissions(com.mojang.authlib.GameProfile p_211833_1_) -
getFrameTimer
-
getProfiler
-
isSingleplayerOwner
public abstract boolean isSingleplayerOwner(com.mojang.authlib.GameProfile p_213199_1_) -
getTickTime
-
forgeGetWorldMap
Deprecated. -
markWorldsDirty
Deprecated. -
getWorldArray
-
saveDebugReport
- Throws:
IOException
-
dumpMiscStats
- Throws:
IOException
-
dumpCrashCategory
- Throws:
IOException
-
dumpGameRules
- Throws:
IOException
-
dumpClasspath
- Throws:
IOException
-
dumpThreads
- Throws:
IOException
-
startProfilerTick
-
endProfilerTick
-
isProfiling
public boolean isProfiling() -
startProfiling
public void startProfiling() -
finishProfiling
-
getWorldPath
-
forceSynchronousWrites
public boolean forceSynchronousWrites() -
getStructureManager
-
getWorldData
-
getDataPackRegistries
-
registryAccess
-
createTextFilterForPlayer
-