Patbox / UniversalShops

Universal trade shop mod for your Minecraft server!
GNU Lesser General Public License v3.0
12 stars 13 forks source link

Users can steal from storage #9

Closed Sleepylux closed 1 year ago

Sleepylux commented 1 year ago

Users can steal for the supply container/storage, Its yeah just that- Shouldnt be that hard to fix If I know the fabric api correctly-

Patbox commented 1 year ago

Could you tell me how they can steal it? I don't have enough info

Sleepylux commented 1 year ago

Looking through your code, It may not be as simple to fix as I thought Anywho they can just open the supply chest/barrel and take items out

Patbox commented 1 year ago

Ah right. For that you want to add some extra mod. For example some claim mod (like Get Off My Lawn ReServed) or chest locking mod (like Hey Thats Mine).

Sleepylux commented 1 year ago

Ah alright, It would be cool if it was added in the mod itself, I dont think it would be that hard just store all the shop containers positions in an array like new int[][]{{x,y,z}, {x,y,z}} and on PlayerBlockBreakEvents.BEFORE register an event to check if its any of those positions above and if it is return false otherwise return true, That should stop it from being broken and you can basically the same thing on UseBlockCallback but returning ActionResult.PASS as true and ActionResult.FAIL as false, (you could store it as a JsonArray or something in a file or just remake the array with all currently existing tradeshops if the mod restarts or something for persistence)

Sleepylux commented 1 year ago

or better idea, Add an NBT tag to the container and when a block is broken with an NBT tag then just cancel the break

Patbox commented 1 year ago

You still be better just using alternative methods, as this mod is compatible with them