Package com.stardevllc.starhomes
Class StarHomes
java.lang.Object
com.stardevllc.starhomes.StarHomes
Main class for the StarHomes logic.
This class must be initialized by a plugin by calling the init(ExtendedJavaPlugin) method
This also has pretty much all logic needed for homes for the most part.
The homes are stored in an ObservableMap with UUIDs for the keys and an ObservableList for the homes list
Using the observable map and list allow for the ability to listen for when things are changed and removed at will
This also allows you to modify the homes as well, use with caution
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordRecord for the delete home action informationstatic enumStatus enum for delete home actionsstatic final recordRecord for the information relatled to renaming a homestatic enumStatus enum for rename actionsstatic final recordRecord for the return info when using set homestatic enumStatus enum for the Set Home actions -
Method Summary
Modifier and TypeMethodDescriptionstatic StarHomes.DeleteHomeInfodeleteHome(UUID owner, String name) Deletes a home based on provided valuesstatic StarHomes.DeleteHomeInfodeleteHome(UUID owner, String name, com.stardevllc.starmclib.actors.Actor actor) Deletes a home based on provided valuesGets a home based on an owner and a namestatic com.stardevllc.starlib.observable.collections.map.ObservableMap<UUID, com.stardevllc.starlib.observable.collections.list.ObservableList<Home>> getHomes()Gets a mapping of all homes to their ownersstatic com.stardevllc.starlib.observable.collections.list.ObservableList<Home> Gets all homes for a home ownerstatic voidinit(com.stardevllc.starmclib.plugin.ExtendedJavaPlugin plugin) Initalilzes StarHomesstatic voidLoads all homes from storagestatic com.stardevllc.starlib.observable.collections.list.ObservableList<Home> Loads all homes for a home ownerstatic StarHomes.RenameHomeInforenameHome(UUID owner, String oldName, String newName) Renames a home with provided informationstatic StarHomes.RenameHomeInforenameHome(UUID owner, String oldName, String newName, com.stardevllc.starmclib.actors.Actor actor) Renames a home with provided informationstatic voidSaves all homes to storagestatic voidsaveHomes(UUID owner, com.stardevllc.starlib.observable.collections.list.ObservableList<Home> homes, com.stardevllc.config.Section section) Saves all homes for an ownerstatic StarHomes.SetHomeInfoSets a home with provided information.static StarHomes.SetHomeInfosetHome(UUID owner, String name, org.bukkit.Location location, com.stardevllc.starmclib.actors.Actor actor) Sets a home with provided information
-
Method Details
-
init
public static void init(com.stardevllc.starmclib.plugin.ExtendedJavaPlugin plugin) Initalilzes StarHomes- Parameters:
plugin- The holder plugin
-
loadHomes
public static void loadHomes()Loads all homes from storage- Throws:
IllegalArgumentException- If the storage mode from the config if it is invalid
-
loadHomes
public static com.stardevllc.starlib.observable.collections.list.ObservableList<Home> loadHomes(UUID owner, com.stardevllc.config.Section section) Loads all homes for a home owner- Parameters:
owner- The owner to load from (Needed for home instantiation)section- The config section that contains the homes- Returns:
- The ObservableList of all loaded homes
-
saveHomes
public static void saveHomes()Saves all homes to storage- Throws:
IllegalArgumentException- If the storage mode from the config is invalid
-
saveHomes
public static void saveHomes(UUID owner, com.stardevllc.starlib.observable.collections.list.ObservableList<Home> homes, com.stardevllc.config.Section section) Saves all homes for an owner- Parameters:
owner- The owner of the homeshomes- The list of homes to savesection- The section to save the homes in
-
getHomes
public static com.stardevllc.starlib.observable.collections.map.ObservableMap<UUID,com.stardevllc.starlib.observable.collections.list.ObservableList<Home>> getHomes()Gets a mapping of all homes to their owners- Returns:
- The ObservableMap of homes and uuids
-
getHomes
public static com.stardevllc.starlib.observable.collections.list.ObservableList<Home> getHomes(UUID owner) Gets all homes for a home owner- Parameters:
owner- The owner- Returns:
- The list of homes for that owner
-
getHome
Gets a home based on an owner and a name- Parameters:
owner- The ownername- The name (case-insensitive)- Returns:
- An optional that is null if a home does not exist, or the home if found
-
setHome
Sets a home with provided information.- Parameters:
owner- The owner of the homename- The name for the homelocation- The location where the home is set- Returns:
- The information regarding the action
-
setHome
public static StarHomes.SetHomeInfo setHome(UUID owner, String name, org.bukkit.Location location, com.stardevllc.starmclib.actors.Actor actor) Sets a home with provided information- Parameters:
owner- The owner of the homename- The name for the homelocation- The location where the home is setactor- The actor that performed the action (Can be null)- Returns:
- The information regarding the action
-
deleteHome
Deletes a home based on provided values- Parameters:
owner- The owner of the homename- The name of the home (case-insensitive)- Returns:
- The action information
-
deleteHome
public static StarHomes.DeleteHomeInfo deleteHome(UUID owner, String name, com.stardevllc.starmclib.actors.Actor actor) Deletes a home based on provided values- Parameters:
owner- The owner of the homename- The name of the home (case-insensitive)actor- The Actor that performed the action (can be null)- Returns:
- The action information
-
renameHome
public static StarHomes.RenameHomeInfo renameHome(UUID owner, String oldName, String newName, com.stardevllc.starmclib.actors.Actor actor) Renames a home with provided information- Parameters:
owner- The owner of the homeoldName- The old name of the home (This might get changed in the info if a home was found and differs in case)newName- The new name for the homeactor- The actor the performed the action- Returns:
- The information related to the action
-
renameHome
Renames a home with provided information- Parameters:
owner- The owner of the homeoldName- The old name of the home (This might get changed in the info if a home was found and differs in case)newName- The new name for the home- Returns:
- Th e information related to the action
-