From 3f085b91ecfe92ac0d50960162b44b8b28876a83 Mon Sep 17 00:00:00 2001 From: Ethan Date: Sat, 13 Feb 2021 02:12:16 -0500 Subject: [PATCH] Fix skill binding not working Revert "Attempts to fix issue #mmocore-0417. Adds limit on amount of skills that can be bound." This reverts commit 4ad5bfb9 --- .../java/net/Indyuce/mmocore/api/player/PlayerData.java | 8 +++++--- .../java/net/Indyuce/mmocore/api/player/social/Party.java | 1 - src/main/java/net/Indyuce/mmocore/api/skill/Skill.java | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java b/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java index 2c515094..4c6d3697 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -66,7 +66,7 @@ public class PlayerData extends OfflinePlayerData { private final List friends = new ArrayList<>(); private final Set waypoints = new HashSet<>(); private final Map skills = new HashMap<>(); - private final List boundSkills = new ArrayList<>(5); + private final List boundSkills = new ArrayList<>(); private final PlayerProfessions collectSkills = new PlayerProfessions(this); private final PlayerSkillData skillData = new PlayerSkillData(this); private final PlayerAttributes attributes = new PlayerAttributes(this); @@ -688,12 +688,14 @@ public class PlayerData extends OfflinePlayerData { } public SkillInfo getBoundSkill(int slot) { - slot = Math.max(0, slot); return slot >= boundSkills.size() ? null : boundSkills.get(slot); } public void setBoundSkill(int slot, SkillInfo skill) { - boundSkills.set(Math.min(5, Math.max(0, slot)), skill); + if (boundSkills.size() < 6) + boundSkills.add(skill); + else + boundSkills.set(slot, skill); } public void unbindSkill(int slot) { diff --git a/src/main/java/net/Indyuce/mmocore/api/player/social/Party.java b/src/main/java/net/Indyuce/mmocore/api/player/social/Party.java index da002a35..046fe4da 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/social/Party.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/social/Party.java @@ -7,7 +7,6 @@ import java.util.Map; import java.util.UUID; import java.util.function.Consumer; -import net.Indyuce.mmocore.api.experience.EXPSource; import org.bukkit.entity.Player; import net.Indyuce.mmocore.MMOCore; diff --git a/src/main/java/net/Indyuce/mmocore/api/skill/Skill.java b/src/main/java/net/Indyuce/mmocore/api/skill/Skill.java index 904de9c5..377e60c2 100644 --- a/src/main/java/net/Indyuce/mmocore/api/skill/Skill.java +++ b/src/main/java/net/Indyuce/mmocore/api/skill/Skill.java @@ -130,7 +130,7 @@ public abstract class Skill { } /* - * not overridden for passive skills therefore not abstract. + * not overriden for passive skills therefore not abstract. */ public SkillResult whenCast(PlayerData data, SkillInfo skill) { return new SkillResult(data, skill);