Fix fishing rod being possible to break
This commit is contained in:
parent
d8a19c4b02
commit
92ab01bee1
|
|
@ -134,7 +134,7 @@ public class CatchFish implements Listener {
|
||||||
}
|
}
|
||||||
ItemStack fishingRod = optionalFishingROd.get();
|
ItemStack fishingRod = optionalFishingROd.get();
|
||||||
if (fishingRod.getItemMeta() instanceof Damageable damageable) {
|
if (fishingRod.getItemMeta() instanceof Damageable damageable) {
|
||||||
return damageable.getDamage() >= Material.FISHING_ROD.getMaxDurability();
|
return damageable.getDamage() > Material.FISHING_ROD.getMaxDurability();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -166,7 +166,7 @@ public class CatchFish implements Listener {
|
||||||
player.updateInventory();
|
player.updateInventory();
|
||||||
player.getWorld().spawn(player.getLocation(), ExperienceOrb.class).setExperience(10);
|
player.getWorld().spawn(player.getLocation(), ExperienceOrb.class).setExperience(10);
|
||||||
ScoreboardManager.getInstance().updateScoreboard(player, caughtFishData.length(), caughtFishData.fish());
|
ScoreboardManager.getInstance().updateScoreboard(player, caughtFishData.length(), caughtFishData.fish());
|
||||||
player.sendActionBar(MiniMessage.miniMessage().deserialize("<green>You caught a <rarity> <name> fish <gold><length> cm</gold></green>", //TODO move to config
|
player.sendActionBar(MiniMessage.miniMessage().deserialize("<green>You caught a <rarity> <name> <gold><length> cm</gold></green>", //TODO move to config
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
Placeholder.component("rarity", caughtFishData.fish().getRarity().displayName()),
|
Placeholder.component("rarity", caughtFishData.fish().getRarity().displayName()),
|
||||||
Placeholder.component("name", caughtFishData.fish().fishName()),
|
Placeholder.component("name", caughtFishData.fish().fishName()),
|
||||||
|
|
@ -195,7 +195,7 @@ public class CatchFish implements Listener {
|
||||||
item.setItemStack(caughtFishData.fishItem());
|
item.setItemStack(caughtFishData.fishItem());
|
||||||
item.setOwner(player.getUniqueId());
|
item.setOwner(player.getUniqueId());
|
||||||
ScoreboardManager.getInstance().updateScoreboard(player, caughtFishData.length(), caughtFishData.fish());
|
ScoreboardManager.getInstance().updateScoreboard(player, caughtFishData.length(), caughtFishData.fish());
|
||||||
player.sendActionBar(MiniMessage.miniMessage().deserialize("<green>You caught a <rarity> <name> fish <gold><length> cm</gold></green>", //TODO move to config
|
player.sendActionBar(MiniMessage.miniMessage().deserialize("<green>You caught a <rarity> <name> <gold><length> cm</gold></green>", //TODO move to config
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
Placeholder.component("rarity", caughtFishData.fish().getRarity().displayName()),
|
Placeholder.component("rarity", caughtFishData.fish().getRarity().displayName()),
|
||||||
Placeholder.component("name", caughtFishData.fish().fishName()),
|
Placeholder.component("name", caughtFishData.fish().fishName()),
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ public class LavaFishing extends BukkitRunnable {
|
||||||
}
|
}
|
||||||
if (item.getItemMeta() instanceof Damageable damageable) {
|
if (item.getItemMeta() instanceof Damageable damageable) {
|
||||||
int damage = damageable.getDamage();
|
int damage = damageable.getDamage();
|
||||||
damageable.setDamage(Math.min(++damage, Material.FISHING_ROD.getMaxDurability()));
|
damageable.setDamage(Math.min(++damage, Material.FISHING_ROD.getMaxDurability() - 1));
|
||||||
item.setItemMeta(damageable);
|
item.setItemMeta(damageable);
|
||||||
} else {
|
} else {
|
||||||
logger.warning("This item can't be damaged");
|
logger.warning("This item can't be damaged");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user