API
Add UltimateAirdrops to your project
Maven:
<repositories>
<repository>
<id>gitlab-maven</id>
<url>https://gitlab.com/api/v4/projects/34899751/packages/maven</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>es.keyset</groupId>
<artifactId>ultimateairdrops</artifactId>
<version>1.0.3</version>
<scope>provided</scope>
</dependency>
</dependencies>
Gradle:
repositories {
maven("https://gitlab.com/api/v4/projects/34899751/packages/maven")
}
dependencies {
compileOnly("es.keyset:ultimateairdrops:1.0.3")
}
Common uses
Access API methods
UltimateAirdropsAPI api = UltimateAirdropsAPI.getInstance();
Register a custom property
UltimateAirdropsAPI api = UltimateAirdropsAPI.getInstance();
// Instances the property type instance with its id, type and default value.
DefaultPropertyType<String> customProperty = new DefaultPropertyType<>("custom-property", String.class, () -> "my default value");
// Instances the button to interact with the property value for each airdrop type.
TextInputButton<String> customPropertyButton = new TextInputButton<>(
new ItemStack(Material.ACACIA_LEAVES),
"Custom Property",
new String[]{"This is my custom property"},
customProperty,
"Enter your value",
String.class,
".*"
);
// Sets the button supplier for our custom property to the one we created.
customProperty.setButtonSupplier(() -> customPropertyButton);
// Registers the instanced property type in the API
api.registerPropertyType(customProperty);
Get a property value for a designed airdrop
// Get an airdrop instance
Airdrop airdrop = Airdrop.getAirdrop(0);
String value = airdrop.getProperty("custom-property");
Javadoc
All the API classes are documented in the javadoc.