Lead API allows you to hook into the Lead Plugin that allows players to create visual based teams to help distinguish who is in whose team.
- Installing the Lead API
- What's in the Lead API
- Using the Lead API
- Contributing to the Lead API
- Lead API's License
- Donating to help support the Lead API
Lead among other various plugins I have worked on are free to use! Please consider donating to my ko-fi! It helps fund other projects that I am passionate about.
Below shows you how to install Lead API into your project.
Add it in your root build.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add the dependency
dependencies {
implementation 'com.github.Lodestones:Lead:1.0.6'
}
Add the JitPack repository to your build file
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add the dependency
<dependency>
<groupId>com.github.Lodestones</groupId>
<artifactId>Lead</artifactId>
<version>1.0.6</version>
</dependency>
The Lead API gives you two main classes that can help you with custom plugins that may use Lead. ITeam and ITeamMember.
To hook into the Lead API, you can use the LeadHook class.
Hooking into the Lead API.
import to.lodestone.leadapi.LeadAPI;
public class MainPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
public ILeadAPI lead() { // use this method to access the Lead API.
return LeadAPI.getApi(); // Retrieve the Lead API from the Hook.
}
}
Fetching a team based off of a Player's UUID.
Player player = Bukkit.getPlayer("Apollo30");
@Nullable ITeam team = plugin.lead().getTeam(player.getUniqueId());
if (team == null) return; // player doesn't have team.
player.sendMessage(Component.text(String.format("You are in team %s", team.getNumber()))); // "You are in team #45"
Fetching a team based off of the team number.
@Nullable ITeam team = plugin.lead().getTeam(5);
if (team == null) return; // Team doesn't exist.
Bukkit.broadcast(Component.text(String.format("Team %s exists!", team.getNumber()))); // "Team #5 exists!"
See something Lead doesn't support, a bug or something that may be useful? We welcome contributions to improve the Lead API. Open an issue here.
Lead is ARR. Please view the license here.