net.minecraft.server
Class MinecraftServer

java.lang.Object
  extended by net.minecraft.server.MinecraftServer
All Implemented Interfaces:
Runnable, ICommandSender, IPlayerUsage
Direct Known Subclasses:
DedicatedServer, IntegratedServer

public abstract class MinecraftServer
extends Object
implements Runnable, IPlayerUsage, ICommandSender


Field Summary
 String currentTask
          The task the server is currently working on(and will output on outputPercentRemaining).
static Logger logger
          The logging system.
 int percentDone
          The percentage of the current task finished so far.
 long[] recievedPacketCountArray
           
 long[] recievedPacketSizeArray
           
 long[] sentPacketCountArray
           
 long[] sentPacketSizeArray
           
 int spawnProtectionSize
           
 Profiler theProfiler
           
 WorldServer[] theWorldServer
          The server world instances.
 long[] tickTimeArray
           
 List<WorldServer> worlds
          stats are [dimension][tick%100] system.nanoTime is stored.
 Hashtable<Integer,long[]> worldTickTimes
           
 
Constructor Summary
MinecraftServer(File par1File)
           
 
Method Summary
 CrashReport addServerInfoToCrashReport(CrashReport par1CrashReport)
          iterates the worldServers and adds their info also
 void addServerStatsToSnooper(PlayerUsageSnooper par1PlayerUsageSnooper)
           
 void addServerTypeToSnooper(PlayerUsageSnooper par1PlayerUsageSnooper)
           
 void addToOnlinePlayerList(IUpdatePlayerListBox par1IUpdatePlayerListBox)
           
 boolean canCommandSenderUseCommand(String par1Str)
          Returns true if the command sender is allowed to use the given command.
 void canCreateBonusChest(boolean par1)
           
abstract  boolean canStructuresSpawn()
           
 void deleteWorldAndStopServer()
          WARNING : directly calls getActiveAnvilConverter().deleteWorldDirectory(dimensionServerList[0].getSaveHandler().getSaveDirectoryName());
 boolean doLogInfoEvent()
           
 void enableProfiling()
           
 String executeCommand(String par1Str)
           
static void fmlReentry(ArgsWrapper wrap)
           
static ServerConfigurationManager func_71196_a(MinecraftServer par0MinecraftServer)
           
 PlayerUsageSnooper func_80003_ah()
           
 ISaveFormat getActiveAnvilConverter()
           
 boolean getAllowNether()
           
 String[] getAllUsernames()
           
 int getBuildLimit()
           
 boolean getCanNPCsSpawn()
           
 boolean getCanSpawnAnimals()
           
 ICommandManager getCommandManager()
           
 String getCommandSenderName()
          Gets the name of this command sender (usually username, but possibly "Rcon")
 ServerConfigurationManager getConfigurationManager()
           
abstract  int getDifficulty()
          defaults to "1" for the dedicated server
 File getFile(String par1Str)
          Returns a File object from the specified string.
 String getFolderName()
           
abstract  EnumGameType getGameType()
           
 boolean getGuiEnabled()
           
 String getHostname()
           
 String getHostName()
           
 void getHostName(String par1Str)
           
 KeyPair getKeyPair()
          Gets KeyPair instanced in MinecraftServer.
 int getMaxPlayers()
           
 String getMinecraftVersion()
           
 String getMOTD()
           
 int getMyServerPort()
          never used.
abstract  NetworkListenThread getNetworkThread()
           
 int getPlayerListSize()
           
 List getPossibleCompletions(ICommandSender par1ICommandSender, String par2Str)
          if par2 begins with / then it searches for commands, otherwise it returns users
static MinecraftServer getServer()
          Gets mcServer.
 String getServerModName()
           
 String getServerMOTD()
          minecraftServer.getMOTD is used in 2 places instead (it is a non-virtual function which returns the same thing)
 String getServerOwner()
          Returns the username of the server owner (for integrated servers)
 int getServerPort()
          Gets serverPort.
 String getTexturePack()
           
 int getTickCounter()
           
 String getUserMessage()
           
 String getWorldName()
           
abstract  boolean isDedicatedServer()
           
 boolean isDemo()
          Gets whether this is a demo or not.
 boolean isFlightAllowed()
           
abstract  boolean isHardcore()
          defaults to false
 boolean isPVPEnabled()
           
 boolean isServerInOnlineMode()
           
 boolean isServerRunning()
           
 boolean isServerStopped()
           
 boolean isSinglePlayer()
           
 boolean isSnooperEnabled()
          Returns whether snooping is enabled or not.
 void logInfoEvent(String par1Str)
           
 void logInfoMessage(String par1Str)
           
 void logSevereEvent(String par1Str)
           
 void logWarningMessage(String par1Str)
           
static void main(String[] par0ArrayOfStr)
           
 String returnAnEmptyString()
          rename this when a patch comes out which uses it
 void run()
           
 void sendChatToPlayer(String par1Str)
           
 boolean serverIsInRunLoop()
           
 void setAllowFlight(boolean par1)
           
 void setAllowPvp(boolean par1)
           
 void setBuildLimit(int par1)
           
 void setConfigurationManager(ServerConfigurationManager par1ServerConfigurationManager)
           
 void setDemo(boolean par1)
          Sets whether this is a demo or not.
 void setDifficultyForAllDimensions(int par1)
           
 void setFolderName(String par1Str)
           
 void setGameType(EnumGameType par1EnumGameType)
          sets the game type for all dimensions
 void setKeyPair(KeyPair par1KeyPair)
           
 void setMOTD(String par1Str)
           
 void setOnlineMode(boolean par1)
           
 void setServerOwner(String par1Str)
          Sets the username of the owner of this server (in the case of an integrated server)
 void setServerPort(int par1)
           
 void setServerStopping()
          sets serverRunning to false
 void setSpawnAnimals(boolean par1)
           
 void setSpawnNpcs(boolean par1)
           
 void setTexturePack(String par1Str)
           
 void setWorldName(String par1Str)
           
abstract  String shareToLAN(EnumGameType var1, boolean var2)
          does nothing on dedicated.
 void startServerThread()
           
 void stopServer()
          Saves all necessary data as preparation for stopping the server.
 int textureFlag()
          this is checked to be 16 on reception of the packet, and the packet is ignored otherwise
 void tick()
          main function called by run() every loop
 String translateString(String par1Str, Object... par2ArrayOfObj)
          Translates and formats the given string key with the given arguments.
 void updateTimeLightAndEntities()
           
 WorldServer worldServerForDimension(int par1)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

public static Logger logger
The logging system.


theProfiler

public final Profiler theProfiler

theWorldServer

public WorldServer[] theWorldServer
The server world instances.


currentTask

public String currentTask
The task the server is currently working on(and will output on outputPercentRemaining).


percentDone

public int percentDone
The percentage of the current task finished so far.


sentPacketCountArray

public final long[] sentPacketCountArray

sentPacketSizeArray

public final long[] sentPacketSizeArray

recievedPacketCountArray

public final long[] recievedPacketCountArray

recievedPacketSizeArray

public final long[] recievedPacketSizeArray

tickTimeArray

public final long[] tickTimeArray

worlds

public List<WorldServer> worlds
stats are [dimension][tick%100] system.nanoTime is stored.


worldTickTimes

public Hashtable<Integer,long[]> worldTickTimes

spawnProtectionSize

public int spawnProtectionSize
Constructor Detail

MinecraftServer

public MinecraftServer(File par1File)
Method Detail

getUserMessage

public String getUserMessage()

canStructuresSpawn

public abstract boolean canStructuresSpawn()

getGameType

public abstract EnumGameType getGameType()

getDifficulty

public abstract int getDifficulty()
defaults to "1" for the dedicated server


isHardcore

public abstract boolean isHardcore()
defaults to false


stopServer

public void stopServer()
Saves all necessary data as preparation for stopping the server.


getHostname

public String getHostname()

getHostName

public void getHostName(String par1Str)

isServerRunning

public boolean isServerRunning()

setServerStopping

public void setServerStopping()
sets serverRunning to false


run

public void run()
Specified by:
run in interface Runnable

tick

public void tick()
main function called by run() every loop


updateTimeLightAndEntities

public void updateTimeLightAndEntities()

getAllowNether

public boolean getAllowNether()

startServerThread

public void startServerThread()

getFile

public File getFile(String par1Str)
Returns a File object from the specified string.


logInfoMessage

public void logInfoMessage(String par1Str)

logWarningMessage

public void logWarningMessage(String par1Str)

worldServerForDimension

public WorldServer worldServerForDimension(int par1)

addToOnlinePlayerList

public void addToOnlinePlayerList(IUpdatePlayerListBox par1IUpdatePlayerListBox)

getHostName

public String getHostName()

getMyServerPort

public int getMyServerPort()
never used. Can not be called "getServerPort" is already taken


getServerMOTD

public String getServerMOTD()
minecraftServer.getMOTD is used in 2 places instead (it is a non-virtual function which returns the same thing)


getMinecraftVersion

public String getMinecraftVersion()

getPlayerListSize

public int getPlayerListSize()

getMaxPlayers

public int getMaxPlayers()

getAllUsernames

public String[] getAllUsernames()

returnAnEmptyString

public String returnAnEmptyString()
rename this when a patch comes out which uses it


executeCommand

public String executeCommand(String par1Str)

doLogInfoEvent

public boolean doLogInfoEvent()

logSevereEvent

public void logSevereEvent(String par1Str)

logInfoEvent

public void logInfoEvent(String par1Str)

getServerModName

public String getServerModName()

addServerInfoToCrashReport

public CrashReport addServerInfoToCrashReport(CrashReport par1CrashReport)
iterates the worldServers and adds their info also


getPossibleCompletions

public List getPossibleCompletions(ICommandSender par1ICommandSender,
                                   String par2Str)
if par2 begins with / then it searches for commands, otherwise it returns users


getServer

public static MinecraftServer getServer()
Gets mcServer.


getCommandSenderName

public String getCommandSenderName()
Gets the name of this command sender (usually username, but possibly "Rcon")

Specified by:
getCommandSenderName in interface ICommandSender

sendChatToPlayer

public void sendChatToPlayer(String par1Str)
Specified by:
sendChatToPlayer in interface ICommandSender

canCommandSenderUseCommand

public boolean canCommandSenderUseCommand(String par1Str)
Returns true if the command sender is allowed to use the given command.

Specified by:
canCommandSenderUseCommand in interface ICommandSender

translateString

public String translateString(String par1Str,
                              Object... par2ArrayOfObj)
Translates and formats the given string key with the given arguments.

Specified by:
translateString in interface ICommandSender

getCommandManager

public ICommandManager getCommandManager()

getKeyPair

public KeyPair getKeyPair()
Gets KeyPair instanced in MinecraftServer.


getServerPort

public int getServerPort()
Gets serverPort.


setServerPort

public void setServerPort(int par1)

getServerOwner

public String getServerOwner()
Returns the username of the server owner (for integrated servers)


setServerOwner

public void setServerOwner(String par1Str)
Sets the username of the owner of this server (in the case of an integrated server)


isSinglePlayer

public boolean isSinglePlayer()

getFolderName

public String getFolderName()

setFolderName

public void setFolderName(String par1Str)

setWorldName

public void setWorldName(String par1Str)

getWorldName

public String getWorldName()

setKeyPair

public void setKeyPair(KeyPair par1KeyPair)

setDifficultyForAllDimensions

public void setDifficultyForAllDimensions(int par1)

isDemo

public boolean isDemo()
Gets whether this is a demo or not.


setDemo

public void setDemo(boolean par1)
Sets whether this is a demo or not.


canCreateBonusChest

public void canCreateBonusChest(boolean par1)

getActiveAnvilConverter

public ISaveFormat getActiveAnvilConverter()

deleteWorldAndStopServer

public void deleteWorldAndStopServer()
WARNING : directly calls getActiveAnvilConverter().deleteWorldDirectory(dimensionServerList[0].getSaveHandler().getSaveDirectoryName());


getTexturePack

public String getTexturePack()

setTexturePack

public void setTexturePack(String par1Str)

addServerStatsToSnooper

public void addServerStatsToSnooper(PlayerUsageSnooper par1PlayerUsageSnooper)
Specified by:
addServerStatsToSnooper in interface IPlayerUsage

addServerTypeToSnooper

public void addServerTypeToSnooper(PlayerUsageSnooper par1PlayerUsageSnooper)
Specified by:
addServerTypeToSnooper in interface IPlayerUsage

isSnooperEnabled

public boolean isSnooperEnabled()
Returns whether snooping is enabled or not.

Specified by:
isSnooperEnabled in interface IPlayerUsage

textureFlag

public int textureFlag()
this is checked to be 16 on reception of the packet, and the packet is ignored otherwise


isDedicatedServer

public abstract boolean isDedicatedServer()

isServerInOnlineMode

public boolean isServerInOnlineMode()

setOnlineMode

public void setOnlineMode(boolean par1)

getCanSpawnAnimals

public boolean getCanSpawnAnimals()

setSpawnAnimals

public void setSpawnAnimals(boolean par1)

getCanNPCsSpawn

public boolean getCanNPCsSpawn()

setSpawnNpcs

public void setSpawnNpcs(boolean par1)

isPVPEnabled

public boolean isPVPEnabled()

setAllowPvp

public void setAllowPvp(boolean par1)

isFlightAllowed

public boolean isFlightAllowed()

setAllowFlight

public void setAllowFlight(boolean par1)

getMOTD

public String getMOTD()

setMOTD

public void setMOTD(String par1Str)

getBuildLimit

public int getBuildLimit()

setBuildLimit

public void setBuildLimit(int par1)

isServerStopped

public boolean isServerStopped()

getConfigurationManager

public ServerConfigurationManager getConfigurationManager()

setConfigurationManager

public void setConfigurationManager(ServerConfigurationManager par1ServerConfigurationManager)

setGameType

public void setGameType(EnumGameType par1EnumGameType)
sets the game type for all dimensions


getNetworkThread

public abstract NetworkListenThread getNetworkThread()

serverIsInRunLoop

public boolean serverIsInRunLoop()

getGuiEnabled

public boolean getGuiEnabled()

shareToLAN

public abstract String shareToLAN(EnumGameType var1,
                                  boolean var2)
does nothing on dedicated. on integrated, sets commandsAllowedForAll and gameType and allows external connections


getTickCounter

public int getTickCounter()

enableProfiling

public void enableProfiling()

func_80003_ah

public PlayerUsageSnooper func_80003_ah()

func_71196_a

public static ServerConfigurationManager func_71196_a(MinecraftServer par0MinecraftServer)

main

public static void main(String[] par0ArrayOfStr)

fmlReentry

public static void fmlReentry(ArgsWrapper wrap)