diff --git a/Server/src/main/java/core/game/node/entity/Entity.java b/Server/src/main/java/core/game/node/entity/Entity.java index 24caeb50d..8899676f6 100644 --- a/Server/src/main/java/core/game/node/entity/Entity.java +++ b/Server/src/main/java/core/game/node/entity/Entity.java @@ -178,13 +178,7 @@ public abstract class Entity extends Node { */ public void unhook(EventHook hook) { - GameWorld.getPulser().submit(new Pulse() { - @Override - public boolean pulse() { - for(ArrayList s : hooks.values()) s.remove(hook); - return true; - } - }); + for(ArrayList s : hooks.values()) s.remove(hook); } /** diff --git a/Server/src/main/kotlin/rs09/game/content/jobs/WorkForInteractionListener.kt b/Server/src/main/kotlin/rs09/game/content/jobs/WorkForInteractionListener.kt index 062dcffe7..6c85cabcb 100644 --- a/Server/src/main/kotlin/rs09/game/content/jobs/WorkForInteractionListener.kt +++ b/Server/src/main/kotlin/rs09/game/content/jobs/WorkForInteractionListener.kt @@ -5,6 +5,7 @@ import SlayingJob import api.* import api.events.EventHook import api.events.NPCKillEvent +import core.game.content.dialogue.FacialExpression import core.game.node.entity.Entity import core.game.node.entity.npc.NPC import core.game.node.entity.player.Player @@ -85,9 +86,20 @@ class WorkForInteractionListener : InteractionListener, LoginListener { val type = typeMap[node.id] ?: return@on false jobId = if(type == 0) { - var job = gatheringMap[node.id]?.filter { checkRequirement(player, it) }?.random() - amount = job?.getAmount() ?: 0 - job?.ordinal ?: 0 + val job = gatheringMap[node.id]?.filter { checkRequirement(player, it) }?.randomOrNull() + + if (job == null) { + sendNPCDialogue( + player, + node.id, + "I'm sorry, I don't currently have any jobs that you're qualified for.", + FacialExpression.HALF_THINKING + ) + return@on true + } + + amount = job.getAmount() + job.ordinal } else { SlayingJob.values().random().ordinal.also { amount = SlayingJob.values()[it].getAmount() } }