Developer API

Interacting with the Hoes persistant data.

1
// Get harvester by player object.
2
Harvester harvester = Harvesters.getInstance().getByPlayer(Player);
3
4
// Get all harvesters on server.
5
List<Harvester> allHarvesters = Harvesters.getInstance().getAllHarvesters();
6
7
// Get raw cane harvested by a player.
8
double cane = harvester.getRawCane();
9
10
// Add raw cane harvested to a player.
11
harvester.addCaneRaw(int amount);
12
13
if (harvester.hasTokens(1000)) { }
14
15
// Event that is called whenever a player harvests a block.
16
@EventHandler
17
public void onPlayerHarvest(CaneHarvestEvent e) {
18
e.setCancelled(true);
19
}
Copied!

Enchantment API

Implemented in SupremeHoes Version 2.4.4

Creating an enchantment.

1
public class ExampleExternalEnchant extends Enchant {
2
3
public ExampleExternalEnchant() {
4
// Enchantment name, Enchant Priority
5
super("Example Enchant", 100);
6
// Set the max level of the enchant
7
this.maxLevel = 1000;
8
// Set the default itemstack used for the enchants menu
9
this.baseItem = new ItemStack(Material.AIR, 1);
10
// Integer level, Double cost
11
this.costUpgradeMap = new LinkedHashMap<>();
12
}
13
14
@Override
15
public void perform(HarvestContext e) {
16
// This is called when your enchant is up to process the HarvestContext
17
// & make changes
18
}
19
20
@Override
21
public String getLoreString(int x) {
22
// Override the getLoreString to your config.
23
// If you are using the hoes config to store your enchant info you don't need to override
24
return "";
25
}
26
27
@Override
28
public int getSlot() {
29
// Override the getSlot to your config.
30
// If you are using the hoes config to store your enchant info you don't need to override
31
return -1;
32
}
33
34
}
Copied!

Registering your enchantment.

1
Enchants.getInstance().addEnchant(new ExampleExternalEnchant());
Copied!
Last modified 7mo ago