🪛 Developer API

Events

  • PetDeathEvent - Called when pet died.

  • PetReleaseEvent - Called when player is about to release a pet. Cancellable.

  • PetLevelDownEvent - Called when pet's level downgraded.

  • PetLevelUpEvent - Called when pet's level increased.

  • PetCaptureFailureEvent - Called when player fails pet capture.

  • PetCaptureStartEvent - Called when player is about to start capture. Cancellable.

  • PetCaptureSuccessEvent - Called when player captured a pet.

  • PetEscapeCaptureEvent - Called when mob escaped capture.

Accessing Data

// CombatPets instance
PetsPlugin plugin = PetsAPI.plugin;

// Check if entity is a pet
boolean isPet = PetEntityBridge.isPet(LivingEntity entity);

// Get pet from entity
ActivePet activePet = PetEntityBridge.getByMob(LivingEntity entity);
ActivePet activePet = PetEntityBridge.getByPlayer(Player player);
ActivePet activePet = PetEntityBridge.getByMobId(UUID entityId);

// Get all active pets
Collection<ActivePet> pets = PetEntityBridge.getAll();

// User manager.
UserManager userManager = PetsAPI.getUserManager();

// Pet manager.
PetManager petManager = PetsAPI.getPetManager();

// Capture manager. May be null if disabled in the config.
CaptureManager captureManager = PetsAPI.getCaptureManager();

// Leveling manager. May be null if disabled in the config.
LevelingManager levelManager = PetsAPI.getLevelingManager();

// Accessories manager. May be null if disabled in the config.
WardrobeManager wardrobeManager = PetsAPI.getWardrobeManager();

// Shop manager. May be null if disabled in the config.
ShopManager shopManager = PetsAPI.getShopManager();

// Get user data.
PetUser user = userManager.getUserData(Player player);
PetUser user = userManager.getUserData(UUID playerId);
PetUser user = userManager.getUserData(String playerName);

Last updated