LiteLDev/LeviLamina

[Bug]: Canceling an event

LordBombardir opened this issue · 0 comments

Describe the bug

Canceling the PlayerInteractBlockEvent event does not work.

To Reproduce

Create a listener for the PlayerInteractBlockEvent and cancel it.

Expected behavior

Preventing chest opening/lever switching

Screenshots

I'm sending a video instead of screenshots:
https://youtu.be/KjJDRPgbhmY

Platform

Windows 11

Version

0.12.3

Additional context

My code

// here is the logic of event handling
void EventListener::onPlayerInteractBlock(ll::event::PlayerInteractBlockEvent& event) {
    ServerPlayer& player = event.self();

    if (manager::Manager::isPlayerUnauthorized(player.getRealName())) {
        player.sendMessage(
            "§f(§bАвторизация§f) Для того, чтобы взаимодействовать с блоками, Вам §bнеобходимо авторизоваться§f!"
        );

        event.cancel();
        return;
    }
}