Fix lava fishing

This commit is contained in:
Teriuihi 2023-09-30 00:40:46 +02:00
parent 8d5c369877
commit d96496d42e

View File

@ -110,7 +110,8 @@ public class CatchFish implements Listener {
return; return;
} }
handleFishCaught(event); handleFishCaught(event);
} else if (event.getState().equals(PlayerFishEvent.State.IN_GROUND)) { } else if (event.getState().equals(PlayerFishEvent.State.IN_GROUND) || event.getState().equals(PlayerFishEvent.State.REEL_IN)) {
stopLavaFishStart(uuid);
handleLavaFishCaught(event); handleLavaFishCaught(event);
} else { } else {
stopLavaFishStart(uuid); stopLavaFishStart(uuid);
@ -174,6 +175,12 @@ public class CatchFish implements Listener {
} }
private void handleFishCaught(PlayerFishEvent event) { private void handleFishCaught(PlayerFishEvent event) {
UUID uuid = event.getPlayer().getUniqueId();
LavaFishing lavaFishing = activeLavaFishers.get(uuid);
if (lavaFishing != null) {
lavaFishing.cancel();
activeLavaFishers.remove(uuid);
}
Entity caught = event.getCaught(); Entity caught = event.getCaught();
if (!(caught instanceof Item item)) { if (!(caught instanceof Item item)) {
logger.warning("% did not catch an item", event.getPlayer().getName()); logger.warning("% did not catch an item", event.getPlayer().getName());