Create a home:
Code (Text):
Home home = new Home("myHome", plugin);
"myHome" would be the name of the home and
plugin would be your Plugin instance. This example will be used in the documentation for code examples.
Note, that the name of the home is actually just the file path. The default location is the plugins data folder.
For example, if I were to have a folder called "homes" in my plugins data folder, I could save my home called "myHome" in this folder using "homes/myHome" as the name.
- Setting the Owner:
Code (Text):
home.setOwner(player);
- Setting the Location:
Code (Text):
home.setLocation(location);
Don't forget to save when creating a new home / when making changes to it:
Code (Text):
home.save();
Check if a home exists:
Create a HomeManager instance.
Code (Text):
HomeManager manager = new HomeManager();
Check if a home exists by doing:
Code (Text):
manager.checkForHome("myHome", plugin);
This returns true or false.
Get an existing home:
Create a HomeManager instance.
Code (Text):
HomeManager manager = new HomeManager();
Get a home by doing:
Code (Text):
manager.getHomeByName("myHome", plugin);
This returns the home;
Delete a home:
Create a HomeManager instance.
Code (Text):
HomeManager manager = new HomeManager();
Delete the home by doing:
Code (Text):
manager.deleteHome("myHome", plugin);