-
-
Notifications
You must be signed in to change notification settings - Fork 78
API Examples
William edited this page Sep 2, 2022
·
14 revisions
HuskHomes provides API for getting Home
s and Warp
s, getting UserData
and information about User
s, teleporting OnlineUser
s and letting you provide custom RandomTeleportEngine
s for extending the /rtp command's functionality.
- Unless your plugin completely relies on HuskHomes, you shouldn't put HuskHomes API calls into your main class, otherwise if HuskHomes is not installed you'll encounter
ClassNotFoundException
s
public class HuskHomesAPIHook {
public HuskHomesAPIHook() {
// Ready to do stuff with the API
}
}
- Check to make sure the HuskHomes plugin is present before instantiating the API hook class
public class MyPlugin extends JavaPlugin {
public HuskHomesAPIHook huskHomesAPIHook;
@Override
public void onEnable() {
if (Bukkit.getPluginManager().getPlugin("HuskHomes") != null) {
this.huskHomesAPIHook = new HuskHomesAPIHook();
}
}
}
- You can now get the API instance by calling
HuskHomesAPI#getInstance()
import net.william278.huskhomes.api.HuskHomesAPI;
public class HuskHomesAPIHook {
private final HuskHomesAPI huskHomesAPI;
public HuskHomesAPIHook() {
this.huskHomesAPI = HuskHomesAPI.getInstance();
}
}
This documentation is available via william278.net |
---|
- 📚 Setup
- 📊 Importing Data
- 📄 Config Files
- ⛔ Managing Access
- 🖥️ Commands
- 📜 Command Conflicts
- 📁 Database
- ⛅ Redis Support
- 📝 Translations
- 🟩 Plan Hook
- 🗺️ Map Hooks
- ⏰ Cooldowns
- 💵 Economy Hook
⚠️ Strict Tpahere- 🚫 Restricted Warps
- 🛏️ Global Respawning
- 🌎 Global Spawn
- ✍️ Placeholders
- ⭐ GUI Add-on
- 🕸️ Legacy Migration (v2 → v3)
- 📦 API
- 💻 GitHub
- 📂 Downloads
- 🔧 Modrinth
- 🚰 Spigot
- 🛒 Polymart
- 🛫 Hangar
- 🔥 CurseForge
- 💬 Discord Support