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 {
|
public class ShopItemListener implements Listener {
|
||||||
|
|
||||||
|
private final ShopChest plugin;
|
||||||
private ShopUtils shopUtils;
|
private ShopUtils shopUtils;
|
||||||
|
|
||||||
public ShopItemListener(ShopChest plugin) {
|
public ShopItemListener(ShopChest plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
this.shopUtils = plugin.getShopUtils();
|
this.shopUtils = plugin.getShopUtils();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,12 +117,21 @@ public class ShopItemListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (shopUtils.isShop(underWater.getLocation())) {
|
} else if (shopUtils.isShop(underWater.getLocation())) {
|
||||||
|
// - Respawn if burned from lava
|
||||||
if (e.getBucket() == Material.LAVA_BUCKET) {
|
if (e.getBucket() == Material.LAVA_BUCKET) {
|
||||||
Shop shop = shopUtils.getShop(underWater.getLocation());
|
Shop shop = shopUtils.getShop(underWater.getLocation());
|
||||||
if (shop.getItem() != null) {
|
if (shop.getItem() != null) {
|
||||||
shop.getItem().resetForPlayer(e.getPlayer());
|
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 {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user