Setting Up Custom Events

Adding Events to your HytaleMetrics allows for tracking key actions for each plugins.
Examples of actions include money, team, tutorial.

1. Basic Examples

- The Command syntax required for custom events:
/hytalemetrics customevent {player/uuid} {key} {key1=value1...}

- Setting Steve's quest_progress to include a quest_name and reward:
/hytalemetrics customevent Steve quest_progress quest_name="Welcome Tutorial" reward=1000

- Deleting quest_progress from Steve:
/hytalemetrics customevent Steve quest_progress delete=true

- Setting Johns's economy to include include current money assets:
/hytalemetrics customevent Steve economy in_hand=250 bank=1000

2. Multiple Key/Value within a key

- Players can have multiple keys, examples above "quest_progress" and "economy" will display as two cards.
- If you run a command for a player that already has that key, the values will be updated to your new values.
- If you require a string, wrap it within quotes such as quest_name="Welcome Tutorial".
- You can delete a key at anytime by using delete=true

3. Send Custom Events via API

import net.hytalemetrics.api.MetricsAPI;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

// Send a custom event
UUID playerUuid = player.getUniqueId();
String eventKey = "quest_completed";

Map customData = new HashMap<>();
customData.put("quest_name", "Dragon Slayer");
customData.put("reward", "1000");
customData.put("difficulty", "hard");

MetricsAPI.sendCustomEvent(playerUuid, eventKey, customData);