Developer API

Interacting with the Hoes persistant data.

// Get harvester by player object.
Harvester harvester = Harvesters.getInstance().getByPlayer(Player);

// Get all harvesters on server.
List<Harvester> allHarvesters = Harvesters.getInstance().getAllHarvesters();

// Get raw cane harvested by a player.
double cane = harvester.getRawCane();

// Add raw cane harvested to a player.
harvester.addCaneRaw(int amount);

if (harvester.hasTokens(1000)) { }

// Event that is called whenever a player harvests a block.
@EventHandler
public void onPlayerHarvest(CaneHarvestEvent e) {
  e.setCancelled(true);
}

Enchantment API

Implemented in SupremeHoes Version 2.4.4

Creating an enchantment.

public class ExampleExternalEnchant extends Enchant {

    public ExampleExternalEnchant() {
        // Enchantment name, Enchant Priority
        super("Example Enchant", 100);
        // Set the max level of the enchant
        this.maxLevel = 1000; 
        // Set the default itemstack used for the enchants menu
        this.baseItem = new ItemStack(Material.AIR, 1);
        // Integer level, Double cost
        this.costUpgradeMap = new LinkedHashMap<>();
    }

    @Override
    public void perform(HarvestContext e) {
        // This is called when your enchant is up to process the HarvestContext
        // & make changes
    }
    
    @Override
    public String getLoreString(int x) {
        // Override the getLoreString to your config.
        // If you are using the hoes config to store your enchant info you don't need to override
        return "";
    }

    @Override
    public int getSlot() {
        // Override the getSlot to your config.
        // If you are using the hoes config to store your enchant info you don't need to override
        return -1;
    }

}

Registering your enchantment.

Enchants.getInstance().addEnchant(new ExampleExternalEnchant());

Last updated