Class StarHomes

java.lang.Object
com.stardevllc.starhomes.StarHomes

public final class StarHomes extends Object

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

  • 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 homes
      homes - The list of homes to save
      section - 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

      public static Optional<Home> getHome(UUID owner, String name)
      Gets a home based on an owner and a name
      Parameters:
      owner - The owner
      name - The name (case-insensitive)
      Returns:
      An optional that is null if a home does not exist, or the home if found
    • setHome

      public static StarHomes.SetHomeInfo setHome(UUID owner, String name, org.bukkit.Location location)
      Sets a home with provided information.
      Parameters:
      owner - The owner of the home
      name - The name for the home
      location - 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 home
      name - The name for the home
      location - The location where the home is set
      actor - The actor that performed the action (Can be null)
      Returns:
      The information regarding the action
    • deleteHome

      public static StarHomes.DeleteHomeInfo deleteHome(UUID owner, String name)
      Deletes a home based on provided values
      Parameters:
      owner - The owner of the home
      name - 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 home
      name - 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 home
      oldName - 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
      actor - The actor the performed the action
      Returns:
      The information related to the action
    • renameHome

      public static StarHomes.RenameHomeInfo renameHome(UUID owner, String oldName, String newName)
      Renames a home with provided information
      Parameters:
      owner - The owner of the home
      oldName - 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