public class SaveHandler extends java.lang.Object implements ISaveHandler, IPlayerFileData
Modifier and Type | Field and Description |
---|---|
private long |
initializationTime
The time in milliseconds when this field was initialized.
|
private static org.apache.logging.log4j.Logger |
logger |
private java.io.File |
mapDataDir |
private java.io.File |
playersDirectory
The directory in which to save player data.
|
private java.lang.String |
saveDirectoryName
The directory name of the world
|
private java.io.File |
worldDirectory
The directory in which to save world data.
|
Constructor and Description |
---|
SaveHandler(java.io.File savesDirectory,
java.lang.String directoryName,
boolean playersDirectoryIn) |
Modifier and Type | Method and Description |
---|---|
void |
checkSessionLock()
Checks the session lock to prevent save collisions
|
void |
flush()
Called to flush all changes to disk, waiting for them to complete.
|
java.lang.String[] |
getAvailablePlayerDat()
Returns an array of usernames for which player.dat exists for.
|
IChunkLoader |
getChunkLoader(WorldProvider provider)
initializes and returns the chunk loader for the specified world provider
|
java.io.File |
getMapFileFromName(java.lang.String mapName)
Gets the file location of the given map
|
IPlayerFileData |
getPlayerNBTManager() |
java.io.File |
getWorldDirectory()
Gets the File object corresponding to the base directory of this world.
|
java.lang.String |
getWorldDirectoryName()
Returns the name of the directory where world information is saved.
|
WorldInfo |
loadWorldInfo()
Loads and returns the world info
|
NBTTagCompound |
readPlayerData(EntityPlayer player)
Reads the player data from disk into the specified PlayerEntityMP.
|
void |
saveWorldInfo(WorldInfo worldInformation)
used to update level.dat from old format to MCRegion format
|
void |
saveWorldInfoWithPlayer(WorldInfo worldInformation,
NBTTagCompound tagCompound)
Saves the given World Info with the given NBTTagCompound as the Player.
|
private void |
setSessionLock()
Creates a session lock file for this process
|
void |
writePlayerData(EntityPlayer player)
Writes the player data to disk from the specified PlayerEntityMP.
|
private static final org.apache.logging.log4j.Logger logger
private final java.io.File worldDirectory
private final java.io.File playersDirectory
private final java.io.File mapDataDir
private final long initializationTime
private final java.lang.String saveDirectoryName
public SaveHandler(java.io.File savesDirectory, java.lang.String directoryName, boolean playersDirectoryIn)
private void setSessionLock()
public java.io.File getWorldDirectory()
getWorldDirectory
in interface ISaveHandler
public void checkSessionLock() throws MinecraftException
checkSessionLock
in interface ISaveHandler
MinecraftException
public IChunkLoader getChunkLoader(WorldProvider provider)
getChunkLoader
in interface ISaveHandler
public WorldInfo loadWorldInfo()
loadWorldInfo
in interface ISaveHandler
public void saveWorldInfoWithPlayer(WorldInfo worldInformation, NBTTagCompound tagCompound)
saveWorldInfoWithPlayer
in interface ISaveHandler
public void saveWorldInfo(WorldInfo worldInformation)
saveWorldInfo
in interface ISaveHandler
public void writePlayerData(EntityPlayer player)
writePlayerData
in interface IPlayerFileData
public NBTTagCompound readPlayerData(EntityPlayer player)
readPlayerData
in interface IPlayerFileData
public IPlayerFileData getPlayerNBTManager()
getPlayerNBTManager
in interface ISaveHandler
public java.lang.String[] getAvailablePlayerDat()
getAvailablePlayerDat
in interface IPlayerFileData
public void flush()
flush
in interface ISaveHandler
public java.io.File getMapFileFromName(java.lang.String mapName)
getMapFileFromName
in interface ISaveHandler
public java.lang.String getWorldDirectoryName()
getWorldDirectoryName
in interface ISaveHandler