net.minecraft.world.storage

## Class SaveHandler

- java.lang.Object
- - net.minecraft.world.storage.SaveHandler

- All Implemented Interfaces:
    IPlayerFileData, ISaveHandler
  Direct Known Subclasses:
    AnvilSaveHandler

      public class SaveHandler
      extends Object
      implements ISaveHandler, IPlayerFileData

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SaveHandler(File par1File, String par2Str, boolean par3)`

  - ### Method Summary

    Methods
    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.
    `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.
    `IPlayerFileData` | `getSaveHandler()` returns null if no saveHandler is relevent (eg.
    `File` | `getWorldDirectory()` Gets the File object corresponding to the base directory of this world.
    `String` | `getWorldDirectoryName()` Returns the name of the directory where world information is saved.
    `WorldInfo` | `loadWorldInfo()` Loads and returns the world info
    `NBTTagCompound` | `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

    - #### getWorldDirectory

          public File getWorldDirectory()

      Gets the File object corresponding to the base directory of this world.

    - #### 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 NBTTagCompound 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`

    - #### getWorldDirectoryName

          public String getWorldDirectoryName()

      Returns the name of the directory where world information is saved.
      Specified by:
        `getWorldDirectoryName` in interface `ISaveHandler`