Fixed objective flags not syncing

This commit is contained in:
Anuken 2023-06-12 10:35:31 -04:00
parent 2b9ee88cc2
commit a00b3a4670
2 changed files with 8 additions and 4 deletions

View File

@ -355,6 +355,12 @@ public class NetClient implements ApplicationListener{
state.rules.objectives = executor;
}
@Remote(called = Loc.server)
public static void objectiveCompleted(String[] flagsRemoved, String[] flagsAdded){
state.rules.objectiveFlags.removeAll(flagsRemoved);
state.rules.objectiveFlags.addAll(flagsAdded);
}
@Remote(variants = Variant.both)
public static void worldDataBegin(){
Groups.clear();

View File

@ -193,8 +193,7 @@ public class MapObjectives implements Iterable<MapObjective>, Eachable<MapObject
/** Called once after {@link #update()} returns true, before this objective is removed. */
public void done(){
changed();
state.rules.objectiveFlags.removeAll(flagsRemoved);
state.rules.objectiveFlags.addAll(flagsAdded);
Call.objectiveCompleted(flagsRemoved, flagsAdded);
}
/** Notifies the executor that map rules should be synced. */
@ -206,12 +205,11 @@ public class MapObjectives implements Iterable<MapObjective>, Eachable<MapObject
public final boolean dependencyFinished(){
if(depFinished) return true;
boolean f = true;
for(var parent : parents){
if(!parent.isCompleted()) return false;
}
return f && (depFinished = true);
return depFinished = true;
}
/** @return True if this objective is done (practically, has been removed from the executor). */