From c8936fc65331e9fd6e800e4fe34b221f02eda4f4 Mon Sep 17 00:00:00 2001 From: Zrips Date: Thu, 15 Jul 2021 11:25:17 +0300 Subject: [PATCH] Fixing damage dealth to mobs caching --- src/main/java/com/gamingmesh/jobs/dao/JobsDAO.java | 5 +++-- .../com/gamingmesh/jobs/listeners/JobsPaymentListener.java | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/gamingmesh/jobs/dao/JobsDAO.java b/src/main/java/com/gamingmesh/jobs/dao/JobsDAO.java index 05a447a2..1f9406ff 100644 --- a/src/main/java/com/gamingmesh/jobs/dao/JobsDAO.java +++ b/src/main/java/com/gamingmesh/jobs/dao/JobsDAO.java @@ -1557,6 +1557,7 @@ public abstract class JobsDAO { if (conn == null) return false; PreparedStatement prest = null; + boolean done = true; try { prest = conn.prepareStatement("DELETE FROM `" + getJobsTableName() + "` WHERE `" + JobsTableFields.userid.getCollumn() + "` = ? AND `" + JobsTableFields.jobid.getCollumn() + "` = ?;"); @@ -1565,11 +1566,11 @@ public abstract class JobsDAO { prest.execute(); } catch (SQLException e) { e.printStackTrace(); - return false; + done = false; } finally { close(prest); } - return true; + return done; } /** diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java index 19d30f27..279c8a32 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java @@ -1093,11 +1093,11 @@ public final class JobsPaymentListener implements Listener { Jobs.action(Jobs.getPlayerManager().getJobsPlayer(player), new ItemActionInfo(event.getResult(), ActionType.SMELT)); } - @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onEntityDamageByPlayer(EntityDamageEvent event) { if (!Jobs.getGCManager().MonsterDamageUse || !(event instanceof EntityDamageByEntityEvent) || !Jobs.getGCManager().canPerformActionInWorld(event.getEntity().getWorld())) - return; + return; Entity ent = event.getEntity(); if (ent instanceof Player || !(ent instanceof Damageable)) @@ -1120,7 +1120,7 @@ public final class JobsPaymentListener implements Listener { } } - @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onEntityDamageByProjectile(EntityDamageByEntityEvent event) { if (!Jobs.getGCManager().canPerformActionInWorld(event.getEntity().getWorld())) return;