Run spotlessApply

also set line endings to native, no more line conflict errors!
This commit is contained in:
KingRainbow44
2023-05-02 14:00:00 +01:00
parent 4f1136ce2d
commit d32f6982be
1426 changed files with 1307544 additions and 1212706 deletions

View File

@@ -923,46 +923,6 @@ public class Player {
this.getServer().getChatSystem().sendPrivateMessageFromServer(getUid(), message.toString());
}
public void setAvatarsAbilityForScene(Scene scene) {
try {
var levelEntityConfig = scene.getSceneData().getLevelEntityConfig();
var config = GameData.getConfigLevelEntityDataMap().get(levelEntityConfig);
if (config == null){
return;
}
List<Integer> avatarIds = scene.getSceneData().getSpecifiedAvatarList();
List<EntityAvatar> specifiedAvatarList = getTeamManager().getActiveTeam();
if (avatarIds != null && avatarIds.size() > 0){
// certain scene could limit a specific avatar's entry
specifiedAvatarList.clear();
for (int id : avatarIds){
var avatar = getAvatars().getAvatarById(id);
if (avatar == null){
continue;
}
specifiedAvatarList.add(new EntityAvatar(scene, avatar));
}
}
for (EntityAvatar entityAvatar : specifiedAvatarList){
var avatarData = entityAvatar.getAvatar().getAvatarData();
if (avatarData == null){
continue;
}
avatarData.buildEmbryo();
if (config.getAvatarAbilities() == null){
continue; // continue and not break because has to rebuild ability for the next avatar if any
}
for (var abilities : config.getAvatarAbilities()){
avatarData.getAbilities().add(Utils.abilityHash(abilities.getAbilityName()));
}
}
} catch (Exception e){
Grasscutter.getLogger().error("Error applying level entity config for scene {}", scene.getSceneData().getId(), e);
}
}
/**
* Sends a message to another player.
*

View File

@@ -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) {

View File

@@ -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.