mirror of
https://github.com/Flowsqy/ShopChest.git
synced 2024-11-26 01:05:12 +01:00
Fix item velocity water bug
This commit is contained in:
parent
8bbc6aae0e
commit
8c1ed25297
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user