Removed unneeded debug messages
This commit is contained in:
parent
f6a4cc5fa8
commit
a1878636ae
|
|
@ -107,7 +107,6 @@ public class UpgradeWindow extends GUI {
|
||||||
}
|
}
|
||||||
int maxDurability = Material.FISHING_ROD.getMaxDurability();
|
int maxDurability = Material.FISHING_ROD.getMaxDurability();
|
||||||
int newDamage = Math.min((int) (maxDurability * (repairData.percentage() / 100.0)), maxDurability);
|
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) {
|
if ((maxDurability - damageable.getDamage()) >= newDamage) {
|
||||||
clickingPlayer.sendMiniMessage("<red>Your fishing rod is already more than <percentage>% repaired", //TODO move to config
|
clickingPlayer.sendMiniMessage("<red>Your fishing rod is already more than <percentage>% repaired", //TODO move to config
|
||||||
Placeholder.parsed("percentage", String.valueOf(repairData.percentage())));
|
Placeholder.parsed("percentage", String.valueOf(repairData.percentage())));
|
||||||
|
|
@ -158,7 +157,7 @@ public class UpgradeWindow extends GUI {
|
||||||
ItemStack itemStack = new ItemStack(Material.ENCHANTED_BOOK, 1);
|
ItemStack itemStack = new ItemStack(Material.ENCHANTED_BOOK, 1);
|
||||||
Optional<EnchantmentData> optionalEnchantmentData = enchantmentTrack.nextEnchantment(trackLevel);
|
Optional<EnchantmentData> optionalEnchantmentData = enchantmentTrack.nextEnchantment(trackLevel);
|
||||||
if (optionalEnchantmentData.isEmpty()) {
|
if (optionalEnchantmentData.isEmpty()) {
|
||||||
logger.debug("Player was unable to get next enchant");
|
logger.warning("Player was unable to get next enchant");
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
EnchantmentData enchantmentData = optionalEnchantmentData.get();
|
EnchantmentData enchantmentData = optionalEnchantmentData.get();
|
||||||
|
|
|
||||||
|
|
@ -82,23 +82,22 @@ public class CatchFish implements Listener {
|
||||||
if (activeFishers.containsKey(uuid)) {
|
if (activeFishers.containsKey(uuid)) {
|
||||||
activeFishers.get(uuid).cancel();
|
activeFishers.get(uuid).cancel();
|
||||||
}
|
}
|
||||||
if (event.getHook().getLocation().getBlock().getType().equals(Material.LAVA)) {
|
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
|
return;
|
||||||
Optional<ItemStack> optionalFishingRod = getFishingRod(player);
|
}
|
||||||
if (optionalFishingRod.isEmpty()) {
|
player.sendActionBar(MiniMessage.miniMessage().deserialize("<gold>You are now fishing in lava...</gold>")); //TODO move to config
|
||||||
logger.warning("Fishing rod disappeared for player %", player.getName());
|
Optional<ItemStack> optionalFishingRod = getFishingRod(player);
|
||||||
return;
|
if (optionalFishingRod.isEmpty()) {
|
||||||
}
|
logger.warning("Fishing rod disappeared for player %", player.getName());
|
||||||
ItemStack itemStack = optionalFishingRod.get();
|
return;
|
||||||
int lure = itemStack.getEnchantmentLevel(Enchantment.LURE);
|
}
|
||||||
int fireProtection = itemStack.getEnchantmentLevel(Enchantment.PROTECTION_FIRE);
|
ItemStack itemStack = optionalFishingRod.get();
|
||||||
int unbreaking = itemStack.getEnchantmentLevel(Enchantment.DURABILITY);
|
int lure = itemStack.getEnchantmentLevel(Enchantment.LURE);
|
||||||
LavaFishing lavaFishing = new LavaFishing(lure, fireProtection, unbreaking, player, logger, event.getHook().getLocation());
|
int fireProtection = itemStack.getEnchantmentLevel(Enchantment.PROTECTION_FIRE);
|
||||||
activeLavaFishers.put(uuid, lavaFishing);
|
int unbreaking = itemStack.getEnchantmentLevel(Enchantment.DURABILITY);
|
||||||
lavaFishing.runTaskTimerAsynchronously(fishingEvent, 1, 1);
|
LavaFishing lavaFishing = new LavaFishing(lure, fireProtection, unbreaking, player, logger, event.getHook().getLocation());
|
||||||
logger.debug("in lava above");
|
activeLavaFishers.put(uuid, lavaFishing);
|
||||||
} else
|
lavaFishing.runTaskTimerAsynchronously(fishingEvent, 1, 1);
|
||||||
logger.debug("Not in lava");
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
activeFishers.put(uuid, bukkitRunnable);
|
activeFishers.put(uuid, bukkitRunnable);
|
||||||
|
|
@ -107,19 +106,16 @@ public class CatchFish implements Listener {
|
||||||
} else if (event.getState().equals(PlayerFishEvent.State.CAUGHT_FISH)) {
|
} else if (event.getState().equals(PlayerFishEvent.State.CAUGHT_FISH)) {
|
||||||
stopLavaFishStart(uuid);
|
stopLavaFishStart(uuid);
|
||||||
if (event.getCaught() == null) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
logger.debug("% caught a water fish", player.getName());
|
|
||||||
handleFishCaught(event);
|
handleFishCaught(event);
|
||||||
} else if (event.getState().equals(PlayerFishEvent.State.IN_GROUND)) {
|
} else if (event.getState().equals(PlayerFishEvent.State.IN_GROUND)) {
|
||||||
stopLavaFishStart(uuid);
|
stopLavaFishStart(uuid);
|
||||||
logger.debug("% reeled in fishing rod that was in the ground", player.getName());
|
|
||||||
|
|
||||||
handleLavaFishCaught(event);
|
handleLavaFishCaught(event);
|
||||||
} else {
|
} else {
|
||||||
stopLavaFishStart(uuid);
|
stopLavaFishStart(uuid);
|
||||||
logger.debug("Registered different fish state [%]", event.getState().toString());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -155,13 +151,11 @@ public class CatchFish implements Listener {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
LavaFishing lavaFishing = activeLavaFishers.get(player.getUniqueId());
|
LavaFishing lavaFishing = activeLavaFishers.get(player.getUniqueId());
|
||||||
if (lavaFishing == null) {
|
if (lavaFishing == null) {
|
||||||
logger.debug("Reeled in but was not lava fishing");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
activeLavaFishers.remove(player.getUniqueId());
|
activeLavaFishers.remove(player.getUniqueId());
|
||||||
lavaFishing.cancel();
|
lavaFishing.cancel();
|
||||||
if (!lavaFishing.canCatchFish()) {
|
if (!lavaFishing.canCatchFish()) {
|
||||||
logger.debug("Reeled in in lava but too early");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Optional<CaughtFishData> optionalFishData = getFishData(event, player, FishType.LAVA);
|
Optional<CaughtFishData> optionalFishData = getFishData(event, player, FishType.LAVA);
|
||||||
|
|
@ -183,12 +177,10 @@ public class CatchFish implements Listener {
|
||||||
|
|
||||||
private void handleFishCaught(PlayerFishEvent event) {
|
private void handleFishCaught(PlayerFishEvent event) {
|
||||||
Entity caught = event.getCaught();
|
Entity caught = event.getCaught();
|
||||||
logger.debug(caught == null ? "null" : caught.toString());
|
|
||||||
if (!(caught instanceof Item item)) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
logger.debug(String.valueOf(item.getItemStack().getType()));
|
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
Optional<CaughtFishData> optionalFishData = getFishData(event, player, FishType.WATER);
|
Optional<CaughtFishData> optionalFishData = getFishData(event, player, FishType.WATER);
|
||||||
|
|
@ -196,11 +188,7 @@ public class CatchFish implements Listener {
|
||||||
return;
|
return;
|
||||||
CaughtFishData caughtFishData = optionalFishData.get();
|
CaughtFishData caughtFishData = optionalFishData.get();
|
||||||
item.setItemStack(caughtFishData.fishItem());
|
item.setItemStack(caughtFishData.fishItem());
|
||||||
logger.debug(String.valueOf(item.getItemStack().getType()));
|
|
||||||
item.setOwner(player.getUniqueId());
|
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());
|
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> fish <gold><length> cm</gold></green>", //TODO move to config
|
||||||
TagResolver.resolver(
|
TagResolver.resolver(
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,6 @@ 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();
|
||||||
logger.debug("Setting rod damage to %", String.valueOf(damage));
|
|
||||||
damageable.setDamage(Math.min(++damage, Material.FISHING_ROD.getMaxDurability()));
|
damageable.setDamage(Math.min(++damage, Material.FISHING_ROD.getMaxDurability()));
|
||||||
item.setItemMeta(damageable);
|
item.setItemMeta(damageable);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -146,7 +145,6 @@ public class LavaFishing extends BukkitRunnable {
|
||||||
@Override
|
@Override
|
||||||
public synchronized void cancel() throws IllegalStateException {
|
public synchronized void cancel() throws IllegalStateException {
|
||||||
super.cancel();
|
super.cancel();
|
||||||
logger.debug("Cancelled");
|
|
||||||
activeFishers.remove(player.getUniqueId());
|
activeFishers.remove(player.getUniqueId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user