package adk.sample.basic.util;

import adk.team.util.DebrisRemovalSelector;
import rescuecore2.standard.entities.Blockade;
import rescuecore2.standard.entities.Road;

public class BasicDebrisRemovalSelector implements DebrisRemovalSelector {
}

@@ -69,16 +69,96 @@
 lector;%0A
+import adk.team.util.PositionUtil;%0Aimport adk.team.util.provider.WorldProvider;%0A
 import r
@@ -243,82 +243,2332 @@
 ad;%0A
-%0Apublic class BasicDebrisRemovalSelector implements DebrisRemovalSelector %7B
+import rescuecore2.standard.entities.StandardEntity;%0Aimport rescuecore2.worldmodel.EntityID;%0A%0Aimport java.util.HashSet;%0Aimport java.util.Set;%0A%0Apublic class BasicDebrisRemovalSelector implements DebrisRemovalSelector %7B%0A%0A    public Set%3CRoad%3E impassableRoadList;%0A    public Set%3CEntityID%3E passableRoadList;%0A%0A    public WorldProvider%3C? extends StandardEntity%3E provider;%0A%0A    public BasicDebrisRemovalSelector(WorldProvider%3C? extends StandardEntity%3E user) %7B%0A        this.provider = user;%0A        this.impassableRoadList = new HashSet%3C%3E();%0A        this.passableRoadList = new HashSet%3C%3E();%0A    %7D%0A%0A    @Override%0A    public void add(Road road) %7B%0A        if(!this.passableRoadList.contains(road.getID()) && !road.getBlockades().isEmpty()) %7B%0A            this.impassableRoadList.add(road);%0A        %7D%0A    %7D%0A%0A    @Override%0A    public void add(Blockade blockade) %7B%0A        Road road = (Road)this.provider.getWorld().getEntity(blockade.getPosition());%0A        if(!this.passableRoadList.contains(road.getID())) %7B%0A            this.impassableRoadList.add(road);%0A        %7D%0A    %7D%0A%0A    @Override%0A    public void add(EntityID id) %7B%0A        StandardEntity entity = this.provider.getWorld().getEntity(id);%0A        if(entity instanceof Road) %7B%0A            this.add((Road)entity);%0A        %7D%0A        else if(entity instanceof Blockade) %7B%0A            this.add((Blockade)entity);%0A        %7D%0A    %7D%0A%0A    @Override%0A    public void remove(Road road) %7B%0A        this.impassableRoadList.remove(road);%0A        this.passableRoadList.add(road.getID());%0A    %7D%0A%0A    @Override%0A    public void remove(Blockade blockade) %7B%0A        Road road = (Road)this.provider.getWorld().getEntity(blockade.getPosition());%0A        if(road.getBlockades().isEmpty()) %7B%0A            this.remove(road);%0A        %7D%0A    %7D%0A%0A    @Override%0A    public void remove(EntityID id) %7B%0A        StandardEntity entity = this.provider.getWorld().getEntity(id);%0A        if(entity instanceof Road) %7B%0A            this.remove((Road) entity);%0A        %7D%0A        else if(entity instanceof Blockade) %7B%0A            this.remove((Blockade) entity);%0A        %7D%0A    %7D%0A%0A    @Override%0A    public EntityID getTarget(int time) %7B%0A        StandardEntity result = PositionUtil.getNearTarget(this.provider.getWorld(), this.provider.getOwner(), this.impassableRoadList);%0A        return result != null ? result.getID() : null;%0A    %7D
 %0A%7D%0A

update TargetSelector