forked from Upstream/mmocore
Bug Fixing
This commit is contained in:
parent
c6b9372026
commit
cedc6ae6c8
@ -31,7 +31,7 @@ public class SkillSlot {
|
|||||||
|
|
||||||
public SkillSlot(ConfigurationSection section) {
|
public SkillSlot(ConfigurationSection section) {
|
||||||
this.slot = Integer.parseInt(section.getName());
|
this.slot = Integer.parseInt(section.getName());
|
||||||
this.formula = section.contains("expression") ? section.getString("expression") : "true";
|
this.formula = section.contains("formula") ? section.getString("formula") : "true";
|
||||||
this.name = section.getString("name");
|
this.name = section.getString("name");
|
||||||
this.lore = section.getStringList("lore");
|
this.lore = section.getStringList("lore");
|
||||||
if (section.contains("item"))
|
if (section.contains("item"))
|
||||||
|
@ -2,10 +2,12 @@ package net.Indyuce.mmocore.api.quest.trigger;
|
|||||||
|
|
||||||
import io.lumine.mythic.lib.api.MMOLineConfig;
|
import io.lumine.mythic.lib.api.MMOLineConfig;
|
||||||
import io.lumine.mythic.lib.api.skill.SkillBuff;
|
import io.lumine.mythic.lib.api.skill.SkillBuff;
|
||||||
|
import io.lumine.mythic.lib.player.modifier.ModifierType;
|
||||||
import net.Indyuce.mmocore.MMOCore;
|
import net.Indyuce.mmocore.MMOCore;
|
||||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
import net.Indyuce.mmocore.api.quest.trigger.api.Removable;
|
import net.Indyuce.mmocore.api.quest.trigger.api.Removable;
|
||||||
import net.Indyuce.mmocore.skill.RegisteredSkill;
|
import net.Indyuce.mmocore.skill.RegisteredSkill;
|
||||||
|
import org.apache.commons.lang.Validate;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -25,12 +27,14 @@ public class SkillBuffTrigger extends Trigger implements Removable {
|
|||||||
amount = config.getDouble("amount");
|
amount = config.getDouble("amount");
|
||||||
String skillModifier = config.getString("modifier");
|
String skillModifier = config.getString("modifier");
|
||||||
String formula = config.getString("formula", "true");
|
String formula = config.getString("formula", "true");
|
||||||
|
String type = config.getString("type").toUpperCase();
|
||||||
|
Validate.isTrue(type.equals("FLAT") || type.equals("RELATIVE"));
|
||||||
List<String> targetSkills = new ArrayList<>();
|
List<String> targetSkills = new ArrayList<>();
|
||||||
for (RegisteredSkill skill : MMOCore.plugin.skillManager.getAll()) {
|
for (RegisteredSkill skill : MMOCore.plugin.skillManager.getAll()) {
|
||||||
if (skill.matchesFormula(formula))
|
if (skill.matchesFormula(formula))
|
||||||
targetSkills.add(skill.getHandler().getId());
|
targetSkills.add(skill.getHandler().getId());
|
||||||
}
|
}
|
||||||
skillBuff = new SkillBuff(buffKey, skillModifier, targetSkills, amount);
|
skillBuff = new SkillBuff(buffKey, skillModifier, targetSkills, amount, ModifierType.valueOf(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -29,7 +29,6 @@ public class SkillsCommand extends RegisteredCommand {
|
|||||||
if (data.getProfess().getSkills()
|
if (data.getProfess().getSkills()
|
||||||
.stream()
|
.stream()
|
||||||
.filter((classSkill) -> data.hasUnlocked(classSkill.getSkill()))
|
.filter((classSkill) -> data.hasUnlocked(classSkill.getSkill()))
|
||||||
.sorted((classSkill1,classSkill2)->classSkill1.getUnlockLevel()-classSkill1.getUnlockLevel())
|
|
||||||
.collect(Collectors.toList())
|
.collect(Collectors.toList())
|
||||||
.size() < 1) {
|
.size() < 1) {
|
||||||
MMOCore.plugin.configManager.getSimpleMessage("no-class-skill").send((Player) sender);
|
MMOCore.plugin.configManager.getSimpleMessage("no-class-skill").send((Player) sender);
|
||||||
|
@ -28,6 +28,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@ -201,7 +202,7 @@ public class SkillList extends EditableInventory {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Placeholders getPlaceholders(SkillViewerInventory inv, int n) {
|
public Placeholders getPlaceholders(SkillViewerInventory inv, int n) {
|
||||||
RegisteredSkill selected = inv.selected == null ? null : inv.selected.getSkill();
|
RegisteredSkill selected = inv.selected.getSkill();
|
||||||
|
|
||||||
Placeholders holders = new Placeholders();
|
Placeholders holders = new Placeholders();
|
||||||
|
|
||||||
@ -325,11 +326,11 @@ public class SkillList extends EditableInventory {
|
|||||||
skills = playerData.getProfess().getSkills()
|
skills = playerData.getProfess().getSkills()
|
||||||
.stream()
|
.stream()
|
||||||
.filter((classSkill) -> playerData.hasUnlocked(classSkill.getSkill()))
|
.filter((classSkill) -> playerData.hasUnlocked(classSkill.getSkill()))
|
||||||
|
.sorted(Comparator.comparingInt(ClassSkill::getUnlockLevel))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
skillSlots = getEditable().getByFunction("skill").getSlots();
|
skillSlots = getEditable().getByFunction("skill").getSlots();
|
||||||
Validate.notNull(getEditable().getByFunction("slot"), "Your skill GUI config file is out-of-date, please regenerate it.");
|
Validate.notNull(getEditable().getByFunction("slot"), "Your skill GUI config file is out-of-date, please regenerate it.");
|
||||||
slotSlots = getEditable().getByFunction("slot").getSlots();
|
slotSlots = getEditable().getByFunction("slot").getSlots();
|
||||||
if (skills.size() > page * skillSlots.size())
|
|
||||||
selected = skills.get(page * skillSlots.size());
|
selected = skills.get(page * skillSlots.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -413,9 +414,6 @@ public class SkillList extends EditableInventory {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selected == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!playerData.hasSkillUnlocked(selected)) {
|
if (!playerData.hasSkillUnlocked(selected)) {
|
||||||
MMOCore.plugin.configManager.getSimpleMessage("not-unlocked-skill").send(player);
|
MMOCore.plugin.configManager.getSimpleMessage("not-unlocked-skill").send(player);
|
||||||
player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 2);
|
player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 2);
|
||||||
|
@ -39,9 +39,9 @@ public class RegisteredSkill implements Unlockable {
|
|||||||
triggerType = getHandler().isTriggerable() ? (config.contains("passive-type") ? TriggerType.valueOf(UtilityMethods.enumName(config.getString("passive-type"))) : TriggerType.CAST) : TriggerType.API;
|
triggerType = getHandler().isTriggerable() ? (config.contains("passive-type") ? TriggerType.valueOf(UtilityMethods.enumName(config.getString("passive-type"))) : TriggerType.CAST) : TriggerType.API;
|
||||||
categories.add(getHandler().getId());
|
categories.add(getHandler().getId());
|
||||||
if (triggerType.isPassive())
|
if (triggerType.isPassive())
|
||||||
categories.add("passive");
|
categories.add("PASSIVE");
|
||||||
else
|
else
|
||||||
categories.add("active");
|
categories.add("ACTIVE");
|
||||||
|
|
||||||
// Load default modifier formulas
|
// Load default modifier formulas
|
||||||
for (String mod : handler.getModifiers())
|
for (String mod : handler.getModifiers())
|
||||||
@ -139,7 +139,7 @@ public class RegisteredSkill implements Unlockable {
|
|||||||
String parsedExpression = formula;
|
String parsedExpression = formula;
|
||||||
for (String category : categories)
|
for (String category : categories)
|
||||||
parsedExpression = parsedExpression.replace("<" + category + ">", "true");
|
parsedExpression = parsedExpression.replace("<" + category + ">", "true");
|
||||||
parsedExpression = parsedExpression.replaceAll("<.*>", "false");
|
parsedExpression = parsedExpression.replaceAll("<.*?>", "false");
|
||||||
try {
|
try {
|
||||||
boolean res = (boolean) MythicLib.plugin.getInterpreter().eval(parsedExpression);
|
boolean res = (boolean) MythicLib.plugin.getInterpreter().eval(parsedExpression);
|
||||||
return res;
|
return res;
|
||||||
|
Loading…
Reference in New Issue
Block a user