mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2026-03-30 20:42:27 +02:00
Run spotlessApply
This commit is contained in:
@@ -6,9 +6,8 @@ import emu.grasscutter.Grasscutter;
|
||||
import emu.grasscutter.game.quest.enums.QuestContent;
|
||||
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
||||
import java.util.Map;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
@@ -39,28 +38,27 @@ public class PlayerProgress {
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks a dungeon as completed.
|
||||
* Triggers the quest event.
|
||||
* Marks a dungeon as completed. Triggers the quest event.
|
||||
*
|
||||
* @param dungeonId The dungeon which was completed.
|
||||
*/
|
||||
public void markDungeonAsComplete(int dungeonId) {
|
||||
if (this.getCompletedDungeons().contains(dungeonId))
|
||||
return;
|
||||
if (this.getCompletedDungeons().contains(dungeonId)) return;
|
||||
|
||||
// Mark the dungeon as completed.
|
||||
this.getCompletedDungeons().add(dungeonId);
|
||||
// Trigger the completion event.
|
||||
if (this.getPlayer() != null) {
|
||||
this.getPlayer().getQuestManager().queueEvent(
|
||||
QuestContent.QUEST_CONTENT_FINISH_DUNGEON, dungeonId
|
||||
);
|
||||
this.getPlayer()
|
||||
.getQuestManager()
|
||||
.queueEvent(QuestContent.QUEST_CONTENT_FINISH_DUNGEON, dungeonId);
|
||||
} else {
|
||||
Grasscutter.getLogger().warn("Unable to execute 'QUEST_CONTENT_FINISH_DUNGEON'. The player is null.");
|
||||
Grasscutter.getLogger()
|
||||
.warn("Unable to execute 'QUEST_CONTENT_FINISH_DUNGEON'. The player is null.");
|
||||
}
|
||||
|
||||
Grasscutter.getLogger().debug("Dungeon {} has been marked complete for {}.",
|
||||
dungeonId, this.getPlayer().getUid());
|
||||
Grasscutter.getLogger()
|
||||
.debug("Dungeon {} has been marked complete for {}.", dungeonId, this.getPlayer().getUid());
|
||||
}
|
||||
|
||||
public boolean hasPlayerObtainedItemHistorically(int itemId) {
|
||||
|
||||
@@ -132,8 +132,7 @@ public final class TeamManager extends BasePlayerDataManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the active team.
|
||||
* If there are errors with the team, they can be fixed.
|
||||
* Returns the active team. If there are errors with the team, they can be fixed.
|
||||
*
|
||||
* @param fix If true, the team will be fixed.
|
||||
* @return The active team.
|
||||
@@ -558,27 +557,32 @@ public final class TeamManager extends BasePlayerDataManager {
|
||||
this.trialAvatarTeam = new TeamInfo();
|
||||
|
||||
// Remove the avatars from the team.
|
||||
this.getActiveTeam().forEach(avatarEntity -> scene
|
||||
.removeEntity(avatarEntity, VisionTypeOuterClass.VisionType.VISION_TYPE_REMOVE));
|
||||
this.getActiveTeam()
|
||||
.forEach(
|
||||
avatarEntity ->
|
||||
scene.removeEntity(
|
||||
avatarEntity, VisionTypeOuterClass.VisionType.VISION_TYPE_REMOVE));
|
||||
|
||||
if (isTeam) {
|
||||
this.getActiveTeam().clear();
|
||||
this.getTrialAvatars().clear();
|
||||
} else {
|
||||
trialAvatarIds.forEach(
|
||||
trialAvatarId -> {
|
||||
this.getActiveTeam().removeIf(x -> x.getAvatar().getTrialAvatarId() == trialAvatarId);
|
||||
this.getTrialAvatars().values().removeIf(x -> x.getTrialAvatarId() == trialAvatarId);
|
||||
});
|
||||
trialAvatarId -> {
|
||||
this.getActiveTeam().removeIf(x -> x.getAvatar().getTrialAvatarId() == trialAvatarId);
|
||||
this.getTrialAvatars().values().removeIf(x -> x.getTrialAvatarId() == trialAvatarId);
|
||||
});
|
||||
}
|
||||
|
||||
// Re-add the avatars to the team.
|
||||
if (isTeam) {
|
||||
// Restores all avatars from the player's avatar storage.
|
||||
this.getCurrentTeamInfo().getAvatars().forEach(avatarId ->
|
||||
this.getActiveTeam().add(new EntityAvatar(
|
||||
scene, player.getAvatars().getAvatarById(avatarId)
|
||||
)));
|
||||
this.getCurrentTeamInfo()
|
||||
.getAvatars()
|
||||
.forEach(
|
||||
avatarId ->
|
||||
this.getActiveTeam()
|
||||
.add(new EntityAvatar(scene, player.getAvatars().getAvatarById(avatarId))));
|
||||
} else {
|
||||
// Restores all avatars from the player's avatar storage.
|
||||
// If the avatar is already in the team, it will not be added.
|
||||
@@ -586,9 +590,9 @@ public final class TeamManager extends BasePlayerDataManager {
|
||||
for (var index = 0; index < avatars.size() - 1; index++) {
|
||||
var avatar = avatars.get(index);
|
||||
if (this.getActiveTeam().stream()
|
||||
.map(entity -> entity.getAvatar().getAvatarId())
|
||||
.toList()
|
||||
.contains(avatar)) continue;
|
||||
.map(entity -> entity.getAvatar().getAvatarId())
|
||||
.toList()
|
||||
.contains(avatar)) continue;
|
||||
|
||||
// Check if the player owns the avatar.
|
||||
var avatarData = player.getAvatars().getAvatarById(avatar);
|
||||
@@ -1123,9 +1127,9 @@ public final class TeamManager extends BasePlayerDataManager {
|
||||
throw new IllegalStateException("Player is not using trial team.");
|
||||
|
||||
this.getPlayer()
|
||||
.sendPacket(
|
||||
new PacketAvatarDelNotify(
|
||||
trialAvatarIds.stream().map(this::getTrialAvatarGuid).toList()));
|
||||
.sendPacket(
|
||||
new PacketAvatarDelNotify(
|
||||
trialAvatarIds.stream().map(this::getTrialAvatarGuid).toList()));
|
||||
this.removeTrialAvatarTeam(trialAvatarIds);
|
||||
|
||||
// Update the team.
|
||||
|
||||
Reference in New Issue
Block a user