mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-26 22:22:51 +00:00
Fix a typo I left in Player.java (#2180)
ENTER_REGION_ ->LEAVE_REGION_ Took the opportunity to refactor it so that we only calculate the string once.
This commit is contained in:
parent
87269e9ded
commit
27be6c31e6
@ -707,15 +707,16 @@ public class Player implements PlayerHook, FieldFetch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onEnterRegion(SceneRegion region) {
|
public void onEnterRegion(SceneRegion region) {
|
||||||
|
var enterRegionName = "ENTER_REGION_" + region.config_id;
|
||||||
this.getQuestManager().forEachActiveQuest(quest -> {
|
this.getQuestManager().forEachActiveQuest(quest -> {
|
||||||
if (quest.getTriggerData() != null &&
|
if (quest.getTriggerData() != null &&
|
||||||
quest.getTriggers().containsKey("ENTER_REGION_"+ region.config_id) &&
|
quest.getTriggers().containsKey(enterRegionName) &&
|
||||||
region.getGroupId() == quest.getTriggerData().get("ENTER_REGION_" + region.config_id).getGroupId()) {
|
region.getGroupId() == quest.getTriggerData().get(enterRegionName).getGroupId()) {
|
||||||
// If trigger hasn't been fired yet
|
// If trigger hasn't been fired yet
|
||||||
if (!Boolean.TRUE.equals(quest.getTriggers().put("ENTER_REGION_" + region.config_id, true))) {
|
if (!Boolean.TRUE.equals(quest.getTriggers().put(enterRegionName, true))) {
|
||||||
this.getSession().send(new PacketServerCondMeetQuestListUpdateNotify());
|
this.getSession().send(new PacketServerCondMeetQuestListUpdateNotify());
|
||||||
this.getQuestManager().queueEvent(QuestContent.QUEST_CONTENT_TRIGGER_FIRE,
|
this.getQuestManager().queueEvent(QuestContent.QUEST_CONTENT_TRIGGER_FIRE,
|
||||||
quest.getTriggerData().get("ENTER_REGION_" + region.config_id).getId(), 0);
|
quest.getTriggerData().get(enterRegionName).getId(), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -723,14 +724,15 @@ public class Player implements PlayerHook, FieldFetch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onLeaveRegion(SceneRegion region) {
|
public void onLeaveRegion(SceneRegion region) {
|
||||||
|
var leaveRegionName = "LEAVE_REGION_" + region.config_id;
|
||||||
this.getQuestManager().forEachActiveQuest(quest -> {
|
this.getQuestManager().forEachActiveQuest(quest -> {
|
||||||
if (quest.getTriggers().containsKey("LEAVE_REGION_" + region.config_id) &&
|
if (quest.getTriggers().containsKey(leaveRegionName) &&
|
||||||
region.getGroupId() == quest.getTriggerData().get("ENTER_REGION_" + region.config_id).getGroupId()) {
|
region.getGroupId() == quest.getTriggerData().get(leaveRegionName).getGroupId()) {
|
||||||
// If trigger hasn't been fired yet
|
// If trigger hasn't been fired yet
|
||||||
if (!Boolean.TRUE.equals(quest.getTriggers().put("LEAVE_REGION_" + region.config_id, true))) {
|
if (!Boolean.TRUE.equals(quest.getTriggers().put(leaveRegionName, true))) {
|
||||||
this.getSession().send(new PacketServerCondMeetQuestListUpdateNotify());
|
this.getSession().send(new PacketServerCondMeetQuestListUpdateNotify());
|
||||||
this.getQuestManager().queueEvent(QuestContent.QUEST_CONTENT_TRIGGER_FIRE,
|
this.getQuestManager().queueEvent(QuestContent.QUEST_CONTENT_TRIGGER_FIRE,
|
||||||
quest.getTriggerData().get("LEAVE_REGION_" + region.config_id).getId(), 0);
|
quest.getTriggerData().get(leaveRegionName).getId(), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user