mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2024-11-30 01:13:38 +01:00
Fixed bug #782.
This commit is contained in:
parent
021cd960da
commit
f9fdbfa127
@ -19,6 +19,7 @@ import net.Indyuce.mmocore.api.player.profess.PlayerClass;
|
||||
import net.Indyuce.mmocore.api.player.profess.SavedClassInformation;
|
||||
import net.Indyuce.mmocore.api.player.profess.Subclass;
|
||||
import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource;
|
||||
import net.Indyuce.mmocore.api.quest.trigger.Trigger;
|
||||
import net.Indyuce.mmocore.skill.binding.BoundSkillInfo;
|
||||
import net.Indyuce.mmocore.api.player.social.FriendRequest;
|
||||
import net.Indyuce.mmocore.api.player.stats.PlayerStats;
|
||||
@ -163,14 +164,15 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
||||
* /mmocore reload
|
||||
*/
|
||||
public void reload() {
|
||||
|
||||
try {
|
||||
profess = profess == null ? null : MMOCore.plugin.classManager.get(profess.getId());
|
||||
getStats().updateStats();
|
||||
} catch (NullPointerException exception) {
|
||||
MMOCore.log(Level.SEVERE, "[Userdata] Could not find class " + getProfess().getId() + " while refreshing player data.");
|
||||
}
|
||||
|
||||
//We remove all the stats and buffs associated to triggers.
|
||||
mmoData.getStatMap().getInstances().forEach(statInstance -> statInstance.removeIf(key ->key.startsWith(Trigger.TRIGGER_PREFIX)));
|
||||
mmoData.getSkillModifierMap().getInstances().forEach(skillModifierInstance -> skillModifierInstance.removeIf(key ->key.startsWith(Trigger.TRIGGER_PREFIX)));
|
||||
final Iterator<Map.Entry<Integer, BoundSkillInfo>> ite = boundSkills.entrySet().iterator();
|
||||
while (ite.hasNext())
|
||||
try {
|
||||
@ -180,9 +182,8 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
||||
final @Nullable ClassSkill classSkill = getProfess().getSkill(skillId);
|
||||
Validate.notNull(skillSlot, "Could not find skill slot n" + entry.getKey());
|
||||
Validate.notNull(classSkill, "Could not find skill with ID '" + skillId + "'");
|
||||
|
||||
entry.getValue().close();
|
||||
boundSkills.put(entry.getKey(), new BoundSkillInfo(skillSlot, classSkill, this));
|
||||
unbindSkill(entry.getKey());
|
||||
bindSkill(entry.getKey(), classSkill);
|
||||
} catch (Exception exception) {
|
||||
MMOCore.plugin.getLogger().log(Level.WARNING, "Could not reload data of '" + getPlayer().getName() + "': " + exception.getMessage());
|
||||
}
|
||||
|
@ -37,11 +37,6 @@ public class StatTrigger extends Trigger implements Removable {
|
||||
prevModifier.add(amount).register(player.getMMOPlayerData());
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the effect of the trigger to the player by registering the
|
||||
* opposite amount. (Little corrective term for the relative to have the inverse.
|
||||
* Not a problem to store twice the stat modifiers are there only remain in the RAM.
|
||||
*/
|
||||
@Override
|
||||
public void remove(PlayerData playerData) {
|
||||
playerData.getMMOPlayerData().getStatMap().getInstance(stat).remove(modifierKey);
|
||||
|
Loading…
Reference in New Issue
Block a user