From 783782f44f0da18315602f0f5cfb59f21d94b6b0 Mon Sep 17 00:00:00 2001 From: Aria Date: Sat, 21 Sep 2019 01:09:54 +0200 Subject: [PATCH] Added max level trigger --- .../player/profess/event/trigger/LevelUpEventTrigger.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/LevelUpEventTrigger.java b/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/LevelUpEventTrigger.java index 37bf8406..83967883 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/LevelUpEventTrigger.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/profess/event/trigger/LevelUpEventTrigger.java @@ -31,11 +31,18 @@ public class LevelUpEventTrigger implements EventTriggerHandler { profess.getEventTriggers(event1).getTriggers().forEach(trigger -> trigger.apply(player)); break; } + if (event1.startsWith("level-up-") && event1.substring(9).equalsIgnoreCase(event.getProfession().getId() + "-max")) { + if(event.getNewLevel() == profess.getMaxLevel()) + profess.getEventTriggers(event1).getTriggers().forEach(trigger -> trigger.apply(player)); + } } if (!event.hasProfession() && profess.hasEventTriggers("level-up")) profess.getEventTriggers("level-up").getTriggers().forEach(trigger -> trigger.apply(player)); if (!event.hasProfession() && profess.hasEventTriggers("level-up-" + event.getNewLevel())) profess.getEventTriggers("level-up-" + event.getNewLevel()).getTriggers().forEach(trigger -> trigger.apply(player)); + if (!event.hasProfession() && profess.hasEventTriggers("level-up-max")) + if(event.getNewLevel() == profess.getMaxLevel()) + profess.getEventTriggers("level-up-max").getTriggers().forEach(trigger -> trigger.apply(player)); } }