KaiKikuchi / QuickShop

A shop plugin for Bukkit
47 stars 41 forks source link

Hopper handling not working correctly #143

Closed PyvesB closed 7 years ago

PyvesB commented 7 years ago

Hello KaiKikuchi,

Some players on my server have been complaining that they can bypass shop protections by placing hoppers next to or under a QuickShop to extract its contents.

I saw that a protection was built into QuickShop, in the LockListener class. Nevertheless, it seems to fail in most cases, and after a quick debugging session, I noticed the following code section:

Block c = e.getBlockAgainst();
if (Util.canBeShop(c) == false)
    return;

The method will only carry on and prevent the abuse if the user tries to place the hopper by right clicking on the QuickShop directly. But if he right-clicks on a block near the QuickShop, getBlockAgainst can be almost anything, and the user can manage to place a hopper underneath or next to a chest and still extract its contents. For instance this could happen after right-clicking in the following screenshot:

Quick idea that comes to mind: instead of just checking getBlockAgainst, a solution could involve also checking for adjacent blocks, like in the Util.getSecondHalf method for instance.

Thanks in advance!

Cheers,

Pyves

KaiKikuchi commented 7 years ago

There isn't any protection for hoppers. Players should find a way to not let other players put a hopper below the shop chest. Using other protections like Grief Prevention, or having a mall where players can place their shops without being able to break the ground is necessary.

PyvesB commented 7 years ago

There is a protection for hoppers, please read my issue in more details and refer to the code that I pointed out in the repository. There is a whole class with its associated configuration option that deals with locking and protecting shops properly. Handling hoppers has its own dedicated listener method in this class. As described, the hopper protection can currently be tricked, and needs some minor changes to be fixed.

KaiKikuchi commented 7 years ago

If you have a solution to the issue, feel free to contribute to the code.

I am aware of the listener. I read the issue. The code you are mentioning is non-working (otherwise you wouldn't report this issue). So there isn't any (working) protection for hoppers and I suggest finding other ways to protect the chests, as the built-in protection for the shop chests isn't good, especially for modded servers.