Skip to content

Block unrealistic interactions to avoid getting items from gui #22

@Tuchan

Description

@Tuchan

Currently, if we use any interaction not including LEFT and RIGHT click, we can essentially get items from the inventory. This probably isn't an intended behavior, but it would be good to add that as a boolean nonetheless.

private boolean blockDefaultInteractions = true;

Such as: blockUnrealisticInteractions(?), which defaults to true, since 99% of interactions will be handled with either left or right click.

Than it's probably just a case of:

if(clickedGui.areUnrealisticInteractionsBlocked()){
    event.setCancelled(true);
}

You can already achieve the same behavior without that change, but it would be helpful nonetheless:

...
).withListener((InventoryClickEvent e) -> {
    if(e.getClick() == ClickType.LEFT){
        //left click stuff
    } else if (e.getClick() == ClickType.RIGHT) {
        //right click stuff
    } else {
        e.setCancelled(true);
    }
})

Would've made a PR but I would rather give that someone who actually knows what they're doing lmao

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingenhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions