Skip to main content

API Reference

Complete reference for the SigmaToolsAPI interface.

SigmaToolsAPI Methodsโ€‹

MethodReturnsDescription
isSigmaTool(ItemStack item)booleanChecks if an item is a SigmaTool
getToolType(ItemStack item)Optional<String>Tool type: "pickaxe", "axe", "bucket", "hoe"; empty if not a SigmaTool
getToolId(ItemStack item)Optional<String>Tool ID (currently same as tool type)
canUseHere(Player player, Location location)booleanProtection check - can the player use tools at this location
getActiveCurrency()String"vault", "coins", or default currency if economy disabled
getBalance(Player player)EconomyResultPlayer's economy balance
deduct(Player player, double amount)EconomyResultDeducts currency; success()=false with message()="insufficient" if funds are short
reward(Player player, double amount)EconomyResultGives currency to a player
getAvailableToolTypes()Set<String>["pickaxe", "axe", "bucket", "hoe"]
getToolConfig(String toolType)Map<String, Object>Tool's config section; empty map if toolType is invalid
getVersion()StringSigmaTools version, e.g. "1.0.3"
Optional<String> toolType = api.getToolType(itemStack);
EconomyResult result = api.deduct(player, 10.0);
if (result.success()) {
double newBalance = result.balanceAfter();
} else {
String reason = result.message(); // "insufficient"
}
Map<String, Object> config = api.getToolConfig("pickaxe");
Integer maxCharges = (Integer) ((Map<String, Object>) config.get("cooldown")).get("max-charges");

EconomyResultโ€‹

Immutable result object returned by all economy methods.

MethodReturnsDescription
success()booleanWhether the operation succeeded
amount()doubleAmount involved in the operation
balanceBefore()doubleBalance before the operation
balanceAfter()doubleBalance after the operation
currency()StringCurrency used
message()String"ok", "insufficient", "economy unavailable", or "failed"

Error Handlingโ€‹

  • Null/invalid parameters return safe defaults (empty Optional, false, empty map) - never throw.
  • Economy unavailable returns EconomyResult with success() = false.
  • Plugin not loaded: Bukkit.getServicesManager().load() returns null - always null-check before use.

See Alsoโ€‹