Skip to content

PlayerCraftEvent

DEPRECATED (forRemoval=true) — This event is deprecated and scheduled for removal. Use CraftRecipeEvent (ECS event) instead.

Package: com.hypixel.hytale.server.core.event.events.player Extends: PlayerEvent<String> Implements: IEvent<String> Cancellable: No Key type: String

Dispatched after a player crafts an item using a crafting recipe. This event is deprecated with forRemoval=true, meaning it will be removed in a future version. The ECS-based CraftRecipeEvent is the intended replacement.

This event cannot be cancelled — it fires after the crafting operation has completed.

Because the key type is String, this event is dispatched with a keyed dispatch.

FieldTypeAccessorMutableNotes
playerRefRef<EntityStore>getPlayerRef()NoECS reference to the player entity. Inherited from PlayerEvent.
playerPlayergetPlayer()NoThe player who crafted the item. Inherited from PlayerEvent.
craftedRecipeCraftingRecipegetCraftedRecipe()NoThe recipe that was crafted.
quantityintgetQuantity()NoThe number of items produced by the crafting operation.
  • CraftingManager.craft() (line 194) via eventBus.dispatchFor() — dispatched after a crafting operation completes successfully. This is a post-craft notification.
// DEPRECATED -- use CraftRecipeEvent (ECS event) for new code
getEventRegistry().register(PlayerCraftEvent.class, event -> {
Player player = event.getPlayer();
CraftingRecipe recipe = event.getCraftedRecipe();
int quantity = event.getQuantity();
// Example: log crafting activity
logCraft(player, recipe, quantity);
});

Replace usage of PlayerCraftEvent with the ECS-based CraftRecipeEvent:

// Old (deprecated, will be removed):
getEventRegistry().register(PlayerCraftEvent.class, event -> { ... });
// New (preferred):
// Register an EntityEventSystem<EntityStore, CraftRecipeEvent> instead.
// See CraftRecipeEvent documentation for the ECS event handler pattern.
  • CraftRecipeEvent — the ECS-based replacement for this event. Provides richer context and integrates with the ECS event system.
  • LivingEntityInventoryChangeEvent — fires alongside this event when crafting modifies the player’s inventory.