Class FlatFileLocationsManager
java.lang.Object
com.sk89q.commandbook.component.locations.FlatFileLocationsManager
- All Implemented Interfaces:
LocationManager<NamedLocation>
public class FlatFileLocationsManager extends java.lang.Object implements LocationManager<NamedLocation>
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFlatFileLocationsManager.LocationsFactory -
Constructor Summary
Constructors Constructor Description FlatFileLocationsManager(java.io.File file, java.lang.String type)Construct the manager. -
Method Summary
Modifier and Type Method Description voidcastWorld(org.bukkit.World world)Set this manager to be for one world only.NamedLocationcreate(java.lang.String id, org.bukkit.Location loc, org.bukkit.entity.Player player)Create a location.NamedLocationget(java.lang.String id)Get by name.java.util.List<NamedLocation>getLocations()Gets all the locations that this location manager has.voidload()Load from file.booleanremove(java.lang.String id)Removes a location.voidsave()Save to file.voidupdateWorlds()Updates warps from unloaded worlds.
-
Constructor Details
-
FlatFileLocationsManager
public FlatFileLocationsManager(java.io.File file, java.lang.String type)Construct the manager.- Parameters:
file- The file locations are stored intype- The name for the type of location being loaded
-
-
Method Details
-
castWorld
public void castWorld(org.bukkit.World world)Description copied from interface:LocationManagerSet this manager to be for one world only.- Specified by:
castWorldin interfaceLocationManager<NamedLocation>- Parameters:
world- The world to use
-
load
public void load() throws java.io.IOExceptionDescription copied from interface:LocationManagerLoad from file.- Specified by:
loadin interfaceLocationManager<NamedLocation>- Throws:
java.io.IOException- when an error occurs during IO
-
save
public void save() throws java.io.IOExceptionDescription copied from interface:LocationManagerSave to file.- Specified by:
savein interfaceLocationManager<NamedLocation>- Throws:
java.io.IOException- when an error occurs during IO
-
updateWorlds
public void updateWorlds()Description copied from interface:LocationManagerUpdates warps from unloaded worlds.- Specified by:
updateWorldsin interfaceLocationManager<NamedLocation>
-
get
Description copied from interface:LocationManagerGet by name.- Specified by:
getin interfaceLocationManager<NamedLocation>- Parameters:
id- The name to get- Returns:
- The
LocationManagerif registered
-
remove
public boolean remove(java.lang.String id)Description copied from interface:LocationManagerRemoves a location.- Specified by:
removein interfaceLocationManager<NamedLocation>- Parameters:
id- The id to remove- Returns:
- whether it was removed
-
getLocations
Description copied from interface:LocationManagerGets all the locations that this location manager has.- Specified by:
getLocationsin interfaceLocationManager<NamedLocation>- Returns:
- This location manager's locations.
-
create
public NamedLocation create(java.lang.String id, org.bukkit.Location loc, org.bukkit.entity.Player player)Description copied from interface:LocationManagerCreate a location.- Specified by:
createin interfaceLocationManager<NamedLocation>- Parameters:
id- The name of the locationloc- The locationplayer- The player to own the location- Returns:
- The created location
-