Skip to content

PlayerInteractEvent

DEPRECATED — This event is deprecated. Use UseBlockEvent (ECS event) for block interactions and PlayerMouseButtonEvent for mouse input handling instead.

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

Previously dispatched when a player interacted with the world. No active instantiation sites exist in the current codebase — this event is retained for backward compatibility but is never fired. It has been replaced by the more specific UseBlockEvent (for block interactions) and PlayerMouseButtonEvent (for input handling).

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

FieldTypeAccessorMutableNotes
playerRefRef<EntityStore>getPlayerRef()NoECS reference to the player entity. Inherited from PlayerEvent.
playerPlayergetPlayer()NoThe player who triggered the interaction. Inherited from PlayerEvent.
actionTypeInteractionTypegetActionType()NoThe type of interaction performed.
clientUseTimelonggetClientUseTime()NoClient-side timestamp of the use action.
itemInHandItemStackgetItemInHand()NoThe item stack the player is holding.
targetBlockVector3igetTargetBlock()NoWorld-space coordinates of the targeted block, if any.
targetRefRef<EntityStore>getTargetRef()NoECS reference to the targeted entity, if any.
targetEntityEntitygetTargetEntity()NoThe targeted entity, if any.

No active dispatch sites found in the current codebase. This event is deprecated and no longer fired by the server.

// DEPRECATED -- do not use in new code
getEventRegistry().register(PlayerInteractEvent.class, event -> {
InteractionType action = event.getActionType();
Player player = event.getPlayer();
// This listener will never fire -- no dispatch sites exist
});

Replace usage of PlayerInteractEvent with the appropriate replacement:

For block interactions — use the ECS-based UseBlockEvent:

// Register an EntityEventSystem<EntityStore, UseBlockEvent> instead.
// See UseBlockEvent documentation for the ECS event handler pattern.

For mouse input handling — use PlayerMouseButtonEvent:

getEventRegistry().register(PlayerMouseButtonEvent.class, event -> {
MouseButtonEvent mouseButton = event.getMouseButton();
Entity target = event.getTargetEntity();
// Handle mouse input
});