forked from Upstream/mmocore
Fixed issue #820 about skills not being locked when reallocating skill tree.
This commit is contained in:
parent
13440600a8
commit
aa6a1d7101
@ -377,6 +377,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
|||||||
*/
|
*/
|
||||||
public boolean unlock(Unlockable unlockable) {
|
public boolean unlock(Unlockable unlockable) {
|
||||||
Validate.isTrue(!unlockable.isUnlockedByDefault(), "Cannot unlock an item unlocked by default");
|
Validate.isTrue(!unlockable.isUnlockedByDefault(), "Cannot unlock an item unlocked by default");
|
||||||
|
unlockable.whenUnlocked(this);
|
||||||
final boolean wasLocked = unlockedItems.add(unlockable.getUnlockNamespacedKey());
|
final boolean wasLocked = unlockedItems.add(unlockable.getUnlockNamespacedKey());
|
||||||
// Call the event synchronously
|
// Call the event synchronously
|
||||||
if (wasLocked)
|
if (wasLocked)
|
||||||
@ -392,6 +393,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
|||||||
*/
|
*/
|
||||||
public boolean lock(Unlockable unlockable) {
|
public boolean lock(Unlockable unlockable) {
|
||||||
Validate.isTrue(!unlockable.isUnlockedByDefault(), "Cannot lock an item unlocked by default");
|
Validate.isTrue(!unlockable.isUnlockedByDefault(), "Cannot lock an item unlocked by default");
|
||||||
|
unlockable.whenLocked(this);
|
||||||
boolean wasUnlocked = unlockedItems.remove(unlockable.getUnlockNamespacedKey());
|
boolean wasUnlocked = unlockedItems.remove(unlockable.getUnlockNamespacedKey());
|
||||||
if (wasUnlocked)
|
if (wasUnlocked)
|
||||||
//Calls the event synchronously
|
//Calls the event synchronously
|
||||||
|
@ -87,7 +87,7 @@ public class ClassSkill implements CooldownObject, Unlockable {
|
|||||||
@Override
|
@Override
|
||||||
public void whenLocked(PlayerData playerData) {
|
public void whenLocked(PlayerData playerData) {
|
||||||
playerData.mapBoundSkills().forEach((slot, skill) -> {
|
playerData.mapBoundSkills().forEach((slot, skill) -> {
|
||||||
if (skill.equals(getUnlockNamespacedKey().split(":")[1]))
|
if (skill.equalsIgnoreCase(getUnlockNamespacedKey().split(":")[1]))
|
||||||
playerData.unbindSkill(slot);
|
playerData.unbindSkill(slot);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user