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
This commit is contained in:
Ethan 2021-02-13 02:12:16 -05:00
parent 422730e472
commit 3f085b91ec
3 changed files with 6 additions and 5 deletions

View File

@ -66,7 +66,7 @@ public class PlayerData extends OfflinePlayerData {
private final List<UUID> friends = new ArrayList<>(); private final List<UUID> friends = new ArrayList<>();
private final Set<String> waypoints = new HashSet<>(); private final Set<String> waypoints = new HashSet<>();
private final Map<String, Integer> skills = new HashMap<>(); private final Map<String, Integer> skills = new HashMap<>();
private final List<SkillInfo> boundSkills = new ArrayList<>(5); private final List<SkillInfo> boundSkills = new ArrayList<>();
private final PlayerProfessions collectSkills = new PlayerProfessions(this); private final PlayerProfessions collectSkills = new PlayerProfessions(this);
private final PlayerSkillData skillData = new PlayerSkillData(this); private final PlayerSkillData skillData = new PlayerSkillData(this);
private final PlayerAttributes attributes = new PlayerAttributes(this); private final PlayerAttributes attributes = new PlayerAttributes(this);
@ -688,12 +688,14 @@ public class PlayerData extends OfflinePlayerData {
} }
public SkillInfo getBoundSkill(int slot) { public SkillInfo getBoundSkill(int slot) {
slot = Math.max(0, slot);
return slot >= boundSkills.size() ? null : boundSkills.get(slot); return slot >= boundSkills.size() ? null : boundSkills.get(slot);
} }
public void setBoundSkill(int slot, SkillInfo skill) { 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) { public void unbindSkill(int slot) {

View File

@ -7,7 +7,6 @@ import java.util.Map;
import java.util.UUID; import java.util.UUID;
import java.util.function.Consumer; import java.util.function.Consumer;
import net.Indyuce.mmocore.api.experience.EXPSource;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.MMOCore;

View File

@ -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) { public SkillResult whenCast(PlayerData data, SkillInfo skill) {
return new SkillResult(data, skill); return new SkillResult(data, skill);