PlayerInteractLib
Adds PlayerInteractionEvent for default camera view as an alternative to PlayerInteractEvent, PlayerMouseButtonEvent and SwitchActiveSlotEvent
Описание
Игрок InteractLib
Игрок InteractLib Это легкая серверная библиотека, которая восстанавливает недостающее событие взаимодействия с игроком в API Hytale Server.
Вводится полностью рабочий Игровое взаимодействие Событиекоторый служит заменой нефункциональному или отсутствующему Игровой интерфейс Событие В текущем API.
Это событие позволяет плагинам реагировать на Реальные взаимодействия игроков с миром, блоками и предметами.
Библиотека предназначена для использования в качестве зависимость другими серверными плагинами и модами, не требующими каких-либо модификаций внутренних серверов.
Для владельцев серверов
Если вы владелец сервера, просто Вставить этот мод в мод папка.
Конфигурация или настройка не требуется.
Для разработчиков плагинов
PlayerInteractLib раскрывает события взаимодействия игроков через реактивный поток событий ()SubmissionИздатель), позволяя плагинам подписываться и асинхронно реагировать на действия игрока.
Особенности
- Добавить недостающее
Игровое взаимодействие СобытиеСерверный API - Обеспечивает надежное обнаружение взаимодействия игроков
- Поддерживает взаимодействие с блоками, предметами и миром
- Включает личность игрока и информацию о предмете в руке
- Асинхронная, неблокирующая доставка событий (Java Flow API)
- Легкий вес и зависимость (без логики геймплея)
Как использовать
1. Добавьте библиотеку в свой проект Создайте папку libs в своем проекте и разместите библиотеку. внутри него:
корень проекта/
─ libs/
↑ PlayerInteractLib.jar
- Построить. град
Примерная структура:

2. Добавить зависимость в строить. град
Зависимости (файл реализации) Дерево (dir: 'libs', включает в себя: ['*.jar'])
3. Объявить зависимость в manifest.json Добавьте библиотеку в зависимости от вашего плагина manifest.json:
"Зависимости": { "Hytale:PlayerInteractLib": "*" }
Игровое взаимодействие Данные о событиях
Публичная запись PlayerInteractionEvent
Взаимодействие Тип взаимодействия Тип,
Струнный uuid,
струнный элементInHandId,
Синхронизация Цепное взаимодействие
) {}
Доступная информация
Игрок UUID
Идентифицирует игрока, выполняющего взаимодействие.
Тип взаимодействия ()Взаимодействие Тип)
Определяет вид действия (например, первичное/вторичное взаимодействие).
Пункт в руках
Идентификатор предмета, используемого в настоящее время игроком (может быть нулевой).
Взаимодействие контекст ()Синхронизация цепь)
Содержит контекстные данные, связанные с взаимодействием, такие как:
* состояние взаимодействия
* идентификатор цепи взаимодействия
• метаданные о мире или блоке взаимодействия
Низкоуровневые сетевые и протокольные данные намеренно скрыты, чтобы API был простым и удобным для плагинов.
Пример использования
PlayerInteractLib =
(PlayerInteractLib) PluginManager.get()
.getPlugin(PluginIdentifier.fromString("Hytale:PlayerInteractLib"));
SubmissionPublisher<PlayerInteractionEvent> publisher = lib.getPublisher();
publisher.subscribe (новый Flow.Subscriber) {
@Override
Публичная пустота на подписке (Flow.Subscription subscription)
subscription.request (Long.MAX_VALUE);
?
@Override
Public Void onNext (взаимодействие игроков) Событие {
String uuid = event.getUuid();
вар взаимодействие Тип = event.getInteractionType();
Имя пользователя: Universe.get()
.getPlayer(UUID.fromString(uuid))
.getUsername();
System.out.println (имя пользователя + "выполняемый" + interactionType);
?
@Override public void onError(Throwable t)
@Override public void onComplete()
}
Случаи обычного использования
- Системы защиты регионов
- Пользовательский блок или поведение элемента
- Механика, основанная на взаимодействии
- Антикоррупционная или разрешительная проверка
- Журналирование действий игрока и аналитика
i️ Заметки
- События проводятся асинхронно
- Плагины, изменяющие мировое состояние, должны обеспечивать правильную синхронизацию
- Эта библиотека предназначена для использования строго как зависимость.
Если вы находите это полезным, почувствуйте себя свободным и
Показать оригинальное описание (English)
PlayerInteractLib
PlayerInteractLib is a lightweight server-side library that restores a missing player interaction event in the Hytale Server API.
It introduces a fully working PlayerInteractionEvent, which acts as a replacement for the non-functional or missing PlayerInteractEvent in the current API.
This event allows plugins to react to real player interactions with the world, blocks, and items.
The library is designed to be used as a dependency by other server plugins and mods, without requiring any modification of server internals.
👑 For Server Owners
If you are a server owner, simply drop this mod into the mods folder.
No configuration or setup is required.
🧩 For Plugin Developers
PlayerInteractLib exposes player interaction events through a reactive event stream (SubmissionPublisher), allowing plugins to subscribe and react asynchronously to player actions.
✨ Features
- Adds a missing
PlayerInteractionEventto the server API - Provides reliable player interaction detection
- Supports interactions with blocks, items, and the world
- Includes player identity and item-in-hand information
- Asynchronous, non-blocking event delivery (Java Flow API)
- Lightweight and dependency-only (no gameplay logic)
How to Use
1. Add the library to your project Create a libs folder in your project and place the library .jar inside it:
project-root/
├─ libs/
│ └─ PlayerInteractLib.jar
└─ build.gradle
Example structure:

2. Add dependency in build.gradle
dependencies { implementation fileTree(dir: 'libs', includes: ['*.jar']) }
3. Declare dependency in manifest.json Add the library as a dependency in your plugin’s manifest.json:
"Dependencies": { "Hytale:PlayerInteractLib": "*" }
📦 PlayerInteractionEvent Data
public record PlayerInteractionEvent(
InteractionType interactionType,
String uuid,
String itemInHandId,
SyncInteractionChain interaction
) {}
Available information
Player UUID
Identifies the player performing the interaction.
Interaction Type (InteractionType)
Determines the kind of action (e.g. primary / secondary interaction).
Item in Hand
The ID of the item currently used by the player (may be null).
Interaction Context (SyncInteractionChain)
Contains contextual data related to the interaction, such as:
* interaction state
* interaction chain identifier
* world or block interaction metadata
Low-level networking and protocol details are intentionally hidden to keep the API simple and plugin-friendly.
Example usage
PlayerInteractLib lib =
(PlayerInteractLib) PluginManager.get()
.getPlugin(PluginIdentifier.fromString("Hytale:PlayerInteractLib"));
SubmissionPublisher<PlayerInteractionEvent> publisher = lib.getPublisher();
publisher.subscribe(new Flow.Subscriber<>() {
@Override
public void onSubscribe(Flow.Subscription subscription) {
subscription.request(Long.MAX_VALUE);
}
@Override
public void onNext(PlayerInteractionEvent event) {
String uuid = event.getUuid();
var interactionType = event.getInteractionType();
String username = Universe.get()
.getPlayer(UUID.fromString(uuid))
.getUsername();
System.out.println(username + " performed " + interactionType);
}
@Override public void onError(Throwable t) {}
@Override public void onComplete() {}
});
🧠 Common Use Cases
- Region protection systems
- Custom block or item behavior
- Interaction-based mechanics
- Anti-grief or permission checks
- Player action logging and analytics
ℹ️ Notes
- Events are delivered asynchronously
- Plugins modifying world state should ensure proper synchronization
- This library is intended to be used strictly as a dependency
