Added level up trigger for individual levels

This commit is contained in:
Aria 2019-09-12 03:44:57 +02:00
parent 3978f765c9
commit a0f05957f8

View File

@ -22,12 +22,20 @@ public class LevelUpEventTrigger implements EventTriggerHandler {
if (event.hasProfession())
for (String event1 : profess.getEventTriggers())
{
if (event1.startsWith("level-up-") && event1.substring(9).equalsIgnoreCase(event.getProfession().getId())) {
profess.getEventTriggers(event1).getTriggers().forEach(trigger -> trigger.apply(player));
break;
}
if (event1.startsWith("level-up-") && event1.substring(9).equalsIgnoreCase(event.getProfession().getId() + "-" + event.getNewLevel())) {
profess.getEventTriggers(event1).getTriggers().forEach(trigger -> trigger.apply(player));
break;
}
}
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));
}
}