mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2024-11-24 00:15:16 +01:00
cleanup
This commit is contained in:
parent
8b708e78ff
commit
bcf519e6f5
@ -2,12 +2,9 @@ package net.Indyuce.mmocore.api;
|
||||
|
||||
import io.lumine.mythic.lib.api.player.EquipmentSlot;
|
||||
import io.lumine.mythic.lib.player.PlayerMetadata;
|
||||
import io.lumine.mythic.lib.skill.SimpleSkill;
|
||||
import io.lumine.mythic.lib.skill.Skill;
|
||||
import io.lumine.mythic.lib.skill.handler.SkillHandler;
|
||||
import io.lumine.mythic.lib.skill.result.SkillResult;
|
||||
import io.lumine.mythic.lib.skill.trigger.TriggerMetadata;
|
||||
import io.lumine.mythic.lib.skill.trigger.TriggerType;
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.party.AbstractParty;
|
||||
@ -18,6 +15,8 @@ import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class MMOCoreAPI {
|
||||
private final JavaPlugin plugin;
|
||||
|
||||
@ -87,7 +86,7 @@ public class MMOCoreAPI {
|
||||
public SkillResult cast(PlayerData playerData, RegisteredSkill skill, int level) {
|
||||
PlayerMetadata casterMeta = playerData.getMMOPlayerData().getStatMap().cache(EquipmentSlot.MAIN_HAND);
|
||||
TriggerMetadata triggerMeta = new TriggerMetadata(casterMeta, null, null);
|
||||
return new CastableSkill(new ClassSkill(skill, 0), level).cast(triggerMeta);
|
||||
return new CastableSkill(new ClassSkill(skill, 0, 0), level).cast(triggerMeta);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -110,8 +109,7 @@ public class MMOCoreAPI {
|
||||
public SkillResult cast(PlayerData playerData, SkillHandler<?> skill, int level) {
|
||||
PlayerMetadata casterMeta = playerData.getMMOPlayerData().getStatMap().cache(EquipmentSlot.MAIN_HAND);
|
||||
TriggerMetadata triggerMeta = new TriggerMetadata(casterMeta, null, null);
|
||||
RegisteredSkill registered = MMOCore.plugin.skillManager.getSkill(skill.getId());
|
||||
Skill cast = registered == null ? new SimpleSkill(TriggerType.CAST, skill) : new CastableSkill(new ClassSkill(registered, 0), level);
|
||||
return cast.cast(triggerMeta);
|
||||
RegisteredSkill registered = Objects.requireNonNull(MMOCore.plugin.skillManager.getSkill(skill.getId()), "Could not find registered skill with such handler");
|
||||
return new CastableSkill(new ClassSkill(registered, 0, 0), level).cast(triggerMeta);
|
||||
}
|
||||
}
|
||||
|
@ -17,13 +17,14 @@ public class ClassSkill implements CooldownObject {
|
||||
private final int unlockLevel, maxSkillLevel;
|
||||
private final Map<String, LinearValue> modifiers = new HashMap<>();
|
||||
|
||||
public ClassSkill(RegisteredSkill skill, int unlockLevel) {
|
||||
this(skill, unlockLevel, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Class used to save information about skills IN A CLASS CONTEXT i.e at
|
||||
* which level the skill can be unlocked, etc.
|
||||
* <p>
|
||||
* This constructor can be used by other plugins to register class skills
|
||||
* directly without the use of class config files.
|
||||
* <p>
|
||||
* It is also used by the MMOCore API to force players to cast abilities.
|
||||
*/
|
||||
public ClassSkill(RegisteredSkill skill, int unlockLevel, int maxSkillLevel) {
|
||||
this.skill = skill;
|
||||
|
@ -5,7 +5,6 @@ import io.lumine.mythic.lib.skill.handler.SkillHandler;
|
||||
import io.lumine.mythic.lib.skill.trigger.TriggerType;
|
||||
import net.Indyuce.mmocore.api.util.MMOCoreUtils;
|
||||
import net.Indyuce.mmocore.api.util.math.formula.LinearValue;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -18,7 +17,6 @@ import java.util.Objects;
|
||||
|
||||
public class RegisteredSkill {
|
||||
private final SkillHandler<?> handler;
|
||||
|
||||
private final String name;
|
||||
private final Map<String, LinearValue> defaultModifiers = new HashMap<>();
|
||||
private final ItemStack icon;
|
||||
@ -28,7 +26,6 @@ public class RegisteredSkill {
|
||||
public RegisteredSkill(SkillHandler<?> handler, ConfigurationSection config) {
|
||||
this.handler = handler;
|
||||
|
||||
|
||||
name = Objects.requireNonNull(config.getString("name"), "Could not find skill name");
|
||||
icon = MMOCoreUtils.readIcon(Objects.requireNonNull(config.getString("material"), "Could not find skill icon"));
|
||||
lore = Objects.requireNonNull(config.getStringList("lore"), "Could not find skill lore");
|
||||
|
Loading…
Reference in New Issue
Block a user