mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-22 06:31:26 +00:00
Fix NullPointerException when refilling an avatar with no skill depot
This commit is contained in:
parent
30f7580184
commit
a3fd10c3be
@ -1,7 +1,5 @@
|
|||||||
package emu.grasscutter.game.managers.energy;
|
package emu.grasscutter.game.managers.energy;
|
||||||
|
|
||||||
import static emu.grasscutter.config.Configuration.GAME_OPTIONS;
|
|
||||||
|
|
||||||
import com.google.protobuf.InvalidProtocolBufferException;
|
import com.google.protobuf.InvalidProtocolBufferException;
|
||||||
import emu.grasscutter.Grasscutter;
|
import emu.grasscutter.Grasscutter;
|
||||||
import emu.grasscutter.data.*;
|
import emu.grasscutter.data.*;
|
||||||
@ -23,9 +21,12 @@ import emu.grasscutter.net.proto.PropChangeReasonOuterClass.PropChangeReason;
|
|||||||
import emu.grasscutter.server.game.GameSession;
|
import emu.grasscutter.server.game.GameSession;
|
||||||
import it.unimi.dsi.fastutil.ints.*;
|
import it.unimi.dsi.fastutil.ints.*;
|
||||||
import it.unimi.dsi.fastutil.objects.*;
|
import it.unimi.dsi.fastutil.objects.*;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
import lombok.Getter;
|
|
||||||
|
import static emu.grasscutter.config.Configuration.GAME_OPTIONS;
|
||||||
|
|
||||||
public class EnergyManager extends BasePlayerManager {
|
public class EnergyManager extends BasePlayerManager {
|
||||||
private static final Int2ObjectMap<List<EnergyDropInfo>> energyDropData =
|
private static final Int2ObjectMap<List<EnergyDropInfo>> energyDropData =
|
||||||
@ -394,10 +395,12 @@ public class EnergyManager extends BasePlayerManager {
|
|||||||
public void refillTeamEnergy(PropChangeReason changeReason, boolean isFlat) {
|
public void refillTeamEnergy(PropChangeReason changeReason, boolean isFlat) {
|
||||||
for (var entityAvatar : this.player.getTeamManager().getActiveTeam()) {
|
for (var entityAvatar : this.player.getTeamManager().getActiveTeam()) {
|
||||||
// giving the exact amount read off the AvatarSkillData.json
|
// giving the exact amount read off the AvatarSkillData.json
|
||||||
entityAvatar.addEnergy(
|
var skillDepot = entityAvatar.getAvatar().getSkillDepot();
|
||||||
entityAvatar.getAvatar().getSkillDepot().getEnergySkillData().getCostElemVal(),
|
if (skillDepot != null) {
|
||||||
changeReason,
|
entityAvatar.addEnergy(
|
||||||
isFlat);
|
skillDepot.getEnergySkillData().getCostElemVal(),
|
||||||
|
changeReason, isFlat);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user