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
+6
View File
@@ -355,6 +355,12 @@ public class NetClient implements ApplicationListener{
state.rules.objectives = executor; 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) @Remote(variants = Variant.both)
public static void worldDataBegin(){ public static void worldDataBegin(){
Groups.clear(); Groups.clear();
+2 -4
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. */ /** Called once after {@link #update()} returns true, before this objective is removed. */
public void done(){ public void done(){
changed(); changed();
state.rules.objectiveFlags.removeAll(flagsRemoved); Call.objectiveCompleted(flagsRemoved, flagsAdded);
state.rules.objectiveFlags.addAll(flagsAdded);
} }
/** Notifies the executor that map rules should be synced. */ /** 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(){ public final boolean dependencyFinished(){
if(depFinished) return true; if(depFinished) return true;
boolean f = true;
for(var parent : parents){ for(var parent : parents){
if(!parent.isCompleted()) return false; 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). */ /** @return True if this objective is done (practically, has been removed from the executor). */