Run spotlessApply

This commit is contained in:
KingRainbow44
2023-04-18 17:17:55 -04:00
parent 75f163f704
commit ee298235c2
44 changed files with 598 additions and 424 deletions

View File

@@ -303,7 +303,15 @@ public class GameMainQuest {
return true;
}
public boolean hasTeleportPostion(int subId, List<Position> posAndRot) {
/**
* Checks if the quest has a teleport position. Returns true if it does & adds the target position
* & rotation to the list.
*
* @param subId The sub-quest ID.
* @param posAndRot A list which will contain the position & rotation if the quest has a teleport.
* @return True if the quest has a teleport position. False otherwise.
*/
public boolean hasTeleportPosition(int subId, List<Position> posAndRot) {
TeleportData questTransmit = GameData.getTeleportDataMap().get(subId);
if (questTransmit == null) return false;
@@ -338,7 +346,7 @@ public class GameMainQuest {
1,
new Position(
transmitPosRot.get(0), transmitPosRot.get(1), transmitPosRot.get(2))); // rotation
Grasscutter.getLogger().info("Succesfully loaded teleport data for subQuest {}", subId);
Grasscutter.getLogger().debug("Successfully loaded teleport data for sub-quest {}.", subId);
return true;
}

View File

@@ -20,12 +20,11 @@ import emu.grasscutter.server.packet.send.PacketChapterStateNotify;
import emu.grasscutter.server.packet.send.PacketDelQuestNotify;
import emu.grasscutter.server.packet.send.PacketQuestListUpdateNotify;
import emu.grasscutter.utils.Utils;
import it.unimi.dsi.fastutil.ints.IntIntImmutablePair;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.script.Bindings;
import it.unimi.dsi.fastutil.ints.IntIntImmutablePair;
import lombok.Getter;
import lombok.Setter;
import lombok.val;
@@ -227,8 +226,9 @@ public class GameQuest {
}
// Give items for completing the quest.
this.getQuestData().getGainItems().forEach(item ->
this.getOwner().getInventory().addItem(item, ActionReason.QuestItem));
this.getQuestData()
.getGainItems()
.forEach(item -> this.getOwner().getInventory().addItem(item, ActionReason.QuestItem));
this.save();
Grasscutter.getLogger().debug("Quest {} was completed.", subQuestId);
@@ -283,23 +283,26 @@ public class GameQuest {
}
/**
* @return A list of dungeon IDs associated with the quest's 'QUEST_CONTENT_ENTER_DUNGEON' triggers.
* The first element of the pair is the dungeon ID.
* The second element of the pair is the dungeon's scene point.
* @return A list of dungeon IDs associated with the quest's 'QUEST_CONTENT_ENTER_DUNGEON'
* triggers. The first element of the pair is the dungeon ID. The second element of the pair
* is the dungeon's scene point.
*/
public List<IntIntImmutablePair> getDungeonIds() {
var conditions = this.getQuestData().getFinishCond().stream()
.filter(cond -> cond.getType() == QuestContent.QUEST_CONTENT_ENTER_DUNGEON)
.toList();
var conditions =
this.getQuestData().getFinishCond().stream()
.filter(cond -> cond.getType() == QuestContent.QUEST_CONTENT_ENTER_DUNGEON)
.toList();
return conditions.stream()
.map(condition -> {
var params = condition.getParam();
// The first parameter is the ID of the dungeon.
// The second parameter is the dungeon entry's scene point.
// ex. [1, 1] = dungeon ID 1, scene point 1 or 'KaeyaDungeon'.
return new IntIntImmutablePair(params[0], params[1]);
}).toList();
.map(
condition -> {
var params = condition.getParam();
// The first parameter is the ID of the dungeon.
// The second parameter is the dungeon entry's scene point.
// ex. [1, 1] = dungeon ID 1, scene point 1 or 'KaeyaDungeon'.
return new IntIntImmutablePair(params[0], params[1]);
})
.toList();
}
public void save() {

View File

@@ -52,7 +52,9 @@ public class ExecNotifyGroupLua extends QuestExecHandler {
quest.getState() == QuestState.QUEST_STATE_FINISHED
? EventType.EVENT_QUEST_FINISH
: EventType.EVENT_QUEST_START;
scriptManager.callEvent(new ScriptArgs(groupId, eventType, quest.getSubQuestId()).setEventSource(String.valueOf(quest.getSubQuestId())));
scriptManager.callEvent(
new ScriptArgs(groupId, eventType, quest.getSubQuestId())
.setEventSource(String.valueOf(quest.getSubQuestId())));
});
return true;