From d16fc7e50d65f68b541ec24ded129778b40812f7 Mon Sep 17 00:00:00 2001 From: montlikadani Date: Fri, 17 Apr 2020 11:33:29 +0200 Subject: [PATCH] Fixed issue when cows milking are giving messages, even when the player was not joined to a job Closes, #728 --- .../jobs/listeners/JobsPaymentListener.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java index ddba4ee1..255a75cc 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java @@ -228,6 +228,20 @@ public class JobsPaymentListener implements Listener { if (jPlayer == null) return; + boolean found = false; + t: for (JobProgression prog : jPlayer.getJobProgression()) { + for (JobInfo info : jPlayer.getJobProgression(prog.getJob()).getJob().getJobInfo(ActionType.MILK)) { + if (info.getActionType() == ActionType.MILK) { + found = true; + break t; + } + } + } + + if (!found) { + return; + } + if (Jobs.getGCManager().CowMilkingTimer > 0) { if (cow.hasMetadata(CowMetadata)) { long time = cow.getMetadata(CowMetadata).get(0).asLong();