Removed unneeded debug messages

This commit is contained in:
Teriuihi 2023-09-29 23:33:08 +02:00
parent f6a4cc5fa8
commit a1878636ae
3 changed files with 19 additions and 34 deletions

View File

@ -107,7 +107,6 @@ public class UpgradeWindow extends GUI {
}
int maxDurability = Material.FISHING_ROD.getMaxDurability();
int newDamage = Math.min((int) (maxDurability * (repairData.percentage() / 100.0)), maxDurability);
logger.debug("current damage: %, new damage %", String.valueOf(maxDurability - damageable.getDamage()), String.valueOf(newDamage));
if ((maxDurability - damageable.getDamage()) >= newDamage) {
clickingPlayer.sendMiniMessage("<red>Your fishing rod is already more than <percentage>% repaired", //TODO move to config
Placeholder.parsed("percentage", String.valueOf(repairData.percentage())));
@ -158,7 +157,7 @@ public class UpgradeWindow extends GUI {
ItemStack itemStack = new ItemStack(Material.ENCHANTED_BOOK, 1);
Optional<EnchantmentData> optionalEnchantmentData = enchantmentTrack.nextEnchantment(trackLevel);
if (optionalEnchantmentData.isEmpty()) {
logger.debug("Player was unable to get next enchant");
logger.warning("Player was unable to get next enchant");
return Optional.empty();
}
EnchantmentData enchantmentData = optionalEnchantmentData.get();

View File

@ -82,23 +82,22 @@ public class CatchFish implements Listener {
if (activeFishers.containsKey(uuid)) {
activeFishers.get(uuid).cancel();
}
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
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);
int unbreaking = itemStack.getEnchantmentLevel(Enchantment.DURABILITY);
LavaFishing lavaFishing = new LavaFishing(lure, fireProtection, unbreaking, player, logger, event.getHook().getLocation());
activeLavaFishers.put(uuid, lavaFishing);
lavaFishing.runTaskTimerAsynchronously(fishingEvent, 1, 1);
logger.debug("in lava above");
} else
logger.debug("Not in lava");
if (!event.getHook().getLocation().getBlock().getType().equals(Material.LAVA)) {
return;
}
player.sendActionBar(MiniMessage.miniMessage().deserialize("<gold>You are now fishing in lava...</gold>")); //TODO move to config
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);
int unbreaking = itemStack.getEnchantmentLevel(Enchantment.DURABILITY);
LavaFishing lavaFishing = new LavaFishing(lure, fireProtection, unbreaking, player, logger, event.getHook().getLocation());
activeLavaFishers.put(uuid, lavaFishing);
lavaFishing.runTaskTimerAsynchronously(fishingEvent, 1, 1);
}
};
activeFishers.put(uuid, bukkitRunnable);
@ -107,19 +106,16 @@ public class CatchFish implements Listener {
} else if (event.getState().equals(PlayerFishEvent.State.CAUGHT_FISH)) {
stopLavaFishStart(uuid);
if (event.getCaught() == null) {
logger.debug("% caught a water fish but it was null", player.getName());
logger.warning("% caught a water fish but it was null", player.getName());
return;
}
logger.debug("% caught a water fish", player.getName());
handleFishCaught(event);
} else if (event.getState().equals(PlayerFishEvent.State.IN_GROUND)) {
stopLavaFishStart(uuid);
logger.debug("% reeled in fishing rod that was in the ground", player.getName());
handleLavaFishCaught(event);
} else {
stopLavaFishStart(uuid);
logger.debug("Registered different fish state [%]", event.getState().toString());
}
}
@ -155,13 +151,11 @@ public class CatchFish implements Listener {
Player player = event.getPlayer();
LavaFishing lavaFishing = activeLavaFishers.get(player.getUniqueId());
if (lavaFishing == null) {
logger.debug("Reeled in but was not lava fishing");
return;
}
activeLavaFishers.remove(player.getUniqueId());
lavaFishing.cancel();
if (!lavaFishing.canCatchFish()) {
logger.debug("Reeled in in lava but too early");
return;
}
Optional<CaughtFishData> optionalFishData = getFishData(event, player, FishType.LAVA);
@ -183,12 +177,10 @@ public class CatchFish implements Listener {
private void handleFishCaught(PlayerFishEvent event) {
Entity caught = event.getCaught();
logger.debug(caught == null ? "null" : caught.toString());
if (!(caught instanceof Item item)) {
logger.debug("% did not catch an item", event.getPlayer().getName());
logger.warning("% did not catch an item", event.getPlayer().getName());
return;
}
logger.debug(String.valueOf(item.getItemStack().getType()));
Player player = event.getPlayer();
Optional<CaughtFishData> optionalFishData = getFishData(event, player, FishType.WATER);
@ -196,11 +188,7 @@ public class CatchFish implements Listener {
return;
CaughtFishData caughtFishData = optionalFishData.get();
item.setItemStack(caughtFishData.fishItem());
logger.debug(String.valueOf(item.getItemStack().getType()));
item.setOwner(player.getUniqueId());
logger.debug("[%] caught a [%] with length [%] and rarity [%] for [%] points",
player.getName(), caughtFishData.fish().normalFishName(), String.format("%.2f", caughtFishData.length()),
caughtFishData.fish().getRarity().displayNameString(), String.valueOf(caughtFishData.pointsValue()));
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
TagResolver.resolver(

View File

@ -81,7 +81,6 @@ public class LavaFishing extends BukkitRunnable {
}
if (item.getItemMeta() instanceof Damageable damageable) {
int damage = damageable.getDamage();
logger.debug("Setting rod damage to %", String.valueOf(damage));
damageable.setDamage(Math.min(++damage, Material.FISHING_ROD.getMaxDurability()));
item.setItemMeta(damageable);
} else {
@ -146,7 +145,6 @@ public class LavaFishing extends BukkitRunnable {
@Override
public synchronized void cancel() throws IllegalStateException {
super.cancel();
logger.debug("Cancelled");
activeFishers.remove(player.getUniqueId());
}
}