Skip to content

Commit

Permalink
Workaround for OP party list not working
Browse files Browse the repository at this point in the history
  • Loading branch information
xpdota committed Jun 30, 2024
1 parent c6a232b commit e097f02
Showing 1 changed file with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package gg.xp.xivsupport.events.actlines.parsers;

import gg.xp.reevent.events.Event;
import gg.xp.xivsupport.events.ActImportOnly;
import gg.xp.reevent.events.EventContext;
import gg.xp.reevent.scan.FilteredEventHandler;
import gg.xp.reevent.scan.HandleEvents;
import gg.xp.xivsupport.events.ACTLogLineEvent;
import gg.xp.xivsupport.events.state.PartyChangeEvent;
import gg.xp.xivsupport.events.state.RawXivPartyInfo;
import org.picocontainer.PicoContainer;
Expand All @@ -12,16 +15,31 @@
import java.util.stream.IntStream;

@SuppressWarnings("unused")
public class Line11Parser extends AbstractACTLineParser<Line11Parser.Fields> implements ActImportOnly {
public class Line11Parser extends AbstractACTLineParser<Line11Parser.Fields> implements FilteredEventHandler {

private boolean enabled = true;

public Line11Parser(PicoContainer container) {
super(container, 11, Fields.class);
}

@Override
public boolean enabled(EventContext context) {
return enabled;
}

enum Fields {
count
}

// Disable self if OP or other source provides party info
@HandleEvents
public void watchForOtherPartyInfo(PartyChangeEvent pce) {
if (!(pce.getParent() instanceof ACTLogLineEvent) && pce.getMembers().size() > 1) {
enabled = false;
}
}

@Override
protected Event convert(FieldMapper<Fields> fields, int lineNumber, ZonedDateTime time) {
long count = fields.getLong(Fields.count);
Expand Down

0 comments on commit e097f02

Please sign in to comment.