Creating Custom Account Type
Adding Custom Account Types to TheNewEconomy
Steps to Add Custom Account Types
1. Define Your Custom Account Class
public class NationAccount extends NonPlayerAccount {
public NationAccount(final UUID identifier, final String name) {
super(identifier, name);
this.identifier = identifier;
}
@Override
public String type() {
return "nation";
}
@Override
public UUID generateIdentifier(final String name) {
try {
return Objects.requireNonNull(TownyAPI.getInstance().getNation(name)).getUUID();
} catch (final Exception ignore) {
return super.generateIdentifier(name);
}
}
}2. Implement Account Type Validation
3. Register the Custom Account Types
4. Hook into Plugin Callbacks
Key Points to Remember
Last updated
Was this helpful?