Creating Custom TaxType
Creating a Custom Tax Type for TheNewEconomy
Overview
What is a Tax Type?
Registration
TNECore.eco().transaction().addTax(new CustomTaxType());Steps to Create a Custom Tax Type
Step 1: Implement the TaxType Interface
TaxType Interfaceimport net.tnemc.core.transaction.tax.TaxType;
import java.math.BigDecimal;
public class CustomFlatTaxType implements TaxType {
@Override
public String name() {
return "custom_flat";
}
@Override
public String asString(final BigDecimal tax) {
return tax.toPlainString();
}
@Override
public BigDecimal handleTaxation(final BigDecimal amount, final BigDecimal tax) {
// Returns the tax as a flat value
return tax;
}
}Step 2: Register the Custom Tax Type
Example: Default Tax Types in TNE
FlatType
PercentileType
Key Methods in TaxType
TaxTypeMethod
Description
Notes
Last updated
Was this helpful?