net.minecraft.world.storage
Class SaveHandler

java.lang.Object
  extended by net.minecraft.world.storage.SaveHandler
All Implemented Interfaces:
IPlayerFileData, ISaveHandler
Direct Known Subclasses:
AnvilSaveHandler

public class SaveHandler
extends Object
implements ISaveHandler, IPlayerFileData


Constructor Summary
SaveHandler(File par1File, String par2Str, boolean par3)
           
 
Method Summary
 void checkSessionLock()
          Checks the session lock to prevent save collisions
 void flush()
          Called to flush all changes to disk, waiting for them to complete.
 String[] getAvailablePlayerDat()
          Returns an array of usernames for which player.dat exists for.
 IChunkLoader getChunkLoader(WorldProvider par1WorldProvider)
          Returns the chunk loader with the provided world provider
 File getMapFileFromName(String par1Str)
          Gets the file location of the given map
 NBTTagCompound getPlayerData(String par1Str)
          Gets the player data for the given playername as a NBTTagCompound.
 File getSaveDirectory()
          gets the File object corresponding to the base directory of this save (saves/404 for a save called 404 etc)
 String getSaveDirectoryName()
          Returns the name of the directory where world information is saved.
 IPlayerFileData getSaveHandler()
          returns null if no saveHandler is relevent (eg.
 WorldInfo loadWorldInfo()
          Loads and returns the world info
 void readPlayerData(EntityPlayer par1EntityPlayer)
          Reads the player data from disk into the specified PlayerEntityMP.
 void saveWorldInfo(WorldInfo par1WorldInfo)
          Saves the passed in world info.
 void saveWorldInfoWithPlayer(WorldInfo par1WorldInfo, NBTTagCompound par2NBTTagCompound)
          Saves the given World Info with the given NBTTagCompound as the Player.
 void writePlayerData(EntityPlayer par1EntityPlayer)
          Writes the player data to disk from the specified PlayerEntityMP.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SaveHandler

public SaveHandler(File par1File,
                   String par2Str,
                   boolean par3)
Method Detail

getSaveDirectory

public File getSaveDirectory()
gets the File object corresponding to the base directory of this save (saves/404 for a save called 404 etc)


checkSessionLock

public void checkSessionLock()
                      throws MinecraftException
Checks the session lock to prevent save collisions

Specified by:
checkSessionLock in interface ISaveHandler
Throws:
MinecraftException

getChunkLoader

public IChunkLoader getChunkLoader(WorldProvider par1WorldProvider)
Returns the chunk loader with the provided world provider

Specified by:
getChunkLoader in interface ISaveHandler

loadWorldInfo

public WorldInfo loadWorldInfo()
Loads and returns the world info

Specified by:
loadWorldInfo in interface ISaveHandler

saveWorldInfoWithPlayer

public void saveWorldInfoWithPlayer(WorldInfo par1WorldInfo,
                                    NBTTagCompound par2NBTTagCompound)
Saves the given World Info with the given NBTTagCompound as the Player.

Specified by:
saveWorldInfoWithPlayer in interface ISaveHandler

saveWorldInfo

public void saveWorldInfo(WorldInfo par1WorldInfo)
Saves the passed in world info.

Specified by:
saveWorldInfo in interface ISaveHandler

writePlayerData

public void writePlayerData(EntityPlayer par1EntityPlayer)
Writes the player data to disk from the specified PlayerEntityMP.

Specified by:
writePlayerData in interface IPlayerFileData

readPlayerData

public void readPlayerData(EntityPlayer par1EntityPlayer)
Reads the player data from disk into the specified PlayerEntityMP.

Specified by:
readPlayerData in interface IPlayerFileData

getPlayerData

public NBTTagCompound getPlayerData(String par1Str)
Gets the player data for the given playername as a NBTTagCompound.


getSaveHandler

public IPlayerFileData getSaveHandler()
returns null if no saveHandler is relevent (eg. SMP)

Specified by:
getSaveHandler in interface ISaveHandler

getAvailablePlayerDat

public String[] getAvailablePlayerDat()
Returns an array of usernames for which player.dat exists for.

Specified by:
getAvailablePlayerDat in interface IPlayerFileData

flush

public void flush()
Called to flush all changes to disk, waiting for them to complete.

Specified by:
flush in interface ISaveHandler

getMapFileFromName

public File getMapFileFromName(String par1Str)
Gets the file location of the given map

Specified by:
getMapFileFromName in interface ISaveHandler

getSaveDirectoryName

public String getSaveDirectoryName()
Returns the name of the directory where world information is saved.

Specified by:
getSaveDirectoryName in interface ISaveHandler