Class MinecraftServer

    • Field Detail

      • LOGGER

        private static final org.apache.logging.log4j.Logger LOGGER
      • USERID_CACHE_FILE

        public static final java.io.File USERID_CACHE_FILE
      • playerDataStorage

        protected final PlayerData playerDataStorage
      • snooper

        private final Snooper snooper
      • tickables

        private final java.util.List<java.lang.Runnable> tickables
      • continousProfiler

        private final TimeTracker continousProfiler
      • random

        private final java.util.Random random
      • fixerUpper

        private final com.mojang.datafixers.DataFixer fixerUpper
      • localIp

        private java.lang.String localIp
      • port

        private int port
      • running

        private volatile boolean running
      • stopped

        private boolean stopped
      • tickCount

        private int tickCount
      • proxy

        protected final java.net.Proxy proxy
      • onlineMode

        private boolean onlineMode
      • preventProxyConnections

        private boolean preventProxyConnections
      • pvp

        private boolean pvp
      • allowFlight

        private boolean allowFlight
      • motd

        @Nullable
        private java.lang.String motd
      • maxBuildHeight

        private int maxBuildHeight
      • playerIdleTimeout

        private int playerIdleTimeout
      • tickTimes

        public final long[] tickTimes
      • keyPair

        @Nullable
        private java.security.KeyPair keyPair
      • singleplayerName

        @Nullable
        private java.lang.String singleplayerName
      • isDemo

        private boolean isDemo
      • resourcePack

        private java.lang.String resourcePack
      • resourcePackHash

        private java.lang.String 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
      • lastServerStatus

        private long lastServerStatus
      • serverThread

        private final java.lang.Thread serverThread
      • nextTickTime

        protected long nextTickTime
      • delayedTasksMaxNextTickTime

        private long delayedTasksMaxNextTickTime
      • mayHaveDelayedTasks

        private boolean mayHaveDelayedTasks
      • hasWorldScreenshot

        private boolean hasWorldScreenshot
      • enforceWhitelist

        private boolean enforceWhitelist
      • averageTickTime

        private float averageTickTime
      • executor

        private final java.util.concurrent.Executor executor
      • serverId

        @Nullable
        private java.lang.String serverId
      • perWorldTickTimes

        private java.util.Map<RegistryKey<World>,​long[]> perWorldTickTimes
      • worldArrayMarker

        private int worldArrayMarker
      • worldArrayLast

        private int worldArrayLast
    • Method Detail

      • spin

        public static <S extends MinecraftServer> S spin​(java.util.function.Function<java.lang.Thread,​S> p_240784_0_)
      • initServer

        protected abstract boolean initServer()
                                       throws java.io.IOException
        Throws:
        java.io.IOException
      • convertFromRegionFormatIfNeeded

        public static void convertFromRegionFormatIfNeeded​(SaveFormat.LevelSave p_240777_0_)
      • loadLevel

        protected void loadLevel()
      • forceDifficulty

        protected void forceDifficulty()
      • 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_)
      • detectBundledResources

        protected void detectBundledResources()
      • getDefaultGameType

        public GameType 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_)
      • stopServer

        protected void stopServer()
      • getLocalIp

        public java.lang.String getLocalIp()
      • setLocalIp

        public void setLocalIp​(java.lang.String p_71189_1_)
      • isRunning

        public boolean isRunning()
      • halt

        public void halt​(boolean p_71263_1_)
      • runServer

        protected void runServer()
      • haveTime

        private boolean haveTime()
      • waitUntilNextTick

        protected void waitUntilNextTick()
      • pollTaskInternal

        private boolean pollTaskInternal()
      • hasWorldScreenshot

        public boolean hasWorldScreenshot()
      • getWorldScreenshotFile

        public java.io.File getWorldScreenshotFile()
      • getServerDirectory

        public java.io.File getServerDirectory()
      • onServerCrash

        protected void onServerCrash​(CrashReport p_71228_1_)
      • onServerExit

        protected void onServerExit()
      • tickServer

        protected void tickServer​(java.util.function.BooleanSupplier p_71217_1_)
      • tickChildren

        protected void tickChildren​(java.util.function.BooleanSupplier p_71190_1_)
      • isNetherEnabled

        public boolean isNetherEnabled()
      • addTickable

        public void addTickable​(java.lang.Runnable p_82010_1_)
      • setId

        protected void setId​(java.lang.String p_213208_1_)
      • isShutdown

        public boolean isShutdown()
      • getFile

        public java.io.File getFile​(java.lang.String p_71209_1_)
      • getAllLevels

        public java.lang.Iterable<ServerWorld> getAllLevels()
      • getServerVersion

        public java.lang.String getServerVersion()
      • getPlayerCount

        public int getPlayerCount()
      • getMaxPlayers

        public int getMaxPlayers()
      • getPlayerNames

        public java.lang.String[] getPlayerNames()
      • getServerModName

        public java.lang.String getServerModName()
      • getModdedStatus

        public abstract java.util.Optional<java.lang.String> getModdedStatus()
      • getKeyPair

        public java.security.KeyPair getKeyPair()
      • getPort

        public int getPort()
      • setPort

        public void setPort​(int p_71208_1_)
      • getSingleplayerName

        public java.lang.String getSingleplayerName()
      • setSingleplayerName

        public void setSingleplayerName​(java.lang.String p_71224_1_)
      • isSingleplayer

        public boolean isSingleplayer()
      • initializeKeyPair

        protected void initializeKeyPair()
      • setDifficulty

        public void setDifficulty​(Difficulty p_147139_1_,
                                  boolean p_147139_2_)
      • getScaledTrackingDistance

        public int getScaledTrackingDistance​(int p_230512_1_)
      • updateMobSpawningFlags

        private void updateMobSpawningFlags()
      • setDifficultyLocked

        public void setDifficultyLocked​(boolean p_213209_1_)
      • sendDifficultyUpdate

        private void sendDifficultyUpdate​(ServerPlayerEntity p_213189_1_)
      • isSpawningMonsters

        protected boolean isSpawningMonsters()
      • isDemo

        public boolean isDemo()
      • setDemo

        public void setDemo​(boolean p_71204_1_)
      • getResourcePack

        public java.lang.String getResourcePack()
      • getResourcePackHash

        public java.lang.String getResourcePackHash()
      • setResourcePack

        public void setResourcePack​(java.lang.String p_180507_1_,
                                    java.lang.String p_180507_2_)
      • 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

        public java.lang.String getMotd()
      • setMotd

        public void setMotd​(java.lang.String p_71205_1_)
      • getMaxBuildHeight

        public int getMaxBuildHeight()
      • setMaxBuildHeight

        public void setMaxBuildHeight​(int p_71191_1_)
      • isStopped

        public boolean isStopped()
      • getPlayerList

        public PlayerList getPlayerList()
      • setPlayerList

        public void setPlayerList​(PlayerList p_184105_1_)
      • isPublished

        public abstract boolean isPublished()
      • setDefaultGameType

        public void setDefaultGameType​(GameType p_71235_1_)
      • isReady

        public boolean isReady()
      • hasGui

        public boolean hasGui()
      • publishServer

        public abstract boolean publishServer​(GameType p_195565_1_,
                                              boolean p_195565_2_,
                                              int p_195565_3_)
      • getTickCount

        public int getTickCount()
      • getSnooper

        public Snooper getSnooper()
      • getSpawnProtectionRadius

        public int getSpawnProtectionRadius()
      • 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()
      • invalidateStatus

        public void invalidateStatus()
      • getAbsoluteMaxWorldSize

        public int getAbsoluteMaxWorldSize()
      • getCompressionThreshold

        public int getCompressionThreshold()
      • getNextTickTime

        public long getNextTickTime()
      • getFixerUpper

        public com.mojang.datafixers.DataFixer getFixerUpper()
      • getSpawnRadius

        public int getSpawnRadius​(@Nullable
                                  ServerWorld p_184108_1_)
      • reloadResources

        public java.util.concurrent.CompletableFuture<java.lang.Void> reloadResources​(java.util.Collection<java.lang.String> p_240780_1_)
      • kickUnlistedPlayers

        public void kickUnlistedPlayers​(CommandSource p_205743_1_)
      • getCommands

        public Commands getCommands()
      • createCommandSourceStack

        public CommandSource createCommandSourceStack()
      • getGameRules

        public GameRules getGameRules()
      • 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

        public FrameTimer getFrameTimer()
      • getProfiler

        public IProfiler getProfiler()
      • isSingleplayerOwner

        public abstract boolean isSingleplayerOwner​(com.mojang.authlib.GameProfile p_213199_1_)
      • markWorldsDirty

        @Deprecated
        public void markWorldsDirty()
        Deprecated.
      • getWorldArray

        private ServerWorld[] getWorldArray()
      • saveDebugReport

        public void saveDebugReport​(java.nio.file.Path p_223711_1_)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • dumpMiscStats

        private void dumpMiscStats​(java.nio.file.Path p_223710_1_)
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • dumpCrashCategory

        private void dumpCrashCategory​(java.nio.file.Path p_223709_1_)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • dumpGameRules

        private void dumpGameRules​(java.nio.file.Path p_223708_1_)
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • dumpClasspath

        private void dumpClasspath​(java.nio.file.Path p_223706_1_)
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • dumpThreads

        private void dumpThreads​(java.nio.file.Path p_223712_1_)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • startProfilerTick

        private void startProfilerTick​(@Nullable
                                       LongTickDetector p_240773_1_)
      • endProfilerTick

        private void endProfilerTick​(@Nullable
                                     LongTickDetector p_240795_1_)
      • isProfiling

        public boolean isProfiling()
      • startProfiling

        public void startProfiling()
      • getWorldPath

        public java.nio.file.Path getWorldPath​(FolderName p_240776_1_)
      • forceSynchronousWrites

        public boolean forceSynchronousWrites()