> For the complete documentation index, see [llms.txt](https://mossuh.gitbook.io/projects/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mossuh.gitbook.io/projects/plugins/mopets/api.md).

# API

## Main Class:&#x20;

```
PetsAPI
```

## Events

### PetChangeExpEvent

Called whenever a pet gains experience.

```java
// This event is cancellable

@EventHandler
public petEvent(PetChangeExpEvent event) {
    UUID uuid = event.getUUID(); // The player uuid
    Pet pet = event.getPet(); // The pet who receive the exp.
    
    // Shows if the exp was received by NATURAL, REWARDS or COMMAND.
    ExecuteType execute = event.getExecuteType();
    // Shows if the exp was setted (SET) or added (ADD).
    ReceiveType receive = event.getReceiveType();
    
    double exp = event.getExp();
    event.setExp(double exp);
    event.addExp(double exp);
}
```

### PetChangeLevelEvent

Called whenever a pet changes level

```java
// This event is cancellable

@EventHandler
public petEvent(PetChangeLevelEvent event) {
    UUID uuid = event.getUUID(); // The player uuid
    Pet pet = event.getPet(); // The pet who receive the exp.
    
    // Shows if the level was received by NATURAL, REWARDS or COMMAND.
    ExecuteType execute = event.getExecuteType();
    // Shows if the level was setted (SET) or added (ADD).
    ReceiveType receive = event.getReceiveType();
    
    int level = event.getLevel();
    event.setLevel(int level);
    event.addLevel(int level);
}
```

### PlayerChangePetEvent

Called whenever a player changes their active pet.

```java
// This event is not cancellable

@EventHandler
public petEvent(PlayerChangePetEvent event) {
    UUID uuid = event.getUUID(); // The player uuid
    Pet pet = event.getPet(); // The pet who receive the exp.
    
    // Show it the changed pet was ACTIVATED or DEACTIVATED
    ChangePetType change = event.getChangePetType();
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://mossuh.gitbook.io/projects/plugins/mopets/api.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
