BlvckBytes / QuickShopSearch

Efficiently query QuickShops using any desired predicate
2 stars 1 forks source link

The Shop appears to be disabled when transported to the Shop #3

Closed YuanYuanOwO closed 2 weeks ago

BlvckBytes commented 2 weeks ago

This one was really subtle! Let me quickly outline what caused this behavior, as to document the issue's solution. When teleporting to a shop, which could still be massively improved (safe teleport), I center the player onto the block by adding 1/2 on each axis. The method Location#add modifies in place, and ContainerShop#getLocation actually returns a direct reference to it's internal value, so I was permanently changing it's location, and thereby disabled functionality - until the next reload. If this was to be persisted for some reason, matters could have gotten really messed up.

old:

player.teleport(targetShop.getShop().getLocation().add(.5, 0, .5));

new:

player.teleport(targetShop.getShop().getLocation().clone().add(.5, 0, .5));

Again, thank you so much for your report! :) Please give the latest release a try.