-
Notifications
You must be signed in to change notification settings - Fork 5
API
SirKillian edited this page Oct 9, 2023
·
4 revisions
Before you start using the OxyTowns API, you should ensure that you have:
- Installed OxyTowns: OxyTowns must be properly installed on your Minecraft server.
- Java Development Environment: You will need a Java development environment to write and compile your plugin. Additionally, we target Java 17
-
OxyTowns Dependency: You can find our API artifact on JitPack.
- Group:
com.oxywire
- Artifact:
oxytowns
- Version:
{see releases page}
- Group:
You can listen to our events with the Bukkit event system.
Event | Description |
---|---|
TaxCollectionEvent | Called when taxes and upkeep are collected. |
TownPermissionChangeEvent | Called when a town changes permissions. |
TownPlayerBanEvent | Called when a town bans someone. |
public class MyPlugin extends JavaPlugin implements Listener {
@Override
public void onEnable() {
this.getServer().getPluginManager().registerEvents(this, this);
}
@EventHandler
public void onTownPlayerBan(TownPlayerBanEvent event) {
this.getSLF4JLogger().info("{} was banned from {}", event.getOfflinePlayer().getName(), event.getTown().getName());
}
}
The API surrounding towns are composed of a few pieces. This includes:
- Town: The actual town entity.
- OxyTownsApi: Contains cookbook methods.
- TownCache: Contains methods related to towns.
-
Checking if a player has permissions at an area:
OxyTownsPlugin.get().getOxyTownsApi().hasPermission(Player, Permission, Location)
-
Getting the town a player is in:
OxyTownsPlugin.get().getTownCache().getTownByPlayer(Player)
-
Getting a town at a position:
OxyTownsPlugin.get().getTownCache.getTownByLocation(Location)
Need more help? Join our Discord server for more support!
- [Updates](link to gist)