Fix item velocity water bug

This commit is contained in:
Flowsqy 2022-12-19 00:46:41 +01:00
parent 8bbc6aae0e
commit 8c1ed25297

View File

@ -25,9 +25,11 @@ import de.epiceric.shopchest.utils.ShopUtils;
public class ShopItemListener implements Listener {
private final ShopChest plugin;
private ShopUtils shopUtils;
public ShopItemListener(ShopChest plugin) {
this.plugin = plugin;
this.shopUtils = plugin.getShopUtils();
}
@ -115,12 +117,21 @@ public class ShopItemListener implements Listener {
}
}
} else if (shopUtils.isShop(underWater.getLocation())) {
// - Respawn if burned from lava
if (e.getBucket() == Material.LAVA_BUCKET) {
Shop shop = shopUtils.getShop(underWater.getLocation());
if (shop.getItem() != null) {
shop.getItem().resetForPlayer(e.getPlayer());
}
}
// - Cancel velocity from linked water sources
else if (e.getBucket() == Material.WATER_BUCKET) {
Shop shop = shopUtils.getShop(underWater.getLocation());
if (shop.getItem() != null) {
// Delay the respawn otherwise the velocity is impacted by the water even with the respawn
Bukkit.getScheduler().runTaskLater(plugin, () -> shop.getItem().resetForPlayer(e.getPlayer()), 2L);
}
}
} else {
return;
}