Assign actual enchant levels when starting LavaFishing
This commit is contained in:
parent
54556d3ea5
commit
dc6a233c1b
|
|
@ -16,6 +16,7 @@ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
|||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.Player;
|
||||
|
|
@ -64,7 +65,15 @@ public class CatchFish implements Listener {
|
|||
public void run() {
|
||||
if (event.getHook().getLocation().getBlock().getType().equals(Material.LAVA)) {
|
||||
player.sendActionBar(MiniMessage.miniMessage().deserialize("<gold>You are now fishing in lava...</gold>")); //TODO move to config
|
||||
LavaFishing lavaFishing = new LavaFishing(1, 1, player, logger, event.getHook().getLocation());
|
||||
Optional<ItemStack> optionalFishingRod = getFishingRod(player);
|
||||
if (optionalFishingRod.isEmpty()) {
|
||||
logger.warning("Fishing rod disappeared for player %", player.getName());
|
||||
return;
|
||||
}
|
||||
ItemStack itemStack = optionalFishingRod.get();
|
||||
int lure = itemStack.getEnchantmentLevel(Enchantment.LURE);
|
||||
int fireProtection = itemStack.getEnchantmentLevel(Enchantment.PROTECTION_FIRE);
|
||||
LavaFishing lavaFishing = new LavaFishing(lure, fireProtection, player, logger, event.getHook().getLocation());
|
||||
activeLavaFishers.put(player.getUniqueId(), lavaFishing);
|
||||
lavaFishing.runTaskTimerAsynchronously(fishingEvent, 1, 1);
|
||||
logger.debug("in lava above");
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user