-
Notifications
You must be signed in to change notification settings - Fork 3
Creating Custom Placeholders
Daniel Norris edited this page Jan 7, 2022
·
6 revisions
Add the follow to your build.gradle:
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
compileOnly 'com.github.Pixelmon-Development.ForgePlaceholderAPI:api:2.0.0'
}The repository allows you to add the dependency directly from jitpack. Ensure to replace the version tag (2.0.0) with the latest release from this repository.
Upon adding the dependency you will then be able to extend the AbstractPlaceholderManager interface like so:
public class ForgePlaceholders extends AbstractPlaceholderManager<EntityPlayerMP> {
private static final String IDENTIFIER = "forge";
private static final String[] AUTHORS = new String[] { "Envyful" };
private static final String VERSION = "2.0.0";
private static final String NAME = "forge";
public ForgePlaceholders() {
super(IDENTIFIER, AUTHORS, VERSION, NAME);
// this.registerPlaceholder(new NameExtension());
}
}Once this interface is registered it will add the registered extension as a placeholder under this manager.
In order for your Placeholders to be registered place your jar file inside the mods/ForgePlaceholderAPI/ directory on your server.
Alternatively, you can register the placeholder directly using the method PlaceholderFactory#register